CN-121821419-B - Control method, device, equipment and medium for mechanical arm
Abstract
The application provides a control method, a device, equipment and a medium for a mechanical arm, which are used for the technical field of mechanical arm control and can solve the technical problem of low control efficiency and accuracy of the existing mechanical arm. The method comprises the steps of establishing a coordinate origin according to a shoulder joint of the mechanical arm, determining a current corresponding target control mode from a plurality of preset control modes, determining a corresponding target pose increment according to the coordinate origin, the target control mode and a control quantity corresponding to a handle, calculating a target pose corresponding to the mechanical arm according to an initial pose corresponding to the mechanical arm and the target pose increment, performing inverse kinematics calculation on the target pose to obtain a movement angle value corresponding to each mechanical joint, generating a corresponding target control instruction according to the movement angle value, and sending the target control instruction to the mechanical arm to enable the mechanical arm to execute the target control instruction to obtain the target pose, so that the control efficiency and the accuracy of the mechanical arm are improved.
Inventors
- SUN XIAOGANG
- HOU YUFAN
Assignees
- 成都阿加犀智能科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260316
Claims (8)
- 1. The control method of the mechanical arm is characterized in that the method is realized based on a control device of the mechanical arm, the control device of the mechanical arm only comprises an IMU sensor, and the IMU sensor is used for simultaneously mapping gesture data and position data so as to realize simultaneous control of the gesture and the position of the mechanical arm through the IMU sensor; the method comprises the following steps: establishing a coordinate origin according to the shoulder joint of the mechanical arm, and determining a current corresponding target control mode from a plurality of preset control modes; Determining corresponding target pose increment according to the coordinate origin, the target control mode and the control quantity corresponding to the handle, and calculating the target pose corresponding to the mechanical arm according to the initial pose corresponding to the mechanical arm and the target pose increment, wherein the handle pose increment comprises pose increment corresponding to each of a rocker, a key and a handle IMU; Performing inverse kinematics calculation on the target pose to obtain a movement angle value corresponding to each mechanical joint, and generating a corresponding target control instruction according to the movement angle value; Sending the target control instruction to the mechanical arm so that the mechanical arm executes the target control instruction to obtain the target pose; the determining the corresponding target pose increment according to the coordinate origin, the target control mode and the control quantity corresponding to the handle comprises the following steps: determining a corresponding target quaternion according to the real-time gesture of the handle IMU, converting the target quaternion into a target rotation matrix, and extracting vectors from the target rotation matrix to obtain a target irradiation vector; determining an abscissa axis according to the origin of coordinates and the target irradiation vector, and determining an ordinate axis corresponding to the abscissa axis according to a minimum rotation rule; Determining an ordinate axis corresponding to the abscissa axis and the ordinate axis according to a right-hand rule, and determining a target coordinate system according to the abscissa axis, the ordinate axis and the ordinate axis; determining the target pose increment according to the target coordinate system, the target control mode and the control quantity; The preset control mode comprises a translation control mode, a gesture control mode and a track control mode; The determining the target pose increment according to the target coordinate system, the target control mode and the control quantity comprises the following steps: If the target control mode is the translation control mode, determining corresponding control amounts of the rocker and the preset translation key under each coordinate axis according to the target coordinate system to obtain corresponding position increment; if the target control mode is the gesture control mode, determining an initial gesture of the handle and an initial quaternion corresponding to the initial gesture according to the target coordinate system, and determining a gesture increment according to the initial quaternion and the target quaternion; If the target control mode is the orbit control mode, determining an orbit sphere center according to the origin of coordinates, and determining an orbit radius increment according to the movement amounts corresponding to the orbit sphere center and the rocker; And determining the target pose increment corresponding to the target control mode according to the position increment, the pose increment or the track radius increment.
- 2. The method of claim 1, wherein prior to said determining the corresponding target pose increment from the origin of coordinates, the target control mode, and the corresponding control amount of the handle, the method further comprises: Determining an acceleration value and an angular velocity value of the handle in the control process and corresponding preset thresholds of the acceleration value and the angular velocity value; Respectively comparing the acceleration value with the angular velocity value and a corresponding preset threshold value to obtain a corresponding comparison result; If the comparison result is that the acceleration value and the angular velocity value are smaller than the corresponding preset threshold values, judging that the handle is in a static state, and locking current gesture input so as to eliminate terminal shake caused by sensor zero drift; And if the comparison result is that at least one of the acceleration value and the angular velocity value is not smaller than the corresponding preset threshold value, judging that the handle is in a motion state, and determining the target pose increment according to the coordinate origin, the target control mode and the control quantity.
- 3. The method of claim 1, wherein the determining the pose delta from the initial quaternion and the target quaternion comprises: And solving an inverse value of the initial quaternion to obtain an inverse value of the initial quaternion, and performing quaternion multiplication on the inverse value of the initial quaternion and the target quaternion to obtain an attitude increment.
- 4. The method of claim 1, wherein the calculating the target pose corresponding to the manipulator according to the initial pose corresponding to the manipulator and the target pose increment comprises: For the translation control mode, determining an initial coordinate point and an initial gesture corresponding to the initial gesture according to the target coordinate system, and calculating the sum of the initial coordinate point and the position increment to obtain a target coordinate point corresponding to the mechanical arm; determining the target pose corresponding to the translation control mode according to the initial pose and the target coordinate point; Aiming at the gesture control mode, according to the increment quaternion corresponding to the gesture increment, performing quaternion multiplication on the initial quaternion and the increment quaternion to obtain a target gesture; Determining the target pose corresponding to the pose control mode according to the initial coordinate point and the target pose; determining a target attitude according to a vector direction corresponding to the target irradiation vector for the orbit control mode; and determining the target pose corresponding to the track control mode according to the target position point and the target pose.
- 5. The method of claim 4, wherein the determining a target location point based on the target illumination vector and the track radius increment comprises: Calculating an initial orbit radius value according to the origin of coordinates and the initial coordinate point, and determining a target orbit radius value according to the sum of the initial orbit radius value and the orbit radius increment; Multiplying the target orbit radius value and the target irradiation vector to obtain a target orbit radius vector, and determining the target position point according to the sum value of the spherical center coordinate point and the target radius vector.
- 6. A control device for a robotic arm, wherein the device is configured to implement the method of claim 1; the device comprises: the establishing module is used for establishing a coordinate origin according to the shoulder joint of the mechanical arm and determining a current corresponding target control mode from a plurality of preset control modes; The computing module is used for determining corresponding target pose increment according to the coordinate origin, the target control mode and the control quantity corresponding to the handle, and computing the target pose corresponding to the mechanical arm according to the initial pose corresponding to the mechanical arm and the target pose increment, wherein the handle pose increment comprises pose increment corresponding to each of a rocker, a key and a handle IMU; The generation module is used for performing inverse kinematics calculation on the target pose to obtain a movement angle value corresponding to each mechanical joint, and generating a corresponding target control instruction according to the movement angle value; The sending module is used for sending the target control instruction to the mechanical arm so that the mechanical arm executes the target control instruction to obtain the target pose; the determining the corresponding target pose increment according to the coordinate origin, the target control mode and the control quantity corresponding to the handle comprises the following steps: determining a corresponding target quaternion according to the real-time gesture of the handle IMU, converting the target quaternion into a target rotation matrix, and extracting vectors from the target rotation matrix to obtain a target irradiation vector; determining an abscissa axis according to the origin of coordinates and the target irradiation vector, and determining an ordinate axis corresponding to the abscissa axis according to a minimum rotation rule; Determining an ordinate axis corresponding to the abscissa axis and the ordinate axis according to a right-hand rule, and determining a target coordinate system according to the abscissa axis, the ordinate axis and the ordinate axis; determining the target pose increment according to the target coordinate system, the target control mode and the control quantity; The preset control mode comprises a translation control mode, a gesture control mode and a track control mode; The determining the target pose increment according to the target coordinate system, the target control mode and the control quantity comprises the following steps: If the target control mode is the translation control mode, determining corresponding control amounts of the rocker and the preset translation key under each coordinate axis according to the target coordinate system to obtain corresponding position increment; if the target control mode is the gesture control mode, determining an initial gesture of the handle and an initial quaternion corresponding to the initial gesture according to the target coordinate system, and determining a gesture increment according to the initial quaternion and the target quaternion; If the target control mode is the orbit control mode, determining an orbit sphere center according to the origin of coordinates, and determining an orbit radius increment according to the movement amounts corresponding to the orbit sphere center and the rocker; And determining the target pose increment corresponding to the target control mode according to the position increment, the pose increment or the track radius increment.
- 7. A computer device, comprising: one or more processors; a memory; One or more programs, wherein the one or more programs are stored in memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method of any of claims 1-5.
- 8. A computer readable storage medium having stored therein program code which is callable by a processor to perform the method according to any one of claims 1 to 5.
Description
Control method, device, equipment and medium for mechanical arm Technical Field The present application relates to the field of mechanical arm control technologies, and in particular, to a method, an apparatus, a device, and a medium for controlling a mechanical arm. Background The mechanical arm is an automatic execution device for simulating the structure and the function of a human arm, and the core of the mechanical arm is composed of a plurality of movable joints, connecting rods and end effectors, and can finish actions such as grabbing, carrying, assembling, operating and the like in a three-dimensional space, thereby replacing or assisting manual work to finish repeated, fine, dangerous or difficult-to-touch operation. The existing mechanical arm control method mainly comprises handle control (comprising VR and game handle) and master-slave arm control, wherein the master-slave arm control generally comprises direct mapping and fixed position control, the former refers to that the handle position and the gesture are directly mapped to the tail end of the mechanical arm, the movement range of the handle is limited (about 1 meter), the handle position needs to be frequently stopped and reset, the operation is incoherent, the latter refers to that the gesture and the local fine adjustment of the tail end of the mechanical arm are only controlled at the fixed position of the handle, the large-range continuous movement cannot be realized, the movement mode is not in accordance with human kinematics, and continuous and smooth large-range spatial movement cannot be realized in both modes. Therefore, the existing mechanical arm control method has the problem of low control efficiency and accuracy. Disclosure of Invention The application provides a control method, a device, equipment and a medium for a mechanical arm, which are used for solving the problem that the control efficiency and the accuracy are low in the existing mechanical arm control method. In a first aspect, the present application provides a method for controlling a mechanical arm, including: establishing a coordinate origin according to the shoulder joint of the mechanical arm, and determining a current corresponding target control mode from a plurality of preset control modes; determining corresponding target pose increment according to the coordinate origin, the target control mode and the control quantity corresponding to the handle, and calculating the target pose corresponding to the mechanical arm according to the initial pose corresponding to the mechanical arm and the target pose increment, wherein the handle pose increment comprises pose increment corresponding to each of a rocker, a key and a handle IMU; Performing inverse kinematics calculation on the target pose to obtain a movement angle value corresponding to each mechanical joint, and generating a corresponding target control instruction according to the movement angle value; and sending a target control instruction to the mechanical arm so that the mechanical arm executes the target control instruction to obtain the target pose. In some embodiments of the present application, before determining the corresponding target pose increment according to the coordinate origin, the target control mode and the control amount corresponding to the handle, the method further comprises: Determining an acceleration value and an angular velocity value of the handle in the control process and corresponding preset thresholds of the acceleration value and the angular velocity value; respectively comparing the acceleration value and the angular velocity value with corresponding preset thresholds to obtain corresponding comparison results; if the comparison result is that the acceleration value and the angular velocity value are smaller than the corresponding preset threshold values, the marking control process is normal control, and the target pose increment is determined according to the coordinate origin, the target control mode and the control quantity; If the comparison result is that at least one of the acceleration value and the angular velocity value is not smaller than the corresponding preset threshold value, the marking control process is false touch control. In some embodiments of the present application, determining the corresponding target pose increment according to the origin of coordinates, the target control mode, and the control amount corresponding to the handle includes: determining a corresponding target quaternion according to the real-time gesture of the handle IMU, converting the target quaternion into a target rotation matrix, and extracting vectors from the target rotation matrix to obtain a target irradiation vector; Determining an abscissa axis according to the origin of coordinates and the target irradiation vector, and determining an ordinate axis corresponding to the abscissa axis according to the minimum rotation rule; Determining an ordinate axis corresponding to