Disclosure of Invention
In order to solve the above technical problem or at least partially solve the above technical problem, the present application provides a control method of a robot, an electronic device, and a storage medium.
In a first aspect, the present application provides a control method for a robot, including:
when the motion parameters of the robot are not received within a preset time length, acquiring first motion parameters of the robot at the closest moment to the current moment;
acquiring a second motion parameter detected by the robot at the current moment;
verifying the first motion parameter according to the second motion parameter, and determining attitude change data of the robot;
and executing corresponding processing operation according to the attitude change data.
Optionally, the method further includes:
acquiring power supply information of a first power supply unit in the robot;
determining state information of the first power supply unit according to the power supply information;
and executing corresponding control operation according to the state information.
Optionally, the executing the corresponding control operation according to the state information includes:
determining the abnormal type of the first power supply unit when the first power supply unit is determined to be in the abnormal state according to the power supply information;
and when the abnormal type is a first type, sending a control instruction to a second power supply unit, wherein the control instruction is used for controlling the second power supply unit to replace the first power supply unit for supplying power.
Optionally, the method further includes:
when the abnormal type is a second type, acquiring a third motion parameter of the robot when the first power supply unit is abnormal;
acquiring a fourth motion parameter detected by the robot at the current moment;
checking the third motion parameter according to the fourth motion parameter, and determining attitude change data of the robot;
and executing corresponding processing operation according to the attitude change data.
In a second aspect, an embodiment of the present application provides a robot, including: a motion system and a location storage system;
the motion system is used for sending the motion parameters of the robot to the position storage system within a preset time length;
the position storage system is used for acquiring a first motion parameter of the robot at the moment closest to the current moment when the motion parameter of the robot is not received within a preset time length, acquiring a second motion parameter detected by the robot at the current moment, verifying the first motion parameter according to the second motion parameter, determining attitude change data of the robot, and executing corresponding processing operation according to the attitude change data.
Optionally, the robot further comprises: a first power supply unit;
the first power supply unit is used for supplying power to the motion system and the position storage system;
the position storage system is used for acquiring power supply information of the first power supply unit, determining state information of the power supply system according to the power supply information, and executing corresponding control operation according to the state information.
Optionally, the motion system includes: the device comprises a main controller, a first inertia measuring unit, a laser radar and a motor driver, wherein the first inertia measuring unit, the laser radar and the motor driver are connected with the main controller, and the motor driver is further connected with a motor and an encoder.
Optionally, the location storage system includes: the system comprises a microcontroller, a second inertia measurement unit, a read-only memory, a battery switching circuit and a second power supply unit, wherein the second inertia measurement unit, the read-only memory, the battery switching circuit and the second power supply unit are connected with the microcontroller;
the microcontroller is connected with a first power supply unit of the robot through a first switch in the battery switching circuit, the microcontroller is connected with a second power supply unit through a second switch in the battery switching circuit, and a comparator is further arranged between the microcontroller and the first power supply unit.
In a third aspect, the present application provides an electronic device, comprising: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the above method steps when executing the computer program.
In a fourth aspect, the present application provides a computer-readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the above-mentioned method steps.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages: according to the technical scheme, on one hand, the motion parameters of the robot in the process of scanning the current environment are recorded in real time, on the other hand, the robot is detected after an accident occurs, whether the posture of the robot changes or not is determined according to the motion parameters before and after the accident occurs, and the accuracy of the obtained environment map is ensured.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The method provided by the embodiment of the present invention may be applied to any required electronic device, for example, an electronic device such as a server and a terminal, and is not specifically limited herein, and for convenience of description, the method may be hereinafter simply referred to as an electronic device.
First, a robot according to an embodiment of the present invention will be described.
Fig. 1 is a schematic view of a robot according to an embodiment of the present disclosure, where the robot in this embodiment may be an intelligent robot such as a distribution robot, a cleaning robot, and the like. And is not particularly limited herein.
Fig. 2 is a functional block diagram of a robot according to an embodiment of the present disclosure, and as shown in fig. 2, the robot according to the embodiment includes: a motion system 1 and a position storage system 2; wherein, the position storage system 2 and the motion system 1 can adopt communication connection.
The motion system 1 is used for sending motion parameters of the robot to the position storage system within a preset time length;
the position storage system 2 is configured to, when the motion parameter sent by the motion system 1 is not received within a preset time length, obtain a first motion parameter of the robot at a time closest to a current time, obtain a second motion parameter detected by the robot at the current time, check the first motion parameter according to the second motion parameter, determine posture change data of the robot, and perform corresponding processing operation according to the posture change data, where the motion parameter in this embodiment includes: velocity, acceleration, and coordinate information.
In this embodiment, the robot further includes: a first power supply unit 3;
a first power supply unit 3 for supplying power to the motion system 1 and the position storage system 2;
and the position storage system 2 is used for acquiring power supply information of the first power supply unit 3, determining state information of the first power supply unit according to the power supply information, and executing corresponding control operation according to the state information.
As shown in fig. 2, the motion system in the present embodiment includes: the laser radar system comprises a main controller 100, a laser radar 101 connected with the main controller 100, a first inertia measurement unit 102 and a motor driver 103, wherein the motor driver 103 is also connected with an encoder 104 and a motor 105.
The encoder 104 is used for monitoring the rotation state of the motor 105 and feeding back to the main controller 100 through the motor driver 103; the first inertia measurement unit 102 acquires motion parameters of the robot and sends the motion parameters to the main controller 100, and the main controller 100 generates mileage information according to the rotation state and the motion parameters; wherein the first inertial measurement unit 102 comprises: gyroscopes, electronic compasses, and the like, the motion parameters including: angular velocity, azimuth, acceleration, etc.
The laser radar 101 scans the current environment to obtain point cloud information, and transmits the point cloud information to the controller, and the controller generates an environment image according to the point cloud information.
Specifically, the robot calculates the mileage information of the robot in combination with the motion parameters fed back by the encoder 104 and the first inertia measurement unit 102 during the motion process. The attitude information of the robot is combined with an observation model (surrounding obstacle point cloud data returned by laser radar scanning is subjected to map matching) to obtain the accurate positioning of the robot, finally, on the basis of the accurate positioning, the laser data is added into a grid map, and the whole environment map is finally constructed through the repeated movement of the robot in the environment.
Taking the example that a robot scans a certain place in the current environment to obtain a local map, firstly, acquiring an echo signal of a laser radar, obtaining point cloud data according to the echo signal, clustering the point cloud data to obtain a static object, wherein the static object, namely a static barrier, does not need to distinguish the type of the static object, and only needs to obtain the position and the shape of the static object; establishing an initial grid map; then, acquiring image data of a visual sensor, obtaining dynamic objects by using an image recognition algorithm, recognizing the position and size information of the dynamic objects such as pedestrians, motor vehicles, non-motor vehicles and the like in the image, and marking the type of each dynamic object; fusing data obtained by the laser radar and the vision sensor; projecting the dynamic object to the point cloud data of the laser radar, removing the point cloud of the dynamic object, re-clustering, and re-clustering to obtain an updated static object; marking the object type and the multi-bit attribute information of the dynamic target on the grid map, generating a multi-dimensional dynamic and static grid map, and taking the multi-dimensional dynamic and static grid map as a local map of the current place.
Then, a complete map of the current environment can be obtained by controlling the robot to move repeatedly in the current environment, for example: fig. 3 is a schematic diagram of an environment map according to an embodiment of the present application, as shown in fig. 3, the environment map has a multiple symmetrical structure.
In the process of implementing the present invention, the inventor also finds that, because the robot is located in an environment with multiple symmetric structures and is always in a motion state, the robot needs to be located in real time in order to obtain an accurate environment map, but the robot is located only by the lidar and is easy to have multiple positions matching with the robot in a currently scanned map, so that the environment map cannot be accurately obtained finally by the working equipment. For this purpose, the present application provides a method for accurately positioning a robot, the method comprising:
determining at least one candidate position of the robot in an environment map according to an echo signal of the laser radar, and acquiring the rotation state of a motor of the robot in the movement process and the current movement parameters of the robot; and generating mileage information according to the rotation state of the motor and the current motion parameters, and determining the target position of the robot from the candidate positions according to the mileage information.
In this embodiment, the robot positioning depends on the mileage information in addition to the map construction by means of the laser radar point cloud data, so that the robot can be accurately positioned.
As shown in fig. 2, the location storage system in the present embodiment includes: the system comprises a microcontroller 200, a second inertia measurement unit 201 connected with the microcontroller 200, a read-only memory 202, a battery switching circuit 203 and a second power supply unit 205;
the microcontroller 200 is connected to the first power supply unit 3 through a first switch 2031 in the battery switching circuit 203, and the microcontroller 200 is connected to the second power supply unit 205 through a second switch 2032 in the battery switching circuit 203, wherein a comparator 204 is further disposed between the microcontroller 200 and the first power supply unit 3, and the comparator 204 monitors power supply information of the first power supply unit 3.
In this embodiment, the position is periodically updated by using the robot motion system and the position storage system, after the robot is restarted or powered off unexpectedly, the position storage system obtains the current position of the robot and obtains the posture change of the robot, and after the robot resumes normal operation again, if the posture is not changed, the position before the robot is restarted or powered off is read from the position storage system. The problem that the robot fails to locate itself after being restarted or powered off accidentally in a building with a plurality of symmetrical patterns can be solved.
Fig. 4 is a block diagram of a microcontroller according to an embodiment of the present application, where the microcontroller may be implemented as part of or all of an electronic device through software, hardware, or a combination of the two. As shown in fig. 4, the microcontroller includes:
a first obtaining module 41, configured to, when the motion parameter of the robot is not received within a preset time period, obtain, from the read-only memory, a first motion parameter of the robot at a time closest to a current time;
the second obtaining module 42 is configured to obtain a second motion parameter obtained by detecting the robot by the first inertial measurement unit at the current time;
the determining module 43 is configured to verify the first motion parameter according to the second motion parameter, and determine posture change data of the robot;
and the execution module 44 is used for executing corresponding processing operation according to the posture change data.
Optionally, the execution sub-module is specifically configured to determine, when it is determined that the first power supply unit is in an abnormal state according to the power supply information, an abnormal type of the first power supply unit; and when the abnormal type is the first type, sending a control instruction to the second power supply unit, wherein the control instruction is used for controlling the second power supply unit to replace the first power supply unit for supplying power.
When the abnormal type is a second type, acquiring a third motion parameter of the robot when the first power supply unit is abnormal; acquiring a fourth motion parameter detected by the robot at the current moment; checking the third motion parameter according to the fourth motion parameter, and determining attitude change data of the robot; and executing corresponding processing operation according to the attitude change data.
When the microcontroller determines that the attitude change data meets the preset condition and the motion system is in the running state, the first motion parameter or the third motion parameter is sent to the motion system;
or when the microcontroller determines that the attitude change data is greater than or equal to the preset threshold value, the position loss information is sent to the motion system.
Fig. 5 is a flowchart of a control method of a robot according to an embodiment of the present disclosure. As shown in fig. 5, the method provided by the present embodiment is applied to a location storage system, and the method includes the following steps:
step S51, when the motion parameters of the robot are not received within the preset time length, acquiring the first motion parameters of the robot at the time closest to the current time;
in this step, in the process of scanning the current environment, the motion system of the robot sends the motion parameters of the robot to the position storage system at intervals of a preset time length, when the position storage system does not receive the motion parameters within a certain preset time length, the current moment is determined, and the read-only memory is used for inquiring the first motion parameters of the robot at the moment closest to the current moment, wherein the first motion parameters include: velocity, acceleration, and position coordinates.
Step S52, acquiring a second motion parameter detected by the robot at the current moment;
in this step, the position storage system calls an inertial measurement unit to detect the robot, and determines a second motion parameter of the robot at the current time, where the second motion parameter includes: speed, acceleration, and orientation.
Step S53, verifying the first motion parameter according to the second motion parameter, and determining the posture change data of the robot;
in this step, the first motion parameter and the second motion parameter may be compared to determine posture change data of the robot within a preset time period, for example: the first motion parameter and the second motion parameter have zero speed and acceleration compared with each other, but the position coordinates are the same, and it can be determined that the robot has not displaced within the preset time length. Or the first motion parameter and the second motion parameter have no change in comparison speed and acceleration and different position coordinates, so that the robot can be determined to be displaced within a preset time length.
As an example, when a motion system restarts or a communication failure occurs, the time when the motion system cannot receive the motion parameters sent by the motion system within a preset time length is 12:02:00am, the motion system sends the motion parameters to the position storage system every 1 minute, the closest time to the current time can be determined to be 12:01:00am, the read-only memory of the position storage system can be used for inquiring the motion parameters (first motion parameters) of the robot at 12:01:00am, the current time is determined to be 12:02:00am, and an inertial measurement unit in the position storage system is called to detect the robot, so that the motion parameters (second motion parameters) of the robot at 12:02:00am are obtained. And then comparing and comparing the first motion parameter and the second motion parameter to determine the posture change data of the robot within a preset time length.
And step S54, executing corresponding processing operation according to the posture change data.
In this step, when the robot determines that the posture change data is smaller than the preset threshold value and the motion system is in the running state, the first motion parameter is sent to the motion system, so that the motion system continues to move according to the first motion parameter.
Or when the microcontroller determines that the attitude change data is greater than or equal to the preset threshold, the position loss information is sent to the motion system, and the position loss information is reported to the monitoring terminal.
According to the technical scheme, on one hand, the motion parameters of the robot in the process of scanning the current environment are recorded in real time, on the other hand, the robot is detected after an accident occurs, whether the posture of the robot changes or not is determined according to the motion parameters before and after the accident occurs, and the accuracy of the obtained environment map is ensured.
In the above embodiment, the position storage system detects the robot by passive detection to determine the posture change data of the robot. The following embodiment is that the position storage system detects the robot by an active detection mode to determine the posture change data of the robot.
Fig. 6 is a flowchart of a control method of a robot according to another embodiment of the present application. As shown in fig. 6, the method comprises the steps of:
step S61, acquiring power supply information of a first power supply unit in the robot;
in this step, the first power supply unit is configured to supply power to the motion system and the position storage system of the robot, and specifically, the microcontroller in the position storage system calls the comparator to perform real-time monitoring on the first power supply unit to obtain power supply information of the first power supply unit, where the power supply information may be an output switching value.
Step S62, determining status information of the first power supply unit based on the power supply information;
in this step, a change condition of the power supply information in the current time period may be recorded, and the state information of the first power supply unit may be determined according to the change condition, such as: when the change condition is smaller than the preset change value, the state information of the first power supply unit can be determined to be in a normal state, and when the change condition is larger than or equal to the preset change value, the state information of the first power supply unit can be determined to be in an abnormal state.
And step S63, executing corresponding control operation according to the state information.
Optionally, the corresponding control operation is executed according to the state information, and includes:
when the position storage system determines that the first power supply unit is in an abnormal state according to the power supply information, the abnormal type of the first power supply unit is determined, and when the abnormal type is the first type (the first type in the embodiment is power failure), the microcontroller sends a control instruction to the second power supply unit, and the control instruction is used for controlling the second power supply unit to replace the first power supply unit to supply power to the microcontroller.
It should be noted that, when the abnormal type is the first type (power failure), it indicates that the first power supply unit is not enough to simultaneously supply power to the motion system and the location storage system, so that the second power supply unit needs to be started to supply power to the location storage system, and it is ensured that the two systems can normally operate.
In this embodiment, when the abnormality type is a second type (in this embodiment, the second type is power failure), a third motion parameter of the robot at a time closest to a time when the first power supply unit is abnormal is obtained, a fourth motion parameter detected by the robot at the current time is obtained, the third motion parameter is verified according to the fourth motion parameter, posture change data of the robot is determined, and a corresponding processing operation is performed according to the posture change data.
As an example, the moment when the first power supply unit is powered off is 12:01:20am, and the motion system sends the motion parameter to the position storage system every 1 minute, it may be determined that the moment closest to the first power supply unit is 12:01:00am, the read only memory of the position storage system may query the motion parameter (third motion parameter) of the robot at 12:01:00am, and at this time, it is determined that the current moment is 12:01:30am, and an inertial measurement unit in the position storage system is invoked to detect the robot, so as to obtain the motion parameter (fourth motion parameter) of the robot at 12:01:30 am. And then comparing and comparing the third motion parameter and the fourth motion parameter to determine attitude change data of the robot within a preset time length.
The corresponding processing operation is executed according to the posture change data, and the following steps can be executed: and when the posture change data of the robot is smaller than the preset threshold value, sending the third motion parameter to the motion system, and enabling the motion system to continue to move according to the third motion parameter.
Or when the microcontroller determines that the attitude change data is greater than or equal to the preset threshold value, the position loss information is sent to the motion system. And reporting to the monitoring terminal.
An embodiment of the present application further provides an electronic device, as shown in fig. 7, the electronic device may include: the system comprises a processor 1501, a communication interface 1502, a memory 1503 and a communication bus 1504, wherein the processor 1501, the communication interface 1502 and the memory 1503 complete communication with each other through the communication bus 1504.
A memory 1503 for storing a computer program;
the processor 1501 is configured to implement the steps of the above embodiments when executing the computer program stored in the memory 1503.
The communication bus mentioned in the electronic device may be a Peripheral component interconnect (pci) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
The present application also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the above-described embodiments.
A computer readable storage medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable storage medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
It should be noted that, for the above-mentioned apparatus, electronic device and computer-readable storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiments.
It is further noted that, herein, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present invention, which enable those skilled in the art to understand or practice the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.