Position and Attitude

Joint Position Description

Lebai Robot LM3 is a six-axis (six-joint) robot. The rotation amount of each joint forms the joint position description (hereinafter referred to as joint position), which can be represented by a six-tuple:

(j1,j2,j3,j4,j5,j6) (j_1, j_2, j_3, j_4, j_5, j_6)

Where jij_i represents the rotation angle of the i-th joint, in radians (rad).

In Lua API, it is represented by an associative array with specified index keys.

In Lua SDK, it is represented by an array with sequential numeric indices.

For example, for the joint position

(j1=0.024rad,j2=15,j3=π,j4=π2,j5=30,j6=0) (j_1=0.024\,\mathrm{rad}, j_2=-15^\circ, j_3=\pi, j_4=\frac{\pi}2, j_5=30^\circ, j_6=0)

In Lua API, it can be represented as:

{j1=0.024, j2=math.rad(-15), j3=math.pi, j4=math.pi/2, j5=math.rad(30), j6=0}

In Lua SDK, it can be represented as:

{0.024, math.rad(-15), math.pi, math.pi/2, math.rad(30), 0}

Use lua_pose and sdk_pose for conversion between Lua API and SDK

The range of joint description is theoretically unlimited, with specific limitations depending on the actual application scenario and possible self-interference.

Cartesian Space Position and Attitude Description

The Cartesian position and attitude of the Lebai robot end-effector (hereinafter referred to as space position or pose) is represented by a six-tuple:

(x,y,z,α,β,γ) (x, y, z, \alpha, \beta, \gamma)

Where (x,y,z)(x, y, z) represents the spatial Cartesian coordinate position, in meters (m). (α,β,γ)(\alpha, \beta, \gamma) represents the rotation attitude, in radians (rad).

In Lua API, it is represented by an array with sequential numeric indices.

In Lua SDK, it is represented by an associative array with specified index keys.

For example, for the Cartesian space pose

(x=0.24m,y=0,z=0,α=π2,β=30,γ=0.024rad) (x=0.24\,\mathrm{m}, y=0, z=0, \alpha=\frac{\pi}2, \beta=30^\circ, \gamma=0.024\,\mathrm{rad})

In Lua API, it can be represented as:

{0.2, 0, 0, math.pi/2, math.rad(30), 0.024}

In Lua SDK, it can be represented as:

{x=0.2, y=0, z=0, rz=math.pi/2, ry=math.rad(30), rx=0.024}

Use lua_pose and sdk_pose for conversion between Lua API and SDK

For describing coordinate frame (pose) {B}\{B\}, we use the following descriptions:

  • X-Y-Z Fixed Angles. First align coordinate frame {B}\{B\} with the known reference frame {A}\{A\}. First rotate {B}\{B\} around X^A\hat{X}_A by angle γ\gamma, then around Y^A\hat{Y}_A by angle β\beta, and finally around Z^A\hat{Z}_A by angle α\alpha.
  • Z-Y-X Euler Angles. First align coordinate frame {B}\{B\} with the known reference frame {A}\{A\}. First rotate {B}\{B\} around Z^B\hat{Z}_B by angle α\alpha, then around Y^B\hat{Y}_B by angle β\beta, and finally around X^B\hat{X}_B by angle γ\gamma.
  • RPY Rotation Angles. X-Y-Z fixed angles can also be defined as RPY rotation angles, i.e., roll angle RR(roll), pitch angle PP(pitch), and yaw angle YY(yaw). First align coordinate frame {B}\{B\} with the known reference frame {A}\{A\}. First rotate {B}\{B\} around X^A\hat{X}_A by roll angle, then around Y^A\hat{Y}_A by pitch angle, and finally around Z^A\hat{Z}_A by yaw angle.

Lebai Robot's rotation attitude is described using Z-Y-X Euler angles. Their relationship is as follows:

EulerZYX(α,β,γ)=XYZ(γ,β,α)=RPY(γ,β,α) {EulerZYX}(\alpha, \beta, \gamma) = {XYZ}(\gamma, \beta, \alpha) = {RPY}(\gamma, \beta, \alpha)

When developers need to convert between Lebai's pose and other pose representations, they need to transform through a selection matrix. In general computer programming, RPY or quaternions are commonly used to describe attitude. Here is the formula for converting RPY to a matrix:

RPY(γ,β,α)=(cosαcosβcosαsinβsinγsinαcosγcosαsinβcosγ+sinαsinγsinαcosβsinαsinβsinγ+cosαcosγsinαsinβcosγcosαsinγsinβcosβsinγcosβcosγ) {RPY}(\gamma, \beta, \alpha)=\begin{pmatrix} \cos\alpha \cos\beta & \cos\alpha \sin\beta \sin\gamma - \sin\alpha \cos\gamma & \cos\alpha \sin\beta \cos\gamma + \sin\alpha \sin\gamma \\ \sin\alpha \cos\beta & \sin\alpha \sin\beta \sin\gamma + \cos\alpha \cos\gamma & \sin\alpha \sin\beta \cos\gamma - \cos\alpha \sin\gamma \\ -\sin\beta & \cos\beta \sin\gamma & \cos\beta \cos\gamma \end{pmatrix}

The formula for converting a 3×3 rotation matrix to RPY:

(r0r1r2r3r4r5r6r7r8)=RPY(γ,β,α),{β=arctan2(r6,r02+r32),β[π2,π2]α=arctan2(r3cosβ,r0cosβ),α[π,π]γ=arctan2(r7cosβ,r8cosβ),γ[π,π] \begin{pmatrix} r_0 & r_1 & r_2 \\ r_3 & r_4 & r_5 \\ r_6 & r_7 & r_8 \\ \end{pmatrix}= RPY(\gamma, \beta, \alpha), \begin{cases} \beta&=\arctan2\left(-r_6, \sqrt{r_0^2+r_3^2}\right), &\beta\in\left[-\dfrac{\pi}2, \dfrac{\pi}2\right] \\ \alpha&=\arctan2\left(\dfrac{r_3}{\cos\beta}, \dfrac{r_0}{\cos\beta}\right) , & \alpha\in[-\pi, \pi] \\ \gamma&=\arctan2\left(\dfrac{r_7}{\cos\beta}, \dfrac{r_8}{\cos\beta}\right) , & \gamma\in[-\pi, \pi] \end{cases}

Specifically, when β=π2|\beta|=\dfrac{\pi}{2}, cosβ=0\cos\beta=0. At this time, take γ=0\gamma=0, and α=arctan2(r1,r4)\alpha=\arctan2(-r_1, r_4).

The conversion implementation in KDL (C++):

Rotation Rotation::EulerZYX(double Alfa,double Beta,double Gamma) {
    return RPY(Gamma,Beta,Alfa);
}

void Rotation::GetEulerZYX(double& Alfa,double& Beta,double& Gamma) const {
    GetRPY(Gamma,Beta,Alfa);
}

Rotation Rotation::RPY(double roll,double pitch,double yaw) {
    double ca1,cb1,cc1,sa1,sb1,sc1;
    ca1 = cos(yaw); sa1 = sin(yaw);
    cb1 = cos(pitch);sb1 = sin(pitch);
    cc1 = cos(roll);sc1 = sin(roll);
    return Rotation(ca1*cb1,ca1*sb1*sc1 - sa1*cc1,ca1*sb1*cc1 + sa1*sc1,
                    sa1*cb1,sa1*sb1*sc1 + ca1*cc1,sa1*sb1*cc1 - ca1*sc1,
                    -sb1,cb1*sc1,cb1*cc1);
}

// Gives back a rotation matrix specified with RPY convention
void Rotation::GetRPY(double& roll,double& pitch,double& yaw) const {
    double epsilon=1E-12;
    pitch = atan2(-data[6], sqrt( sqr(data[0]) +sqr(data[3]) )  );
    if ( fabs(pitch) > (PI_2-epsilon) ) {
        yaw = atan2(  -data[1], data[4]);
        roll  = 0.0 ;
    } else {
        roll  = atan2(data[7], data[8]);
        yaw   = atan2(data[3], data[0]);
    }
}

Robot Kinematics

When the robot moves and joint position is specified, as long as no self-interference occurs (i.e., the robot doesn't collide with itself), it can theoretically reach any position. When a set of joint positions is determined and the TCP settings are set, the robot's pose is also determined and unique. This calculation process is the robot's forward kinematics.

When spatial position is specified, the situation becomes quite different. Due to the robot's own configuration, the inverse kinematics that converts spatial position to joint position may have multiple solutions or no solution. The robot cannot reach any point in space; this is a physical limitation. The robot also cannot execute arbitrary motion between two points in space — this phenomenon is particularly obvious when the robot is in a "singular position," where executing spatial movement commands may cause algorithm failure, and the robot must stop moving.

When the robot motion produces the following error messages, please modify the motion commands in the scene or program, and restore the robot to normal position through teaching or joint movement.

  • 1140 Robot motion planning error
  • 1010 Robot cannot reach that position

D-H Parameters

Lebai Robot uses modified D-H parameters for robot kinematics description.

Jointθ\thetadid_i (unit: m)ai1a_{i-1} (unit: m)αi1\alpha_{i-1} (unit: rad)
100.2158300
20001.5708
300-0.280
400.12063-0.260
500.0983301.5708
600.083430-1.5708

Due to manufacturing and assembly errors, there will always be some deviation between the actual DH parameters of each robot and the theoretical values. Lebai precisely calibrates the actual DH parameters before each robot leaves the factory. Customers who need visual grasping, offline simulation, and other applications can consult developers for detailed information.

Singular Positions

Typical singular positions include the following three:

  1. Four axes parallel, i.e., joints 2, 3, 4, and 6 are in a parallel state.
  2. Zero position, i.e., all robot joint angles are 0.
  3. The robot arm is fully extended at any position.

Four axes parallel

Zero position