Disclosure of Invention
The invention aims to solve the problems in the prior art, provides a five-degree-of-freedom robot-based space pose online simulation system, simplifies the solving method of forward kinematics on the premise of ensuring the solving accuracy of the forward kinematics and the reverse kinematics, enables the kinematics modeling to flexibly stipulate the axial definition of each joint axis, compares the representation methods of various differential movements, improves the efficiency of solving the reverse kinematics by using a Jacobian matrix, designs and realizes a five-degree-of-freedom robot motion control and space pose collaborative simulation system based on a kinematics calibration method, and realizes the integration of multifunctional modules.
In order to achieve the purpose, the invention adopts the technical scheme that:
a space pose online simulation system based on a five-degree-of-freedom robot comprises a control side and a simulation side, wherein the control side is connected with a multi-motor driving unit of the robot, and the simulation side is synchronously connected with the control side;
the control side includes:
the initialization module is used for carrying out initialization adjustment on the pose of the robot end effector;
the target pose setting module is used for setting the target pose of the robot end effector;
the data processing module is used for calling a reverse kinematics algorithm to calculate the target adjustment amount of each motor driving unit when the robot end effector is adjusted to the target pose, and calling a forward kinematics algorithm to calculate the pose of the robot end effector after adjustment;
the motor cooperative control module is used for controlling each motor driving unit to adjust the pose of the robot end effector according to the calculated target adjustment amount;
the initialization module, the target pose setting module and the motor cooperative control module are respectively connected with the data processing module;
triggering pose feedback when the relative error between the adjusted pose and the target pose exceeds a preset error magnitude, and calling a reverse kinematics algorithm again by the data processing module according to the current pose and the target pose of the adjusted robot end effector to calculate the target adjustment amount of each motor driving unit when the robot end effector is adjusted to the target pose until the relative error between the adjusted pose and the target pose does not exceed the preset error magnitude;
the simulation side is used for carrying out data synchronization on the business process of the control side, carrying out online simulation on the stage pose in the robot pose adjustment process, and finally carrying out error check and evaluation on the target pose of the robot end effector.
Specifically, the simulation method of the simulation system includes the following steps:
s1, performing initialization adjustment on the current pose of the robot end effector, and simultaneously performing online synchronous simulation on the current pose of the robot end effector on a simulation side;
s2, setting a target pose of the robot end effector;
s3, calling a reverse kinematics algorithm according to the current pose and the target pose of the robot end effector, and calculating the target adjustment amount of each motor driving unit of the robot;
s4, driving the robot end effector to adjust to a target pose according to the target adjustment amount, and simultaneously carrying out online simulation on the staged pose in the pose adjustment process of the robot end effector at the simulation side;
s5, calling a forward kinematics algorithm according to the current pose and the target adjustment quantity of the robot end effector, and determining the adjusted pose of the end effector; simultaneously, error checking and evaluation are carried out on the target pose of the robot end effector at the simulation side;
and S6, comparing whether the relative error between the pose adjusted by the end effector and the target pose exceeds a preset error magnitude, if so, executing pose feedback, returning to the step S3, substituting the adjusted current pose into the step S3 to obtain a new target adjustment amount, and adjusting the pose of the end effector of the robot according to the new target adjustment amount until the relative error between the pose adjusted by the end effector of the robot and the target pose does not exceed the preset error magnitude.
Specifically, the robot comprises a three-degree-of-freedom moving mechanism, a two-degree-of-freedom rotating mechanism and an end effector;
the three degrees of freedom of the moving mechanism are defined as movement along the X-axis, Y-axis and Z-axis, O, respectively1、O2And O3Joint nodes on the X-axis, Y-axis and Z-axis, Ox、OyAnd OzAre each O1、O2And O3A starting point of movement on the respective axis;
the two degrees of freedom of the rotating mechanism are defined as rotation about the X-axis and the Y-axis, O, respectively4And O5Joint nodes on the two rotating shafts respectively; c. C2、a4And b5Are each O1And O2,O3And O4,O4And O5Structural offset between adjacent joints; the end effector is arranged at a joint node O of the robot5And the end effector points to node P.
Further, a basic coordinate system XYZ and a terminal coordinate system X ' Y ' Z ' after five-degree-of-freedom transformation are defined in the structural model of the robot, the positive direction of each coordinate axis of the terminal coordinate system is defined as the direction of the positive direction of each coordinate axis of the basic coordinate system after five-degree-of-freedom movement and rotation transformation, and when the end effector is in the initial pose, the positive directions of each coordinate axis of the terminal coordinate system and the basic coordinate system are kept consistent; node O1、O2、O3、O4、O5The positions of P and P are expressed by adopting a basic coordinate system; defining the pointing direction of the end effector as the positive direction along the Z ' axis in the X ' Y ' Z ' of the end coordinate system, with the node P on the Z ' axis and the pointing direction of the end effector as the positive direction along the O axis5Point to point P direction.
Specifically, in step S3, the target position of the end effector is setIs arranged as
The formula of the inverse kinematics algorithm is as follows:
wherein, J (q)
-1A pseudo-inverse matrix that is a Jacobian matrix of the robot; the delta v and the delta omega are respectively differential movement and differential rotation of the end effector when the end effector moves from the current pose to the target pose; q. q.s
1、q
2And q is
3The displacement of the robot on the X axis, the Y axis and the Z axis of the moving joint axis, q
4And q is
5The rotation amounts of the robot on the X axis and the Y axis of the rotating joint axis are respectively;
and theta
0Respectively representing the corresponding angles of the X axis and the Y axis of the rotating shaft when the ZYZ type Euler angle represents the current pose of the end effector;
and theta
1Respectively representing the corresponding angles of the X axis and the Y axis of the rotating shaft when the ZYZ type Euler angle represents that the end effector is in the target pose;
targeting the end effector position
And substituting the formula to calculate a joint differential motion vector delta q, and multiplying the joint differential motion vector delta q by the scanning time interval of the motor to obtain the target adjustment quantity of the multi-motor driving unit of the robot.
Further, in step S5, the method for determining the adjusted pose of the end effector by invoking the forward kinematics algorithm includes:
after the robot is transformed by five degrees of freedom, the homogeneous transformation matrix between adjacent joint points
Comprises the following steps:
multiplying the matrixes in sequence to obtain an equivalent homogeneous transformation matrix of the end effector relative to a base coordinate system XYZ:
after the robot is subjected to five-degree-of-freedom movement and rotation transformation, the coordinates of the end effector are as follows:
O5=(q1+a4,q2-b5 cos q5,c2+q3-b5 sin q4)
according to O5Point coordinates and O5And the position and posture of the end effector relative to the basic coordinate system can be determined by the pointing direction from the point to the point P.
Compared with the prior art, the invention has the beneficial effects that: (1) the kinematics method based on robot control simplifies the derivation solving method of forward kinematics, so that the axial definition of each joint axis can be flexibly specified when the kinematics of the robot is modeled; (2) the inverse kinematics solving method based on the Jacobian matrix iteration method can improve the solving efficiency of the inverse kinematics, and can optimize the pointing deviation of a motor in the initial adjustment stage by applying verification to the cooperative adjustment algorithm on the motion control side of the five-degree-of-freedom robot, so that the target pointing accuracy and the empirical work efficiency of the system are improved.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the accompanying drawings, and it is obvious that the described embodiments are only some embodiments of the present invention, 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 invention.
As shown in fig. 1, the embodiment provides an online simulation system for a space pose based on a five-degree-of-freedom robot, which includes a control side and a simulation side, wherein the control side is connected with multiple motor driving units of the robot, and the simulation side is synchronously connected with the control side;
the control side includes:
the initialization module is used for carrying out initialization adjustment on the pose of the robot end effector;
the target pose setting module is used for setting the target pose of the robot end effector;
the data processing module is used for calling a reverse kinematics algorithm to calculate the target adjustment amount of each motor driving unit when the robot end effector is adjusted to the target pose, and calling a forward kinematics algorithm to calculate the pose of the robot end effector after adjustment;
the motor cooperative control module is used for controlling each motor driving unit to adjust the pose of the robot end effector according to the calculated target adjustment amount;
the initialization module, the target pose setting module and the motor cooperative control module are respectively connected with the data processing module;
triggering pose feedback when the relative error between the adjusted pose and the target pose exceeds a preset error magnitude, and calling a reverse kinematics algorithm again by the data processing module according to the current pose and the target pose of the adjusted robot end effector to calculate the target adjustment amount of each motor driving unit when the robot end effector is adjusted to the target pose until the relative error between the adjusted pose and the target pose does not exceed the preset error magnitude;
the simulation side is used for carrying out data synchronization on the business process of the control side, carrying out online simulation on the stage pose in the robot pose adjustment process, and finally carrying out error check and evaluation on the target pose of the robot end effector.
Specifically, the simulation method of the simulation system includes the following steps:
s1, performing initialization adjustment on the current pose of the robot end effector, and simultaneously performing online synchronous simulation on the current pose of the robot end effector on a simulation side;
s2, setting a target pose of the robot end effector;
s3, calling a reverse kinematics algorithm according to the current pose and the target pose of the robot end effector, and calculating the target adjustment amount of each motor driving unit of the robot;
s4, driving the robot end effector to adjust to a target pose according to the target adjustment amount, and simultaneously carrying out online simulation on the staged pose in the pose adjustment process of the robot end effector at the simulation side;
s5, calling a forward kinematics algorithm according to the current pose and the target adjustment quantity of the robot end effector, and determining the adjusted pose of the end effector; simultaneously, error checking and evaluation are carried out on the target pose of the robot end effector at the simulation side;
and S6, comparing whether the relative error between the pose adjusted by the end effector and the target pose exceeds a preset error magnitude, if so, executing pose feedback, returning to the step S3, substituting the adjusted current pose into the step S3 to obtain a new target adjustment amount, and adjusting the pose of the end effector of the robot according to the new target adjustment amount until the relative error between the pose adjusted by the end effector of the robot and the target pose does not exceed the preset error magnitude.
Further, initializing the robot end effector in step S1 includes the steps of:
s11, calling a driving interface of each motor driving unit, and establishing communication connection between 5 motors and the controller;
s12, reading the code value of the motor, and executing the return-to-original point operation on the hardware definition for the robot;
s13, calling a forward kinematics algorithm to calculate the current pose of the end effector;
and S14, calling an inverse kinematics algorithm to control the end effector to move to the initial working pose.
Specifically, the robot comprises a three-degree-of-freedom moving mechanism, a two-degree-of-freedom rotating mechanism and an end effector;
the three degrees of freedom of the moving mechanism are defined as movement along the X-axis, Y-axis and Z-axis, O, respectively1、O2And O3Joint nodes on the X-axis, Y-axis and Z-axis, Ox、OyAnd OzAre each O1、O2And O3A starting point of movement on the respective axis;
the two degrees of freedom of the rotating mechanism are defined as rotation about the X-axis and the Y-axis, O, respectively4And O5Respectively two rotating shaftsAn upper joint node; c. C2、a4And b5Are each O1And O2,O3And O4,O4And O5Structural offset between adjacent joints; the end effector is arranged at a joint node O of the robot5And the end effector points to node P, the starting angles of the two revolute joint axes are shown in fig. 2 (a).
Furthermore, for convenience of describing the direction of the end effector after five-degree-of-freedom movement and rotation transformation, a basic coordinate system XYZ and an end coordinate system X ' Y ' Z ' after five-degree-of-freedom transformation are defined in the structural model of the robot, the positive direction of each coordinate axis of the end coordinate system is defined as the direction of each coordinate axis of the basic coordinate system after five-degree-of-freedom movement and rotation transformation, and when the end effector is in an initial pose, the positive directions of the coordinate axes of the end coordinate system and the basic coordinate system are kept consistent; node O1、O2、O3、O4、O5The positions of P and P are expressed by adopting a basic coordinate system; defining the pointing direction of the end effector as the positive direction along the Z ' axis in the X ' Y ' Z ' of the end coordinate system, with the node P on the Z ' axis and the pointing direction of the end effector as the positive direction along the O axis5Point to point P direction. The structure adjustment of the five-degree-of-freedom robot is respectively driven by high-precision servo motors on respective motion axes, and the five-degree-of-freedom robot can move along positive and negative directions on the respective motion axes, and the positive direction of the motion is shown in figure 2 (a); the pose of the mechanical arm on the five degrees of freedom is adjusted through high-precision cooperative control of the 5 servo motors, so that the pose control and the precise alignment of the robot end effector are realized.
Specifically, in step S3, the inverse kinematics calculation is a process of solving the amount of relative motion between adjacent nodes by using the current pose and the target pose of the end effector.
The known speed can be regarded as differential motion in unit time, inverse kinematics is solved by utilizing a Jacobian matrix J (q), differential movement delta v and differential rotation delta omega of the end effector when the end effector moves from a current pose to a target pose are connected with a joint differential motion vector delta q, namely the Jacobian matrix is used as a conversion matrix of differential motion mapping of joint space to differential motion of the end effector space, and finally the joint differential motion vector delta q is multiplied by the scanning time interval of a motor to be used as the adjustment quantity of each joint.
When the target posture of the end effector is fixed, the direction vector of the target direction is constantly zero vector, the direction vector adjusted from the current direction to the target direction is the azimuth angle error between the target direction and the current direction, and the position of the target end effector is assumed to be
The differential shift per unit time is then:
given that angular velocities are described relative to the same coordinate system, they can be accumulated as free vectors, and thus by representing the differential rotation of each joint on the base coordinate system, the total amount of differential rotation of the end effector relative to the base coordinate system is determined by accumulation. In combination with the five-degree-of-freedom robot kinematics model of the present embodiment, in the case of using the rotation axis definition of the yz-type euler angle and not considering the Z-axis rotation of the last rotation axis, the total differential rotation amount of the end effector with respect to the base coordinate system is:
the transformation matrix B represents a transformation method when the attitude transformation of the end effector corresponds to the representation of a basic coordinate system, wherein the 1 st column and the 2 nd column respectively represent unit direction vectors of a Y axis and a Z axis corresponding to the rotation transformation;
Δθ=θ
1-θ
0in the formula
And theta
0Respectively showing the corresponding angles of the rotating shaft Z and the Y axis when the ZYZ type Euler angle is used for showing the pose of the current end effector,
and theta
1The respective angles corresponding to the rotation axis Z and the Y axis when the position and attitude of the target end effector are expressed by the Euler angles of the ZYZ type.
For a five-degree-of-freedom robot, the jacobian matrix is a 6 × 5 matrix, where the first 3 rows represent the transfer ratio of the linear velocity of the end effector and the last 3 rows represent the transfer ratio of the angular velocity of the end effector, i.e.:
for the movement axis i, Z is generated on the end effectoriThe same linear velocity v, but an angular velocity of 0; namely:
in the formula: ziIs a representation of the unit vector of the mobile joint axis i relative to the base coordinate system.
For a rotational joint axis i, the linear velocity v produced at the end effector is the vector product, i.e.:
in the formula: o is5-OiRepresenting the origin of coordinates of the end effector relative to the revolute joint node OiIs represented in the base coordinate system.
For the rotational joint axis i, Z is generated on the end effectoriThe same angular velocity ω, i.e.:
for the kinematic model of the five-degree-of-freedom robot described in this embodiment, eachThe joint axes are respectively: x1、Y2、Z3、X4、Y5. Wherein, the first three are mobile joint shafts, the second two are rotary joint shafts, and then the Jacobian matrix of the five-degree-of-freedom robot is:
in summary, the expression is obtained:
in the formula, the joint differential motion vector Δ q ═ q1 q2 q3 q4 q5]TThe derived inverse kinematics formula is:
wherein, J (q)
-1A pseudo-inverse matrix that is a Jacobian matrix of the robot; the delta v and the delta omega are respectively differential movement and differential rotation of the end effector when the end effector moves from the current pose to the target pose; q. q.s
1、q
2And q is
3The displacement of the robot on the X axis, the Y axis and the Z axis of the moving joint axis, q
4And q is
5The rotation amounts of the robot on the X axis and the Y axis of the rotating joint axis are respectively;
and theta
0Respectively representing the corresponding angles of the X axis and the Y axis of the rotating shaft when the ZYZ type Euler angle represents the current pose of the end effector;
and theta
1Respectively showing the corresponding angles of the X axis and the Y axis of the rotating shaft when the end effector is in the target pose by using the ZYZ type Euler angle.
Hold the end onTarget position of vehicle
And substituting the formula to calculate a joint differential motion vector delta q, and multiplying the joint differential motion vector delta q by the scanning time interval of the motor to obtain the target adjustment quantity of the multi-motor driving unit of the robot.
Further, in step S5, the method for determining the adjusted pose of the end effector by invoking the forward kinematics algorithm includes:
the forward kinematics algorithm is a process of solving the pose of the end effector by combining the relative motion amount between adjacent joint points on the premise of knowing the initial position of each joint point, the structural offset between the adjacent joint points and other parameters; adjusting q on the X, Y and Z axes of the mobile joint respectively
1,q
2And q is
3Respectively adjusting q on the X-axis and Y-axis of the rotary joint
4And q is
5The state model after the adjustment of the rotation amount and the five-degree-of-freedom transformation is shown in FIG. 2(b), and the homogeneous transformation matrix between the adjacent joint points
Comprises the following steps:
multiplying the matrixes in sequence to obtain an equivalent homogeneous transformation matrix of the end effector relative to a base coordinate system XYZ:
after the robot is subjected to five-degree-of-freedom movement and rotation transformation, the coordinates of the end effector are as follows:
O5=(q1+a4,q2-b5 cos q5,c2+q3-b5 sin q4)
according to O5Point coordinates and O5And the position and posture of the end effector relative to the basic coordinate system can be determined by the pointing direction from the point to the point P.
The five-degree-of-freedom robot only has Rot
x-Rot
yTwo rotational degrees of freedom, and in inverse kinematics solution, the rotation axis using Euler angles of the ZYZ type defines Rot
z-Rot
y-Rot
zThree rotational degrees of freedom, without taking into account the last Rot
zIn the case of autorotation, z at which the angular velocity vector of the first two rotational degrees of freedom lies
2y
2The plane is shown as the dashed area in fig. 3, and in the actual usage scenario of the robot, the x of the angular velocity vector of the two rotational degrees of freedom is
2y
2The plane is shown in the dashed area in fig. 4. Due to the inconsistency of the two spatial angular velocity planes, the solution of the inverse kinematics is actually to move the Euler angular spatial angular velocity vector to x in the actual usage scene
2y
2The plane is projected to obtain the achievable approximate spatial angular velocity, which generally cannot move in place in one step, but the ideal direction can be obtained after multiple approximation, so that the result is not influenced under the condition of time and velocity allowance. In order to calculate the accurate direction adjustment amount at one time, the invention defines the direction of the rotating shaft by user, and the invention will calculate the accurate direction adjustment amount at one time
As a directional definition, it is consistent with the actual rotation axis.
In forward kinematics solution, the pointing angle definition of the end effector needs to be changed: the azimuth angle of the target pointing in the horizon coordinate is as follows:
the X axis is positive along the counterclockwise direction; the zenith distance of the target pointing in the horizon coordinate is as follows:
θ=atan2(sin q5,cos q5)
the Y-axis is positive clockwise and is not calculated here with the acos () function because rotation through pi/2 produces a jump that is not easily handled.
In inverse kinematics solution, the method of calculating the differential rotation sum Δ ω of the end-effector relative to the base coordinate system is varied by rotation along the X-axis
Angle and rotation matrix of θ degrees along the Y axis:
the resulting equivalent rotation matrix is:
thus, the transformation matrix B in the formula is modified to:
in this embodiment, the simulation process of the spatial pose of the five-degree-of-freedom robot is as follows:
(1) the control program reads in the target pose of the end effector, calls a reverse velocity kinematics algorithm and calculates respective adjustment values of the motors on the five degrees of freedom.
(2) And transmitting control signals to the 5 servo motors through a standardized control interface.
(3) After the motor finishes moving, pose calibration is carried out, the program reads the code value on the wheel of the motor, a forward kinematics algorithm is called, and the pose of the end effector after adjustment is determined.
In the executing process, if the relative error between the adjusted pose and the target pose exceeds the preset error magnitude, pose feedback is triggered at the moment, and the operation is repeated until the pose of the end effector after adjustment meets the preset value.
The motion control and the collaborative simulation of the space pose are carried out on the five-degree-of-freedom robot, the end effector is adjusted to reach a preset initial working point through a motion control program, the parameters of the initial pose and the target pose of the end effector are shown in a table 1, a motion control and space pose collaborative simulation effect graph of the five-degree-of-freedom robot is shown in a figure 5, the positions of each joint node and each pointing node under three static poses of the robot are shown in the graph, wherein numbers 0, 1 and 2 on the pointing node P respectively represent the times of pose adjustment, the 0 th time represents the initial structure pose of the robot, and then the end effector calls a kinematics algorithm from the initial pose to the target pose and adjusts for 2 times. And calculating corresponding position errors and pointing errors after the 2 nd adjustment, wherein the error results are both 0, and the results show that the robot motion control and space pose simulation system is accurate and effective.
TABLE 1 parameters for end effector Start and target poses
By adopting the collaborative simulation method of the embodiment, the pointing deviation phenomenon of the five-degree-of-freedom motor in the initial adjustment stage is optimized, and the target pointing accuracy and the empirical work efficiency of the system are improved. The multi-motor multi-target robot system can be used for the reachable working space analysis and the structure optimization of a multi-degree-of-freedom robot.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that changes, modifications, substitutions and alterations can be made in these embodiments without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.