CN-122008212-A - Robot mechanical arm control method and device and electronic equipment
Abstract
The application provides a control method, a device and electronic equipment of a robot mechanical arm, which comprise the steps of receiving MAVLink protocol data frames sent by an upper computer, determining target position data of the robot mechanical arm according to MAVLink protocol data frames, calculating position control quantity according to the current actual position and target position data of the robot mechanical arm, determining the movement direction and target driving current of the robot mechanical arm according to the position control quantity, converting the target driving current into duty ratio of pulse width modulation PWM signals, determining PWM signals according to the movement direction and the duty ratio of the PWM signals, and outputting the PWM signals to a hydraulic system of the robot mechanical arm so that the hydraulic system of the robot mechanical arm can control the current actual position of the robot mechanical arm to move according to the PWM signals.
Inventors
- ZHANG SIHAO
- CHEN CHEN
- ZHANG FENG
Assignees
- 杭州金自智能科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260204
Claims (15)
- 1. A robot arm control method, comprising: Receiving MAVLink protocol data frames sent by an upper computer, and determining target position data of a robot mechanical arm according to the MAVLink protocol data frames, wherein the target position data is a physical quantity representing an expected state of a mechanical arm joint; Calculating a position control amount according to the current actual position of the robot arm and the target position data; determining the movement direction of the robot arm and the target driving current according to the position control quantity; converting the target drive current into a duty cycle of a pulse width modulated PWM signal; determining a PWM signal according to the motion direction and the duty ratio of the PWM signal; and outputting the PWM signal to a hydraulic system of the robot mechanical arm so that the hydraulic system of the robot mechanical arm controls the current actual position of the robot mechanical arm to move according to the PWM signal.
- 2. The method of claim 1, wherein said determining target position data for a robotic arm from said MAVLink protocol data frames comprises: Analyzing the MAVLink protocol data frame to obtain a standardized control value of a joint driven by the hydraulic cylinder; and converting the standardized control value into target displacement data of the hydraulic cylinder corresponding to the joint based on a preset mapping relation, wherein the target position data comprises the target displacement data.
- 3. The method of claim 1, wherein said determining target position data for a robotic arm from said MAVLink protocol data frames comprises: Analyzing the MAVLink protocol data frame to obtain a standardized control value of a joint driven by a hydraulic motor; and converting the standardized control value into target angle data of a corresponding joint based on a preset mapping relation, wherein the target position data comprises the target angle data.
- 4. The method of claim 1, wherein the MAVLink protocol data frame includes safety control channel data, and wherein the determining the target position data of the robotic arm based on the MAVLink protocol data frame includes: Determining a safety state according to the safety control channel data; and if the safety state is the execution permission state, determining target position data of the robot arm according to the MAVLink protocol data frame.
- 5. The method of claim 1, wherein calculating a position control amount from the current actual position of the robotic arm and the target position data comprises: Detecting a 360-degree rotation boundary crossing condition between a current actual angle and a target angle; when the boundary crossing is detected, calculating a difference value between the forward crossing path and the reverse crossing path; comparing the absolute value of the forward crossing path difference value and the reverse crossing path difference value; selecting a crossing path corresponding to the difference value with smaller absolute value as an optimal path; and adjusting the position control quantity according to the optimal path.
- 6. The method of claim 5, wherein detecting a 360 degree rotation boundary crossing between a current actual angle and a target angle comprises: Calculating an original difference value between the current actual angle and the target angle; judging whether the original difference value exceeds a preset boundary threshold value or not; If so, determining that a 360-degree rotation boundary crossing condition exists.
- 7. The method according to claim 1, wherein the determining the movement direction of the robotic arm and the target drive current according to the position control amount includes: if the value of the position control quantity is a positive number, determining the movement direction of the robot mechanical arm as forward movement; If the value of the position control quantity is negative, determining the movement direction of the robot mechanical arm as negative movement; Correcting the position control quantity by adopting differentiated control coefficients aiming at different joints and movement directions of the robot mechanical arm to obtain the corrected position control quantity; and generating the target driving current according to the corrected position control quantity.
- 8. The method of claim 1, further comprising, after the outputting the PWM signal to the hydraulic system of the robotic arm: Continuously monitoring the current actual position of the robot mechanical arm, and judging whether the position error amount between the current actual position and the target position data is smaller than a preset threshold value or not; If yes, the PWM signal is regulated to a preset duty ratio maintaining value so as to prevent the mechanical arm from being displaced due to load change; determining an error flag state according to a position error amount between the current actual position and the target position data; Generating a state feedback message according to the error mark state; And sending the state feedback message to the upper computer.
- 9. The method of claim 1, wherein the robotic arm includes a plurality of joints, the MAVLink protocol data frame includes a plurality of channel data, each channel data corresponding to target position data for a joint, the robotic arm control method further comprising: determining, for each joint, the corresponding target position data individually; calculating a corresponding position control amount according to the target position data and the current actual position of each joint; and generating independent PWM signals for each joint, wherein the hydraulic system comprises a multi-way valve for receiving and distributing the PWM signals corresponding to each joint to corresponding executing mechanisms.
- 10. The method as recited in claim 1, further comprising: Receiving a control data frame sent by an upper computer; Selecting a target safety state from a plurality of safety states according to the control data frame and a preset time condition, wherein the plurality of safety states comprise a forbidden action state, a waiting position feedback confirmation state, an allowed action execution state and a overtime protection state; If the target safety state is the forbidden action state and the command flag bit in the control data frame is a first value, switching the current safety state of the robot mechanical arm to the waiting position feedback confirmation state, wherein the first value represents that the upper computer allows the robot mechanical arm to execute movement; If the target safety state is the waiting position feedback confirmation state and the command flag bits in the control data frame which are continuously received within a preset time threshold are all the first values, switching the current safety state of the robot mechanical arm to the allowed action execution state; if the target safety state is the allowed action execution state, the command zone bits received in the control data frame are all second values, and the command zone bits not received in the control data frame are all first values within a preset time threshold, the current safety state of the robot mechanical arm is switched to an forbidden action state, and the second values represent that the upper computer is forbidden to execute the movement of the robot mechanical arm; If the target safety state is the overtime protection state, switching the current safety state of the robot mechanical arm to the forbidden action state after the preset time length is exceeded; And if the emergency stop signal is detected, switching the current safety state of the robot mechanical arm into the forbidden operation state.
- 11. A robotic arm control system, comprising: The upper computer is used for sending MAVLink protocol data frames to the control unit; the sensor is used for acquiring the current actual position of the robot arm; The control unit is used for receiving MAVLink protocol data frames sent by the upper computer, determining target position data of the robot mechanical arm according to the MAVLink protocol data frames, wherein the target position data are physical quantities representing the expected states of the mechanical arm joints, calculating position control quantities according to the current actual positions of the robot mechanical arm and the target position data, determining the movement direction and target driving current of the robot mechanical arm according to the position control quantities, converting the target driving current into the duty ratio of a Pulse Width Modulation (PWM) signal, determining PWM signals according to the movement direction and the duty ratio of the PWM signals, and outputting the PWM signals to a hydraulic system of the robot mechanical arm; And the hydraulic system is used for controlling the current actual position of the robot arm to move according to the PWM signal.
- 12. A robotic arm control device, comprising: the data frame receiving module is used for receiving MAVLink protocol data frames sent by the upper computer, determining target position data of the robot mechanical arm according to the MAVLink protocol data frames, wherein the target position data are physical quantities representing the expected states of the mechanical arm joints; A control amount calculating module for calculating a position control amount according to the current actual position of the robot arm and the target position data; the direction electric quantity determining module is used for determining the movement direction of the robot mechanical arm and the target driving current according to the position control quantity; The duty ratio conversion module is used for converting the target driving current into the duty ratio of the Pulse Width Modulation (PWM) signal; the PWM determining module is used for determining a PWM signal according to the motion direction and the duty ratio of the PWM signal; And the PWM output module is used for outputting the PWM signal to the hydraulic system of the robot mechanical arm so that the hydraulic system of the robot mechanical arm can control the current actual position of the robot mechanical arm to move according to the PWM signal.
- 13. An electronic device comprising a processor and a memory storing machine-readable instructions executable by the processor, the machine-readable instructions when executed by the processor performing the method of any one of claims 1 to 10.
- 14. A computer readable storage medium, characterized in that it has stored thereon a computer program which, when executed by a processor, performs the method of any of claims 1 to 10.
- 15. A computer program product comprising a computer program or computer instructions which, when executed by a processor, performs the method of any of claims 1 to 10.
Description
Robot mechanical arm control method and device and electronic equipment Technical Field The application relates to the technical fields of intelligent robot control and mechanical arm control, in particular to a method and a device for controlling a mechanical arm of a robot and electronic equipment. Background In the fields of present engineering machinery, emergency rescue, field operation and the like, a hydraulically driven robotic arm is generally used for completing the operation, and because the robotic arm generally realizes joint movement through a hydraulic cylinder or a hydraulic motor, the effects of high power density, strong load capacity and good environmental adaptability can be achieved. In existing robotic arm control systems, the transmission of control instructions typically relies on custom or non-standardized communication protocols, such as proprietary data packet formats based on TCP/UDP or more complex middleware communication frameworks (e.g., some ROS early implementations). Although the methods can realize the basic control function, the problems of high communication overhead, complex protocol analysis, poor cross-platform compatibility and the like exist in practical application. Especially in the scene with higher real-time requirement, the control instruction transmission delay is larger because the redundancy of the data frame structure, the serialization and the deserialization consume longer time, and the lack of the unified data format standard also increases the difficulty of system integration and maintenance and reduces the reliability of communication. Disclosure of Invention The embodiment of the application aims to provide a method and a device for controlling a robot arm and electronic equipment, which are used for solving the problem of low communication reliability. The embodiment of the application provides a robot mechanical arm control method, which comprises the steps of receiving MAVLink protocol data frames sent by an upper computer, determining target position data of a robot mechanical arm according to MAVLink protocol data frames, calculating position control quantity according to the current actual position and target position data of the robot mechanical arm, determining the movement direction and target driving current of the robot mechanical arm according to the position control quantity, converting the target driving current into duty ratio of pulse width modulation PWM signals, determining PWM signals according to the movement direction and the duty ratio of the PWM signals, and outputting the PWM signals to a hydraulic system of the robot mechanical arm so that the hydraulic system of the robot mechanical arm can control the current actual position movement of the robot mechanical arm according to the PWM signals. In the implementation process of the scheme, by adopting MAVLink protocol data frames as communication carriers, the high-efficiency transmission and analysis of the control instructions of the robot mechanical arm are realized, and as the MAVLink protocol has the characteristics of light weight and standardization, the method can reduce communication delay and data analysis complexity, thereby improving the real-time performance and reliability of the control of the mechanical arm. Further, by converting the target driving current into the duty ratio of the Pulse Width Modulation (PWM) signal and generating the PWM signal according to the movement direction, the method realizes accurate control of the hydraulic system, and the output force of the hydraulic system can be controlled linearly by adjusting the duty ratio of the PWM signal, so that smooth adjustment of the movement of the mechanical arm is realized, impact and vibration caused by traditional switch control are avoided, and the reliability of the mechanical arm control is improved. Optionally, in the embodiment of the application, the target position data of the robot arm is determined according to MAVLink protocol data frames, and the method comprises the steps of analyzing MAVLink protocol data frames, obtaining a standardized control value of a joint driven by a hydraulic cylinder, and converting the standardized control value into target displacement data of the hydraulic cylinder corresponding to the joint based on a preset mapping relation, wherein the target position data comprises the target displacement data. In the implementation process of the scheme, the standardized control value is directly obtained by analyzing MAVLink protocol data frames, so that the complexity of multiple data conversion and intermediate processing in the traditional control system is avoided, and the direct data obtaining mode reduces the system delay, so that the mechanical arm can execute the target action more quickly, and the real-time performance and response speed of the mechanical arm control of the robot are remarkably improved. In addition, the standardized control value is convert