A general design method for robot motion control scheme
By processing multi-process instructions through custom message files and priority scheduler, and combining inertial navigation information for precise rotation, the problems of inflexible speed preset and low rotation accuracy in robot motion control are solved, and flexible and precise control of robot motion is achieved.
Patent Information
- Application Number
- CN202210600501.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-30
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2042-05-30
AI Technical Summary
In existing robot motion control methods, speed values are generally preset in advance and cannot be changed at any time according to the situation, resulting in insufficient application flexibility. In addition, problems such as loss of motion control and low rotation accuracy are prone to occur under multi-process control.
A general robot motion control scheme is designed. By customizing control message files, registering ROS nodes and subscribers, using a priority scheduler and independent threads to handle multi-process instructions, combining inertial navigation information for precise rotation, and using custom message types to improve control flexibility and accuracy.
It realizes flexible control of robot motion, avoids dead loops and loss of control, improves rotation accuracy and multi-process instruction processing capabilities, and enhances the user's control flexibility over robot motion.
Smart Images

Figure CN115008453B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of robots, and in particular relates to a design method for a universal robot motion control solution. Background Art
[0002] Robot motion control is an important branch of current robotics. It is combined with artificial intelligence algorithms such as vision and speech to enable robots to complete complex tasks from information cognition to behavioral feedback.
[0003] For ground robots, basic behaviors can be divided into forward, backward, left turn, right turn, and stop. Complex motion control can be composed of simple control combinations. Currently, motion control is mainly based on the ROS (Robot Operating System) framework. ROS is the current mainstream robot development framework. It can compile processes into nodes within the framework. Nodes can communicate with each other through topics, services, and other methods. It has the characteristics of high reusability, high degree of decoupling, and high platform adaptability. The principle of motion control node is to continuously publish velocity messages in the node. The message format includes linear velocity and angular velocity.
[0004] In ROS, if you need a robot to move continuously, you need to continuously send velocity messages. If you keep sending these messages in a loop on the control side, the node will get stuck in an infinite loop and be unable to change its motion. If you keep sending these messages in a loop on the trigger side, when the application scenario is a single signal triggering an action (such as gesture recognition control), it will be impossible to accurately control the rotation angle.
[0005] When there is more than one upper-level application controlling the robot, the priority of command information is not handled. When commands are triggered simultaneously, the motion performance may become unexpectedly chaotic.
[0006] Robot rotation typically requires a preset angle and won't rotate indefinitely. Currently, the rotation angle is divided by the angular velocity to determine the rotation time, which is then multiplied by the velocity release frequency to determine the number of rotations. The total number of releases is then used as the threshold for rotation. This method suffers from low accuracy due to rounding issues, vehicle drift, and cumulative rotation errors.
[0007] Finally, the current speed value of robot movement is generally preset in advance and cannot be changed at any time according to the situation, which is not flexible enough for practical applications. Summary of the Invention
[0008] (1) Technical issues to be resolved
[0009] The technical problem to be solved by the present invention is how to provide a universal design method for robot motion control solutions to solve the problem that the speed values of current robot motion are generally preset in advance and cannot be changed at any time according to the situation, which is not flexible enough for practical applications.
[0010] (2) Technical solution
[0011] In order to solve the above technical problems, the present invention proposes a general design method for a robot motion control solution, which includes:
[0012] S11. Customized control message file, which includes message source, instruction type, and speed value; the message source is used to indicate the process source of the message and is used to determine whether to read the speed value; the instruction type is used to indicate the robot's behavior instructions, including forward, backward, left turn, right turn, and stop; the speed value is used to indicate the speed value of the robot's current action;
[0013] S12. Register ROS nodes, subscribers, and publishers. The publisher is used to publish control messages to topics for subscription by processes that need the messages. The subscriber subscribes to messages from topics and processes the messages through callback functions. The callback functions are declared when the subscribers are initialized.
[0014] S13. The control message will first be screened by the priority scheduler, and the final message will be sent to the topic for the control process to subscribe according to the priority set by the user. When the subscriber subscribes to the control message in the topic, the callback function will determine the source of the message, read different message contents according to different functional protocols, and perform corresponding actions according to the instructions in the message.
[0015] When the instruction is to go straight, set the global flag to 1, build a separate thread, and cyclically publish speed messages to the action module according to the preset speed or message speed. The thread execution method is detach(), that is, detach the thread;
[0016] When the instruction is rotation, set flag = 2, the straight thread jumps out of the self-loop due to the change of flag value, the straight thread ends, and the rotation action is executed;
[0017] When the instruction is to stop, set flag = 0, the callback function will initialize all speed values to zero, and then send a speed instruction once to clear the controller speed information and make the robot stop.
[0018] Furthermore, in step S11, the message source includes voice recognition and gesture recognition.
[0019] Furthermore, when the message source is voice recognition, the user may orally say to move at a certain speed, and the speed value needs to be read. If it is an empty value, the default value in the control program is used; when the message source is gesture recognition, since the gesture does not contain speed information, there is no need to read the speed value.
[0020] Furthermore, in step S12, the node handle, subscriber, and publisher are instantiated in the private member. The node handle is the flag used by the ROS node to call the function. Then, the subscriber and publisher are initialized in the public member, and the message type, message topic, message transmission frequency, and subscription callback function for subscription and publication are defined. Finally, the action function and callback function are declared as public functions, where the action function is directly implemented in the class.
[0021] Furthermore, in step S13, if the voice recognition function can recognize the action instruction and the speed message, the message content will include the speed value content, and the subscriber callback will read the speed value and the instruction category; if the process cannot recognize the speed value message, different action publishing methods will be called according to the instruction.
[0022] Furthermore, when the instruction is rotation, the preset rotation angle is 90 degrees. First, subscribe to the inertial navigation module topic to obtain the angle information, and then convert the quaternion information of the module into Euler angles. The direction of the target posture is calculated according to the initial position and rotation angle, so as to achieve precise steering.
[0023] Furthermore, the callback function will initialize all velocity values to zero, including initializing the linear velocity and angular velocity to zero.
[0024] Furthermore, the priority scheduling method in step S13 includes:
[0025] Suppose there are two processes a and b that will issue motion instructions at the same time;
[0026] Publish the message instructions of processes a and b to two different topics, topic1 and topic2;
[0027] Create a priority scheduler, subscribe to topic1 and topic2, and set the static priority values of the two topics; assume that the priority of topic2 is higher than that of topic1;
[0028] According to the priority value, when there is data in both topics, topic1 will be abandoned and the priority scheduler will only publish the messages in topic2 to the new topic topic3. The control node will always subscribe to messages from topic3.
[0029] Furthermore, the smaller the priority value is, the higher the priority is.
[0030] Furthermore, the instruction messages issued by multiple processes are set with different priority numbers in the priority scheduler to achieve multiple-choice-one.
[0031] (3) Beneficial effects
[0032] The present invention proposes a universal design method for a robot motion control solution. The present invention separates the straight-line speed publishing thread, so that when the robot continuously executes a single action command, it will not be unable to execute other action commands due to the speed publisher falling into an infinite loop. For turning commands, the inertial navigation angle information is used to perform geometric conversion to obtain the target angle. The real-time inertial navigation angle is simultaneously monitored while the robot rotates in the command direction, greatly improving the rotation accuracy.
[0033] The present invention designs a topic priority scheduler, which screens multiple instruction issuing processes according to predetermined priorities, so that the robot has controllable logic when processing multiple processes and issuing control instructions at the same time, and will not fall into a state of uncontrolled movement.
[0034] Furthermore, this invention avoids using standard message types and instead customizes a message type with more elements, allowing users to more flexibly control the robot's motion. Furthermore, the elements in the customized message type described above are merely examples; additional elements can be added based on actual applications. Following the examples, the control end can simply identify and read the elements based on the subscribed command source.
[0035] Compared with the existing technology, the method proposed in this invention establishes a topic priority scheduler, enabling the robot to have the ability to process multi-process control instructions simultaneously; proposes a calculation method for speed release independent threads and angle rotation, making the robot movement more intelligent and precise; and designs a custom message type to improve the user's flexibility in controlling the robot. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 This is a structural diagram of the robot motion control message transmission process of the present invention;
[0037] Figure 2 This is a logic flow chart of the control end of the present invention. DETAILED DESCRIPTION
[0038] In order to make the purpose, content and advantages of the present invention more clear, the specific implementation methods of the present invention are further described in detail below with reference to the accompanying drawings and examples.
[0039] The present invention first aims to provide a universal robot control interface that receives behavioral instructions and speed values and distributes the speed to the motion module according to the instructions. When a straight-line signal is received, the robot can continue moving until a stop signal is received; when a rotation signal is received, the robot can rotate to a preset angle and then stop to await the next instruction. Furthermore, the present invention provides a priority scheduler that prioritizes multiple instruction processes (such as voice recognition control and gesture recognition control) to avoid chaotic behavior caused by simultaneous triggering.
[0040] The technical solution of the present invention is mainly divided into two parts. The first part solves the self-circulation and angle fixation problems of speed release, and the second part realizes multi-signal priority scheduling.
[0041] First, the specific steps of the first part are:
[0042] S11, custom control message file. Message is the format of information transmission in ROS. In addition to standard messages, ROS also provides a method for customizing messages. In the present invention, the message file written includes the message source, instruction category and speed value, among which,
[0043] Message Source: Indicates the process source of the message, such as speech recognition or gesture recognition. This is used to determine whether to read the speed value. For example, when the message source is speech recognition, the user may verbally specify a speed. In this case, the transmitted message may contain a user-defined speed value, so it is necessary to read the speed value. If the value is empty, the default value within the control program is used. When the message source is gesture recognition, since gestures generally do not contain speed information, reading the speed value is not necessary.
[0044] Instruction category: Instructions for robot behavior, including forward, backward, turn left, turn right, and stop.
[0045] Speed value: Indicates the speed value of the robot's current action. When the instruction of the upper-level application contains this content, the value can be read and the release speed can be modified.
[0046] S12. Register ROS nodes, subscribers, and publishers. The publisher is used to publish control messages to topics for subscription by processes that need the messages; the subscriber subscribes to messages from topics and then processes the messages through callback functions. The callback functions are declared when the subscriber is initialized. Since the subscriber's spin() function will cause the subscription-callback process to enter an infinite loop, in order to be able to publish speed messages normally, a class implementation method is used here. First, instantiate the node handle, subscriber, and publisher in private members. The node handle is the flag used by the ROS node to call functions; then, initialize the subscriber and publisher in public members, define the message type, message topic, message transmission frequency, and subscription callback function for subscription and publication; finally, declare the action function and callback function as public functions, where the action function is implemented directly in the class. Compared with inter-thread communication, the implementation method is simpler and the structure is more stable.
[0047] S13. Since there is a possibility that different processes may control the robot at the same time, such as voice control, gesture control, etc., the control message will first be filtered by the priority scheduler, and the final message will be sent to the topic for the control process to subscribe according to the priority pre-set by the user, so as to avoid the risk of robot movement out of control due to conflicting messages. When the subscriber subscribes to the message in the topic, the callback function will judge the source of the message and read different message contents according to different functional protocols. For example: the voice recognition function can recognize action instructions and speed messages (such as: moving at a speed of one meter per second), then the message content will contain speed value content, then the subscriber callback will read the speed value and instruction category. If the process cannot recognize the speed value message, different action publishing methods are called according to the instructions.
[0048] When the instruction is to go straight, set the global flag to 1. This global flag is used to exit the thread. A separate thread is constructed to cyclically publish speed messages to the action module at a preset speed or message speed. The thread is executed using the detach() method, which detaches the thread. This ensures that the straight movement continues and frees up subscriber resources for the next subscription callback.
[0049] When the instruction is to rotate, flag = 2 is set. The straight thread jumps out of the self-loop due to the change in flag value, the straight thread ends, and the rotation action is executed. The present invention presets the rotation angle to 90 degrees. First, it subscribes to the inertial navigation module topic to obtain angle information. Then, the module's quaternion information is converted into Euler angles. The direction of the target pose is calculated based on the initial position and rotation angle, thereby achieving the purpose of precise steering.
[0050] When the instruction is to stop, set flag = 0, the callback function will initialize all speed values (including linear speed and angular speed) to zero, and then send a speed instruction once to clear the controller speed information and make the robot stop.
[0051] The second part is the priority scheduling method of signals. In this part, we assume that there are two processes a and b that will issue motion instructions at the same time. How to avoid message confusion.
[0052] Publish the message instructions of processes a and b to two different topics, topic 1 and topic 2.
[0053] Create a priority scheduler, subscribe to topic 1 and topic 2, and set static priority values for the two topics. The smaller the value, the higher the priority. For example, set topic 1 to 100 and topic 2 to 50.
[0054] According to the priority setting, when there is data in both topics, topic 1 will be abandoned and the priority scheduler will only publish the messages in topic 2 to the new topic topic 3. The control node will always subscribe to messages from topic 3.
[0055] The same can be done for command messages issued by multiple processes. Different priority numbers can be set in the priority scheduler to achieve the purpose of selecting one from multiple processes.
[0056] The present invention separates the straight-line speed publishing thread, so that when the robot continuously executes a single action command, it will not be unable to execute other action commands due to the speed publisher falling into an infinite loop. For turning commands, the inertial navigation angle information is used for geometric conversion to obtain the target angle. The real-time inertial navigation angle is monitored while rotating in the command direction, greatly improving the rotation accuracy.
[0057] The present invention designs a topic priority scheduler, which screens multiple instruction issuing processes according to predetermined priorities, so that the robot has controllable logic when processing multiple processes and issuing control instructions at the same time, and will not fall into a state of uncontrolled movement.
[0058] Furthermore, this invention avoids using standard message types and instead customizes a message type with more elements, allowing users to more flexibly control the robot's motion. Furthermore, the elements in the customized message type described above are merely examples; additional elements can be added based on actual applications. Following the examples, the control end can simply identify and read the elements based on the subscribed command source.
[0059] Compared with the existing technology, the method proposed in this invention establishes a topic priority scheduler, enabling the robot to have the ability to process multi-process control instructions simultaneously; proposes a calculation method for speed release independent threads and angle rotation, making the robot movement more intelligent and precise; and designs a custom message type to improve the user's flexibility in controlling the robot.
[0060] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A general design method for a robot motion control solution, characterized in that: The method includes: S11. Customized control message file, which includes message source, instruction type, and speed value; the message source is used to indicate the process source of the message and is used to determine whether to read the speed value; the instruction type is used to indicate the robot's behavior instructions, including forward, backward, left turn, right turn, and stop; the speed value is used to indicate the speed value of the robot's current action; S12. Register ROS nodes, subscribers, and publishers. The publisher is used to publish control messages to topics for subscription by processes that need the messages. The subscriber subscribes to messages from topics and processes the messages through callback functions. The callback functions are declared when the subscribers are initialized. S13. The control message will first be screened by the priority scheduler, and the final message will be sent to the topic for the control process to subscribe according to the priority set by the user. When the subscriber subscribes to the control message in the topic, the callback function will determine the source of the message, read different message contents according to different functional protocols, and perform corresponding actions according to the instructions in the message. When the instruction is to go straight, set the global flag to 1, build a separate thread, and cyclically publish speed messages to the action module according to the preset speed or message speed. The thread execution method is detach(), that is, detach the thread; When the instruction is rotation, set flag = 2, the straight thread jumps out of the self-loop due to the change of flag value, the straight thread ends, and the rotation action is executed; When the command is to stop, set flag = 0, the callback function will initialize all speed values to zero, and then send a speed command once to clear the controller speed information and stop the robot; In step S12, the node handle, subscriber, and publisher are instantiated in the private member. The node handle is the flag used by the ROS node to call the function. Then, the subscriber and publisher are initialized in the public member, and the message type, message topic, message transmission frequency, and subscription callback function for subscription and publication are defined. Finally, the action function and callback function are declared as public functions, where the action function is directly implemented in the class.
2. The design method of a universal robot motion control solution as claimed in claim 1, characterized in that: In step S11, the message source includes voice recognition and gesture recognition.
3. The design method of a universal robot motion control solution as claimed in claim 2, characterized in that: When the message source is voice recognition, the user may verbally say to move at a certain speed, and the speed value needs to be read. If it is an empty value, the default value in the control program is used. When the message source is gesture recognition, since gestures do not contain speed information, there is no need to read the speed value.
4. The design method of a universal robot motion control solution as claimed in claim 1, characterized in that: In step S13, if the voice recognition function can recognize the action instruction and the speed message, the message content will include the speed value content, and the subscriber callback will read the speed value and the instruction category; if the process cannot recognize the speed value message, different action publishing methods will be called according to the instruction.
5. The design method of a universal robot motion control solution as claimed in claim 1, characterized in that: When the instruction is rotation, the preset rotation angle is 90 degrees. First, subscribe to the inertial navigation module topic to obtain the angle information, then convert the quaternion information of the module into Euler angles, and calculate the direction of the target posture based on the initial position and rotation angle, so as to achieve precise steering.
6. The design method of a universal robot motion control solution as claimed in claim 1, characterized in that: The callback function will initialize all velocity values to zero, including initializing linear velocity and angular velocity to zero.
7. The method for designing a universal robot motion control solution according to any one of claims 1 to 6, wherein: The priority scheduling method in step S13 includes: Suppose there are two processes a and b that will issue motion instructions at the same time; Publish the message instructions of processes a and b to two different topics, topic1 and topic2; Create a priority scheduler, subscribe to topic1 and topic2, and set the static priority values of the two topics; assume that the priority of topic2 is higher than that of topic1; According to the priority value, when there is data in both topics, topic1 will be abandoned and the priority scheduler will only publish the messages in topic2 to the new topic topic3. The control node will always subscribe to messages from topic3.
8. The method for designing a universal robot motion control solution according to claim 7, wherein: The smaller the priority value, the higher the priority.
9. The method for designing a universal robot motion control solution according to claim 7, wherein: The command messages issued by multiple processes are set with different priority numbers in the priority scheduler to achieve multiple-choice.
Citation Information
Patent Citations
Mobile blood donation assistant system, service system including electric blood donation vehicle, and method
CN105279723A