Method, device and medium for generating electronic fence
By obtaining and connecting the position coordinates of home devices to form electronic fences, the problem of low convenience in generating electronic fences in the existing technology is solved, and the convenience of generating electronic fences without using special scanning equipment is achieved.
Patent Information
- Application Number
- CN202111125470.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-24
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2041-09-24
AI Technical Summary
Existing electronic fence generation methods rely on device hardware to scan the environment, resulting in low generation convenience, especially when the hardware is insufficient and cannot generate electronic fences.
By obtaining the position coordinates of each home device, determining its relative position, and connecting them to form an electronic fence based on these position coordinates, the home devices in the environment can be directly positioned, avoiding the use of specialized scanning equipment to obtain environmental image information.
It improves the convenience of electronic fence generation. It can generate electronic fences without relying on special hardware scanning equipment, and directly locate and generate them based on the location coordinates of home devices.
Smart Images

Figure CN113873436B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electronic fences, and in particular to a method for generating an electronic fence, a device for generating an electronic fence, and a computer-readable storage medium. Background Art
[0002] The current method of generating an electronic fence mainly relies on the device's camera or sensor to scan the environment to obtain environmental image information, and determine the boundary information of the fence based on the environmental image information, or the user manually draws the electronic fence after scanning. This method requires the use of the device with corresponding hardware support. However, if the hardware of the device used is not sufficient to support scanning the environment, the electronic fence cannot be generated, resulting in low convenience in generating the electronic fence. Summary of the invention
[0003] The embodiments of the present invention provide a method, device and medium for generating an electronic fence, aiming to solve the technical problem of low convenience in generating an electronic fence in the prior art.
[0004] To achieve the above object, an embodiment of the present invention provides a method for generating an electronic fence, the method for generating an electronic fence comprising:
[0005] Get the location coordinates of each home device;
[0006] Determine the relative position of each household device according to the position coordinates;
[0007] The coordinate points corresponding to the position coordinates of each household device are connected according to the relative positions to form an electronic fence, wherein the coordinate points corresponding to each household device are on the boundary line of the electronic fence.
[0008] Optionally, the step of determining the relative position of each home according to the position coordinates includes:
[0009] Obtaining the mean of the position coordinates, and determining the center of gravity position point according to the coordinate point corresponding to the mean;
[0010] A vector between a coordinate point corresponding to the position coordinates of each household appliance and a center of gravity position point;
[0011] The relative position of each household device is determined according to each of the vectors.
[0012] Optionally, the step of determining the relative position of each household device according to each of the vectors includes:
[0013] Determining relative directions of adjacent vectors based on the cross products of the vectors;
[0014] The relative positions of the various household appliances are determined according to the relative directions of the adjacent vectors.
[0015] Optionally, the step of connecting coordinate points corresponding to the position coordinates of each household device according to the relative position to form an electronic fence includes:
[0016] Determine the starting point of the electronic fence connection according to the relative position of each home appliance, and obtain the type of each home appliance in turn;
[0017] Starting from the connection starting point, the coordinate points corresponding to each household device are connected in sequence according to the relative positions and types of each household device to form an electronic fence.
[0018] Optionally, starting from the connection starting point, the step of sequentially connecting the coordinate points corresponding to each household device according to the relative position and type of each household device to form an electronic fence includes:
[0019] Starting from the connection starting point, sequentially acquiring coordinate points to be connected according to the relative positions;
[0020] When each coordinate point to be connected is obtained, the type of home appliance corresponding to each coordinate point to be connected is obtained;
[0021] When the type of the household device corresponding to the coordinate point to be connected is a linear type, obtaining the type of the household device corresponding to the currently connected coordinate point;
[0022] When the type of the household equipment corresponding to the connected coordinate point adjacent to the coordinate point to be connected is a linear type, the intersection point formed by the straight line formed by the household equipment corresponding to the currently connected coordinate point and the straight line formed by the household equipment corresponding to the coordinate point to be connected is taken as the boundary intersection point of the electronic fence;
[0023] When the type of the household equipment corresponding to the connected coordinate points adjacent to the coordinate point to be connected is point type, the coordinate points to be connected are connected to form the boundary of the electronic fence.
[0024] Optionally, after the step of obtaining the type of the household device corresponding to each of the coordinate points to be connected, the method further includes:
[0025] When the type of the household device corresponding to the coordinate point to be connected is a point type, obtaining the type of the household device corresponding to the connected coordinate point adjacent to the coordinate point to be connected;
[0026] When the type of the household device corresponding to the connected coordinate point adjacent to the coordinate point to be connected is point type, connecting the coordinate point to be connected;
[0027] When the type of the household equipment corresponding to the connected coordinate point adjacent to the coordinate point to be connected is a line type, obtaining the type of the household equipment corresponding to the unconnected coordinate point adjacent to the coordinate point to be connected;
[0028] When the type of home equipment corresponding to the unconnected coordinate point is a point type, the coordinate point to be connected and the adjacent unconnected coordinate point form a straight line, and the intersection of the straight line corresponding to the adjacent connected coordinate point adjacent to the coordinate point to be connected and the straight line where the coordinate point to be connected is the boundary intersection of the electronic fence.
[0029] Optionally, after the step of connecting the coordinate points corresponding to the position coordinates of each household device according to the relative position to form an electronic fence, the method further includes:
[0030] Obtaining the coordinates of the target object and the straight line equations of each side of the electronic fence, wherein the straight line equation corresponding to each side is obtained based on the coordinate information of the coordinate points on the side;
[0031] Determine the target value of each side of the electronic fence according to the coordinates of the target object and each of the straight line equations;
[0032] The relative position of the target object and the electronic fence is determined according to the target value of each edge.
[0033] Optionally, after the step of determining the relative position between the target object and the electronic fence according to the target value of each edge, the step further includes:
[0034] When the relative position is that the target object is located within the electronic fence, comparing the target value with a preset threshold;
[0035] When the target value is less than the preset threshold, an early warning prompt message is output.
[0036] Optionally, after the step of determining the relative position between the target object and the electronic fence according to the target value of each edge, the step further includes:
[0037] Comparing the target value of each edge with the preset condition of the edge;
[0038] When the target value of each edge satisfies the preset condition of the edge, determining that the target object is located within the electronic fence;
[0039] When at least one of the target values of each edge does not satisfy the preset condition of the edge, determining that the target object is outside the electronic fence;
[0040] The preset condition corresponding to each edge is obtained by the straight line equation of the edge and the coordinate information of the remaining edges in the electronic fence.
[0041] To achieve the above-mentioned purpose, an embodiment of the present invention also provides an electronic fence generation device, which includes a memory, a processor, and an electronic fence generation program stored in the memory and executable on the processor, and the processor implements the method described above when executing the electronic fence generation program.
[0042] To achieve the above objective, an embodiment of the present invention further provides a computer-readable storage medium on which a program for generating an electronic fence is stored. When the program for generating an electronic fence is executed by a processor, the method described above is implemented.
[0043] The electronic fence generation method, device and medium provided by the embodiments of the present invention, the electronic fence generation device obtains the position coordinates of each household appliance; determines the relative position of each household appliance according to the position coordinates; connects the coordinate points corresponding to the position coordinates of each household appliance according to the relative position to form an electronic fence, so that the household appliances in the environment are directly located, and the electronic fence is generated according to the position coordinates of the household appliances, without using a special scanning device to scan the surrounding environment to obtain environmental image information to determine the boundary of the electronic fence to generate the electronic fence, thereby improving the convenience of electronic fence generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention;
[0045] Figure 2 It is a flowchart of a first embodiment of a method for generating an electronic fence according to the present invention;
[0046] Figure 3 It is a flow chart of a second embodiment of a method for generating an electronic fence according to the present invention;
[0047] Figure 4 It is a flow chart of a second embodiment of a method for generating an electronic fence according to the present invention;
[0048] Figure 5 It is a flow chart of a second embodiment of a method for generating an electronic fence according to the present invention;
[0049] Figure 6 A schematic diagram of an embodiment of connecting coordinate points corresponding to various household devices to form an electronic fence;
[0050] Figure 7 A schematic diagram of an embodiment of connecting coordinate points corresponding to various household devices to form an electronic fence;
[0051] Figure 8 A schematic diagram of an embodiment of connecting coordinate points corresponding to various household devices to form an electronic fence;
[0052] Fig. 9 A schematic diagram of an embodiment of connecting coordinate points corresponding to various household devices to form an electronic fence. DETAILED DESCRIPTION
[0053] In order to better understand the above technical solution, exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0054] As an implementation method, the electronic fence generation device can be as follows: Figure 1 shown.
[0055] The embodiment of the present invention relates to an electronic fence generation device, which includes: a processor 101, such as a CPU, a memory 102, and a communication bus 103. The communication bus 103 is used to realize connection and communication between these components.
[0056] The memory 102 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. Figure 1 As shown, the memory 102 as a computer storage medium may include an electronic fence generation program; and the processor 101 may be used to call the electronic fence generation program stored in the memory 102 and perform the following operations:
[0057] Get the location coordinates of each home device;
[0058] Determine the relative position of each household device according to the position coordinates;
[0059] The coordinate points corresponding to the position coordinates of each household device are connected according to the relative positions to form an electronic fence, wherein the coordinate points corresponding to each household device are on the boundary line of the electronic fence.
[0060] In one embodiment, the processor 101 may be used to call a program for generating an electronic fence stored in the memory 102, and perform the following operations:
[0061] Obtaining the mean of the position coordinates, and determining the center of gravity position point according to the coordinate point corresponding to the mean;
[0062] A vector between a coordinate point corresponding to the position coordinates of each household appliance and a center of gravity position point;
[0063] The relative position of each household device is determined according to each of the vectors.
[0064] In one embodiment, the processor 101 may be used to call a program for generating an electronic fence stored in the memory 102, and perform the following operations:
[0065] Determining relative directions of adjacent vectors based on the cross products of the vectors;
[0066] The relative positions of the various household appliances are determined according to the relative directions of the adjacent vectors.
[0067] In one embodiment, the processor 101 may be used to call a program for generating an electronic fence stored in the memory 102, and perform the following operations:
[0068] Determine the starting point of the electronic fence connection according to the relative position of each home appliance, and obtain the type of each home appliance in turn;
[0069] Starting from the connection starting point, the coordinate points corresponding to each household device are connected in sequence according to the relative positions and types of each household device to form an electronic fence.
[0070] In one embodiment, the processor 101 may be used to call a program for generating an electronic fence stored in the memory 102, and perform the following operations:
[0071] Starting from the connection starting point, sequentially acquiring coordinate points to be connected according to the relative positions;
[0072] When each coordinate point to be connected is obtained, the type of home appliance corresponding to each coordinate point to be connected is obtained;
[0073] When the type of the household device corresponding to the coordinate point to be connected is a linear type, obtaining the type of the household device corresponding to the currently connected coordinate point;
[0074] When the type of the household equipment corresponding to the connected coordinate point adjacent to the coordinate point to be connected is a linear type, the intersection point formed by the straight line formed by the household equipment corresponding to the currently connected coordinate point and the straight line formed by the household equipment corresponding to the coordinate point to be connected is taken as the boundary intersection point of the electronic fence;
[0075] When the type of the household equipment corresponding to the connected coordinate points adjacent to the coordinate point to be connected is point type, the coordinate points to be connected are connected to form the boundary of the electronic fence.
[0076] In one embodiment, the processor 101 may be used to call a program for generating an electronic fence stored in the memory 102, and perform the following operations:
[0077] When the type of the household device corresponding to the coordinate point to be connected is a point type, obtaining the type of the household device corresponding to the connected coordinate point adjacent to the coordinate point to be connected;
[0078] When the type of the household device corresponding to the connected coordinate point adjacent to the coordinate point to be connected is point type, connecting the coordinate point to be connected and the adjacent connected coordinate point;
[0079] When the type of the household equipment corresponding to the connected coordinate point adjacent to the coordinate point to be connected is a line type, obtaining the type of the household equipment corresponding to the unconnected coordinate point adjacent to the coordinate point to be connected;
[0080] When the type of home equipment corresponding to the unconnected coordinate point is a point type, the coordinate point to be connected and the adjacent unconnected coordinate point are connected to form a straight line, and the intersection of the straight line corresponding to the adjacent connected coordinate point adjacent to the coordinate point to be connected and the straight line where the coordinate point to be connected is the boundary intersection of the electronic fence.
[0081] In one embodiment, the processor 101 may be used to call a program for generating an electronic fence stored in the memory 102, and perform the following operations:
[0082] Obtaining the coordinates of the target object and the straight line equations of each side of the electronic fence, wherein the straight line equation corresponding to each side is obtained based on the coordinate information of the coordinate points on the side;
[0083] Determine the target value of each side of the electronic fence according to the coordinates of the target object and each of the straight line equations;
[0084] The relative position between the target object and the electronic fence is determined according to the target value of each edge. In one embodiment, the processor 101 can be used to call the electronic fence generation program stored in the memory 102 and perform the following operations:
[0085] When the relative position is that the target object is located within the electronic fence, comparing the target value with a preset threshold;
[0086] When the target value is less than the preset threshold, an early warning prompt message is output.
[0087] In one embodiment, the processor 101 may be used to call a program for generating an electronic fence stored in the memory 102, and perform the following operations:
[0088] Comparing the target value of each edge with the preset condition of the edge;
[0089] When the target value of each edge satisfies the preset condition of the edge, determining that the target object is located within the electronic fence;
[0090] When at least one of the target values of each edge does not satisfy the preset condition of the edge, determining that the target object is outside the electronic fence;
[0091] The preset condition corresponding to each edge is obtained by the straight line equation of the edge and the coordinate information of the remaining edges in the electronic fence.
[0092] According to the above scheme, the device for generating an electronic fence in this embodiment obtains the position coordinates of each household appliance; determines the relative position of each household appliance based on the position coordinates; connects the coordinate points corresponding to the position coordinates of each household appliance based on the relative positions to form an electronic fence, thereby directly locating the household appliances in the environment and generating an electronic fence based on the position coordinates of the household appliances, without using a special scanning device to scan the surrounding environment to obtain environmental image information to determine the boundary of the electronic fence and thus generate the electronic fence, thereby improving the convenience of generating the electronic fence.
[0093] Based on the hardware architecture of the air conditioner described above, an embodiment of a method for generating an electronic fence of the present invention is proposed.
[0094] Reference Figure 2 , Figure 2 This is a first embodiment of a method for generating an electronic fence according to the present invention. The method for generating an electronic fence comprises the following steps:
[0095] Step S10, obtaining the location coordinates of each home appliance;
[0096] It should be noted that in this embodiment, each household appliance can be set against the wall by default, or can be used as a device to form a fence. Each household appliance can be a smart home of the same series, which can be connected to the same hotspot network to achieve communication and can be controlled by the same application system, which can be installed on a mobile terminal or PC, etc. Therefore, the location coordinates of each household appliance can be located according to the Wi-Fi hotspot, such as the triangulation positioning method. Alternatively, the positioning of each household appliance can be achieved by using methods such as Bluetooth, infrared, ultra-wideband, RFID, ZigBee and ultrasound, which are not specifically limited here. The executor of the electronic fence generation method, that is, the electronic fence generation device, can be a mobile terminal.
[0097] Step S20, determining the relative position of each household device according to the position coordinates;
[0098] Optionally, a mean value of the position coordinates is obtained, and a center of gravity position point is determined according to a coordinate point corresponding to the mean value;
[0099] A vector between a coordinate point corresponding to the position coordinates of each household appliance and a center of gravity position point;
[0100] The relative position of each household device is determined according to each of the vectors.
[0101] Specifically, determining the relative directions of adjacent vectors according to the cross products of the vectors;
[0102] The relative positions of the various household appliances are determined according to the relative directions of the adjacent vectors.
[0103] Reference Figure 6 , Figure 6 A schematic diagram of an embodiment of connecting the coordinate points corresponding to each household appliance to form an electronic fence. A1A2, B1B1, S1, S2, S3 and S4 are the coordinate points corresponding to each household appliance. Point M is the center of gravity of the polygon surrounded by each household appliance. The horizontal coordinate of the center of gravity is the average of the horizontal coordinates of all points, and the vertical coordinate is the average of the vertical coordinates of all points. Point M and the coordinate points corresponding to each household appliance are connected to form multiple vectors such as vectors MA1, MA2, MB1, MB2, MS4, MS3, MS2 and MS1. Cross product operations are performed on each vector in pairs to determine the relative direction between the vectors. For example, vector MA2 is cross-producted with vector MB1 to obtain It means that the direction from vector MA2 to vector MB1 is clockwise, that is, coordinate point B1 is in the clockwise direction of coordinate point A2. After calculating the cross products of all vectors in sequence, the relative positions of various home appliances can be known. For example, the clockwise coordinate point set {A2B1B2S4S3S2S1A1} centered on the center of gravity point M can be obtained.
[0104] Step S30: Connect the coordinate points corresponding to the position coordinates of each household appliance according to the relative position to form an electronic fence, wherein the coordinate points corresponding to each household appliance are on the boundary line of the electronic fence.
[0105] The coordinate points corresponding to each home appliance are connected in sequence according to the relative positions of each home appliance to form an electronic fence, wherein the line segment connecting each home appliance is the boundary of the electronic fence.
[0106] In the technical solution provided in this embodiment, the device for generating an electronic fence obtains the position coordinates of each household appliance; determines the relative position of each household appliance based on the position coordinates; connects the coordinate points corresponding to the position coordinates of each household appliance based on the relative positions to form an electronic fence, wherein the coordinate points corresponding to each household appliance are on the boundary line of the electronic fence. In this way, the household appliances in the environment are directly located, and an electronic fence is generated based on the position coordinates of the household appliances, without using a special scanning device to scan the surrounding environment to obtain environmental image information to determine the boundary of the electronic fence and thus generate the electronic fence, thereby improving the convenience of generating the electronic fence.
[0107] Reference Figure 3 , Figure 3 This is a second embodiment of the method for generating an electronic fence of the present invention. Based on the first embodiment, step S30 includes:
[0108] Step S31, determining the electronic fence connection starting point according to the relative position of each household device, and obtaining the type of each household device in turn;
[0109] It is understandable that some home appliances are in the shape of long strips, such as curtains or large-screen TVs, and some are point-shaped, such as living room spotlights. In this way, when obtaining the position coordinates of home appliances, the home appliances cannot be simply obtained according to one coordinate point, so it is necessary to first know the type of home appliances in order to accurately obtain the position coordinates of the home appliances. For example, if the home appliance is in the shape of a long strip, it is necessary to obtain the position coordinates of the two end points of the home appliance, and the line segment formed by the two end points is used as the position coordinates of the long strip home appliance. Optionally, before step S10, it also includes: obtaining the type of each home appliance.
[0110] Refer to Table 1, which is a classification table of various home appliances. Among them, the ID is identification information for distinguishing various home appliances, the name can be determined by the user to facilitate user identification, the type is divided into point type and line type, the position identifies the room where the home appliance is located, and the coordinates are the specific position coordinates of the home appliance in the room. If the home appliance is a linear home appliance, the coordinates of the two end points of the home appliance are obtained.
[0111] The home appliances in the table are assumed to be against the wall or can be used to form a fence.
[0112]
[0113] Step S32: starting from the connection starting point, the coordinate points corresponding to each household device are sequentially connected according to the relative position and type of each household device to form an electronic fence.
[0114] Optionally, starting from the connection starting point, coordinate points to be connected are acquired in sequence according to the relative positions;
[0115] When each coordinate point to be connected is obtained, the type of home appliance corresponding to each coordinate point to be connected is obtained;
[0116] When the type of the household device corresponding to the coordinate point to be connected is a linear type, obtaining the type of the household device corresponding to the currently connected coordinate point;
[0117] When the type of the household equipment corresponding to the connected coordinate point adjacent to the coordinate point to be connected is a linear type, the intersection point formed by the straight line formed by the household equipment corresponding to the currently connected coordinate point and the straight line formed by the household equipment corresponding to the coordinate point to be connected is taken as the boundary intersection point of the electronic fence;
[0118] Reference Figure 7 , Figure 7 A schematic diagram of an embodiment of connecting the coordinate points corresponding to each household appliance to form an electronic fence. Point A1A2 is a linear household appliance, B1B2 is a linear household appliance, and S1, S2, S3, and S4 are point household appliances. When the household appliance corresponding to the connected coordinate point A1A2 adjacent to the coordinate point B1B2 to be connected is linear, the household appliance corresponding to the coordinate point B1B2 to be connected is also linear, and when the two adjacent linear household appliances are not on the same straight line, the intersection point B (Xb, Yb) of the straight lines corresponding to the two linear household appliances is taken as the boundary intersection point of the electronic fence. The shape of the electronic fence connected in this way is closer to the internal space of the room, so that the formed electronic fence is more accurate.
[0119] When the type of the household equipment corresponding to the connected coordinate points adjacent to the coordinate point to be connected is point type, the coordinate points to be connected are connected to form the boundary of the electronic fence.
[0120] Reference Figure 7 , when the type of household equipment corresponding to the connected coordinate point S1 adjacent to the coordinate point A1A2 to be connected is point type, and the type of household equipment corresponding to the coordinate point A1A2 to be connected is line type, the coordinate point S1 corresponding to the point type household equipment and the endpoint A1 adjacent to the coordinate point S1 in the coordinate point A1A2 corresponding to the line type household equipment are connected to form the boundary of the electronic fence. In this embodiment, the electronic fence is A1BCS3S2S1A1.
[0121] Optionally, after the step of obtaining the type of the household device corresponding to each of the coordinate points to be connected, the method further includes:
[0122] When the type of the household device corresponding to the coordinate point to be connected is a point type, obtaining the type of the household device corresponding to the connected coordinate point adjacent to the coordinate point to be connected;
[0123] When the type of the household device corresponding to the connected coordinate point adjacent to the coordinate point to be connected is point type, connecting the coordinate point to be connected and the adjacent connected coordinate point;
[0124] Reference Figure 7, the type of household equipment corresponding to the connected coordinate point S3 adjacent to the coordinate point S2 to be connected is point type, and the type of household equipment corresponding to the coordinate point S2 to be connected is also point type. At this time, the coordinate point S2 to be connected is connected from the connected coordinate point S3 to form the boundary of the electronic fence.
[0125] When the type of the household equipment corresponding to the connected coordinate point adjacent to the coordinate point to be connected is a line type, obtaining the type of the household equipment corresponding to the unconnected coordinate point adjacent to the coordinate point to be connected;
[0126] When the type of home equipment corresponding to the unconnected coordinate point is a point type, the coordinate point to be connected and the adjacent unconnected coordinate point are connected to form a straight line, and the intersection of the straight line corresponding to the adjacent connected coordinate point adjacent to the coordinate point to be connected and the straight line where the coordinate point to be connected is the boundary intersection of the electronic fence.
[0127] Reference Figure 7 , the type of household equipment corresponding to the connected coordinate point B1B2 adjacent to the coordinate point S4 to be connected is a linear type, and the type of household equipment corresponding to the coordinate point S4 to be connected is a point type. At this time, the type of household equipment corresponding to the unconnected coordinate point S3 adjacent to the coordinate point S4 to be connected is obtained. When the type of household equipment corresponding to the coordinate point S3 is a point type, the coordinate point S3 and the coordinate point S4 are connected as a straight line. The straight line S3S4 intersects the straight line B1B2 corresponding to the linear household equipment at point C (Xc, Yc), and the point C (Xc, Yc) is the boundary intersection of the electronic fence.
[0128] Optionally, if the coordinate points to be connected are on the straight line corresponding to the connected coordinate points, the coordinate points to be connected are connected to form the boundary of the electronic fence. Figure 8 , Figure 8 A schematic diagram of an embodiment of connecting the coordinate points corresponding to each household device to form an electronic fence. When the coordinate point S4 to be connected is on the straight line corresponding to the connected coordinate point B1B2, the coordinate point S4 is connected, and the BS4 is the boundary of the electronic fence. In this embodiment, the electronic fence formed is A1BS4S3S2S1A1.
[0129] Optionally, when the type of the household equipment corresponding to the coordinate point after the coordinate point to be connected is a line type, the coordinate point to be connected is connected.
[0130] Optionally, in one embodiment, referring to Figure 6 , obtain the coordinate points corresponding to all home devices in turn, and connect each coordinate point in turn to form an electronic fence A1A2B1B2S4S3S2S1A1, where each coordinate point is a boundary intersection of the electronic fence.
[0131] In the technical solution provided by this embodiment, the electronic fence generation device determines the electronic fence connection starting point according to the relative position of each household appliance, and sequentially obtains the type of each household appliance; starting from the connection starting point, the coordinate points corresponding to each household appliance are sequentially connected according to the relative position and type of each household appliance to form an electronic fence. The shape of the electronic fence connected in this way is closer to the internal space of the room, so that the formed electronic fence is more accurate.
[0132] Reference Figure 4 , Figure 4 This is a third embodiment of the method for generating an electronic fence of the present invention, based on the first or second embodiment, and after step S30, further comprising:
[0133] Step S40, obtaining the coordinates of the target object and the straight line equations of each side of the electronic fence, wherein the straight line equation corresponding to each side is obtained according to the coordinate information of the coordinate points on the side;
[0134] Reference Fig. 9 , Fig. 9 A schematic diagram of an embodiment of connecting the coordinate points corresponding to each household appliance to form an electronic fence. AB, BC, CD, and DA are the electronic fence ranges automatically formed by the household appliance, and the ranges are not necessarily regular shapes. Point Q (Xq, Yq) is the location point of the target object, and the target object can be an object used by a user or a sweeping robot to perform corresponding control through the electronic fence. The coordinates of the point Q (Xq, Yq) can be obtained based on the Wi-Fi hotspot that is connected to the household appliance, and are not specifically limited here.
[0135] Optionally, the equation of the AB line is: AB x+b AB -y=0;
[0136] The equation of the BC line is: BC x+b BC -y=0;
[0137] The equation of the CD line is: CD x+b CD -y=0;
[0138] The equation of the AD line is: AD x+b AD -y=0.
[0139] Step S50, determining the target value of each side of the electronic fence according to the coordinates of the target object and each of the straight line equations;
[0140] The target value is the target value R of each side of the electronic fence calculated by substituting point Q into each straight line equation AB , R BC , R CD , R AD ,in,
[0141] k AB X m +b AB -Y m =R AB ;
[0142] k BC X m +b BC -Y m =R BC ;
[0143] k CD X m +b CD -Y m =R CD ;
[0144] k AD X m +b AD -Y m =R AD .
[0145] Step S60: Determine the relative position of the target object and the electronic fence according to the target value of each edge.
[0146] Optionally, Figure 5 , Figure 5 This is a fourth embodiment of the method for generating an electronic fence of the present invention, based on the first, second or third embodiment, step S60 includes:
[0147] Step S61, comparing the target value of each edge with the preset condition of the edge, wherein the preset condition corresponding to each edge is obtained by the straight line equation of the edge and the coordinate information of the remaining edges in the electronic fence.
[0148] Specifically, taking the straight line AB as an example, take the coordinates of point C (or point D) and substitute them into the equation of the straight line AB to obtain k AB Xc+b AB -Yc>0. This means that when the point in the electronic fence ABCD is substituted into the equation of the line AB, the result is greater than 0. Therefore, it can be known that when the target object is inside the electronic fence, the result obtained by substituting the coordinate point Q (Xq, Yq) corresponding to the target object into the equation of the line AB is also greater than 0. When point Q is inside the electronic fence ABCD, the target value R calculated by substituting the coordinates of point Q into each line equation is AB,R BC ,R CD ,R AD The pre-conditions to be met are:
[0149] k AB X m +b AB -Y m =R AB And R AB >0;
[0150] k BC X m +b BC -Y m =R BC And R BC >0;
[0151] k CD X m +b CD -Y m =R CD And R BC <0;
[0152] k AD X m +b AD -Y m =R AD And R AD >0.
[0153] Step S62: when the target value of each edge satisfies the preset condition of the edge, determining that the target object is located within the electronic fence;
[0154] When the target value obtained after the target object is inserted into each of the linear equations satisfies a preset condition, it is determined that the target object is inside the electronic fence.
[0155] Optionally,
[0156] When the relative position is that the target object is located within the electronic fence, comparing the target value with a preset threshold;
[0157] When the target value is less than the preset threshold, an early warning prompt message is output.
[0158] The closer the target value is to zero, the closer the target object is to the boundary of the electronic fence ABCD. Therefore, a preset threshold value can be set. When the target value is less than the preset threshold value, it means that the target object is too close to at least one side of the electronic fence, and thus a warning prompt message is output. For example, the preset threshold value is set to 10 centimeters. When at least one of the target values obtained by substituting the coordinates of the target object into the linear equations corresponding to the sides of the electronic fence is less than 10 centimeters, it means that the target object is less than 10 centimeters away from at least one side of the electronic fence, and a warning prompt message can be output at this time.
[0159] The prompt information can be output and displayed by a generating device of the electronic fence, such as a mobile terminal, or can be sent by the generating device of the electronic fence to the target object for display.
[0160] Step S63: When at least one of the target values of each edge does not satisfy the preset condition of the edge, it is determined that the target object is outside the electronic fence.
[0161] When any of the target values obtained after the target object is put into each of the linear equations does not satisfy the above preset conditions, it means that the coordinate point Q corresponding to the target object is not inside the electronic fence, and an alarm prompt can be output at this time.
[0162] The prompt information can be output and displayed by a generating device of the electronic fence, such as a mobile terminal, or can be sent by the generating device of the electronic fence to the target object for display.
[0163] In the technical solution provided in this embodiment, the generation device of the electronic fence obtains the coordinates of the target object and the linear equations of each side of the electronic fence. The linear equation corresponding to each side is obtained according to the coordinate information of the coordinate points on the side; the target value of each side of the electronic fence is determined according to the coordinates of the target object and each linear equation; the relative position of the target object and the electronic fence is determined according to the target value of each side. When the target values all meet the preset conditions of the sides, it is determined that the target object is located within the electronic fence. In this way, the result of bringing the position coordinates of the target object into the preset formula and comparing it with the preset conditions can determine whether the target object is within the electronic fence, thereby improving the convenience of determining whether the target object is inside the electronic fence. And when the target value is less than the preset threshold, an early warning prompt information is output. In this way, when the target object is about to reach the boundary of the electronic fence, the early warning information is output, which is convenient for the user to know the running trajectory of the target object in time, and improves the early warning effect of the electronic fence generation device.
[0164] An embodiment of the present invention also provides an electronic fence generation device, which includes a memory, a processor, and an electronic fence generation program stored in the memory and executable on the processor, and the processor implements the method described above when executing the electronic fence generation program.
[0165] An embodiment of the present invention further provides a computer-readable storage medium on which a program for generating an electronic fence is stored. When the program for generating an electronic fence is executed by a processor, the method described above is implemented.
[0166] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0167] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0168] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0169] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1The steps for the functions specified in one or more boxes.
[0170] It should be noted that in the claims, any reference signs placed between brackets shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claim. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention may be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.
[0171] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0172] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for generating an electronic fence, characterized in that: The method for generating an electronic fence includes: Obtaining the location coordinates of each home appliance, wherein each home appliance is set against a wall or is a device forming a fence; Obtaining the mean of the position coordinates, and determining the center of gravity position point according to the coordinate point corresponding to the mean; A vector between a coordinate point corresponding to the position coordinates of each household appliance and a center of gravity position point; Determining relative directions of adjacent vectors based on the cross products of the vectors; Determining the relative positions of the respective household appliances according to the relative directions of the adjacent vectors; Determine the connection starting point of the electronic fence according to the relative positions of the various household appliances, and obtain the type of each of the household appliances in turn; Starting from the connection starting point, sequentially acquiring coordinate points to be connected according to the relative positions; When each of the coordinate points to be connected is obtained, the type of the home appliance corresponding to each of the coordinate points to be connected is obtained; When the type of the household device corresponding to the coordinate point to be connected is a linear type, obtaining the type of the household device corresponding to the currently connected coordinate point; When the type of the household equipment corresponding to the connected coordinate point adjacent to the coordinate point to be connected is a linear type, the intersection point formed by the straight line formed by the household equipment corresponding to the currently connected coordinate point and the straight line formed by the household equipment corresponding to the coordinate point to be connected is taken as the boundary intersection point of the electronic fence; When the type of household equipment corresponding to the connected coordinate points adjacent to the coordinate point to be connected is point type, the coordinate points to be connected are connected to form the boundary of the electronic fence, wherein the coordinate points corresponding to each household equipment are on the boundary line of the electronic fence.
2. The method for generating an electronic fence according to claim 1, characterized in that: After the step of obtaining the type of the household equipment corresponding to each of the coordinate points to be connected, the method further includes: When the type of the household device corresponding to the coordinate point to be connected is a point type, obtaining the type of the household device corresponding to the connected coordinate point adjacent to the coordinate point to be connected; When the type of the household device corresponding to the connected coordinate point adjacent to the coordinate point to be connected is point type, connecting the coordinate point to be connected and the adjacent connected coordinate point; When the type of the household equipment corresponding to the connected coordinate point adjacent to the coordinate point to be connected is a line type, obtaining the type of the household equipment corresponding to the unconnected coordinate point adjacent to the coordinate point to be connected; When the type of home equipment corresponding to the unconnected coordinate point is a point type, the coordinate point to be connected and the adjacent unconnected coordinate point are connected to form a straight line, and the intersection of the straight line corresponding to the connected coordinate point adjacent to the coordinate point to be connected and the straight line where the coordinate point to be connected is located is the boundary intersection of the electronic fence.
3. The method for generating an electronic fence according to claim 1, characterized in that: When the type of household equipment corresponding to the connected coordinate points adjacent to the coordinate point to be connected is point type, after the step of connecting the coordinate points to be connected to form the boundary of the electronic fence, the method further includes: Obtaining the coordinates of the target object and the straight line equations of each side of the electronic fence, wherein the straight line equation corresponding to each side is obtained based on the coordinate information of the coordinate points on each side of the electronic fence; Determine the target value of each side of the electronic fence according to the coordinates of the target object and each of the straight line equations; The relative position of the target object and the electronic fence is determined according to the target value of each edge.
4. The method for generating an electronic fence according to claim 3, characterized in that: After the step of determining the relative position of the target object and the electronic fence according to the target value of each edge, the method further includes: When the relative position is that the target object is located within the electronic fence, comparing the target value with a preset threshold; When the target value is less than the preset threshold, an early warning prompt message is output.
5. The method for generating an electronic fence according to claim 4, characterized in that: The step of determining the relative position of the target object and the electronic fence according to the target value of each edge includes: Comparing the target value of each edge with the preset condition of the edge; When the target value of each edge satisfies the preset condition of the edge, determining that the target object is located within the electronic fence; When at least one of the target values of each edge does not satisfy the preset condition of the edge, determining that the target object is outside the electronic fence; The preset condition corresponding to each edge is obtained by the straight line equation of the edge and the coordinate information of the remaining edges in the electronic fence.
6. A device for generating an electronic fence, characterized in that: The electronic fence generation device includes a memory, a processor, and an electronic fence generation program stored in the memory and executable on the processor. When the processor executes the electronic fence generation program, the method described in any one of claims 1 to 5 is implemented.
7. A computer-readable storage medium, characterized in that: A program for generating an electronic fence is stored thereon, and when the program for generating the electronic fence is executed by a processor, the method described in any one of claims 1 to 5 is implemented.
