Position and Attitude

Estimate Pose Manipulability 3.1.36

Calculate the reachability (manipulability) of a joint pose (0~1, larger means more flexible). Near Singular Positions and Workspace Boundaries, the manipulability approaches 0.

Generally, less than 0.001 is considered poor manipulability under strict conditions, and less than 0.0001 under relaxed conditions.

  • Function name: Method measure_manipulation under [Robot]
  • Parameters:
    1. p: [JointPose] Joint pose (rad)
  • Return: [float] Manipulability, 0~1, larger means more flexible

Example Program

cpose = {-0.3, -0.3, 0.3, 0, 0, 0}
jpose = lebai:kinematics_inverse(cpose)
manipulation = lebai:measure_manipulation(jpose)
print(manipulation)
if manipulation < 0.001 then
  error("manipulation too low")
end

Determine Whether Target Pose is Reached

Determine whether the robot's current pose is near the target pose (joint error < 0.1°, position deviation < 5mm, angle deviation < 1°).

  • Function name: Method in_pose under [Robot]
  • Parameters:
    1. p: [Pose] Target pose, either a joint pose (list) or a Cartesian pose (dict)
  • Return: [bool] Whether the target pose has been reached

Example Program

p = {0, -0.7854, 1.5708, -0.7855, 1.5708, 0}
ret = lebai:in_pose(p)
print(ret)

Load Waypoint Pose from Resource Library

Read a saved pose.

  • Function name: Method load_pose under [Robot]
  • Parameters:
    1. name: [str] Position name
    2. dir: [str] Name of the file containing the position. Optional, default root directory
    3. raw_pose: Type of the returned pose. Optional, default False returns a joint pose; when set to True, returns a joint pose or Cartesian pose in the original format as saved
  • Return: [Pose] Joint position information in the corresponding position library
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "load_pose", "params": [{"name": "", "dir": ""}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {"kind": ""}, "id": 1 }

Example Program

pose = lebai:load_pose("test_pose")

Save Waypoint Pose to Resource Library

Save a pose to the robot storage. When pose is None, save the current position.

  • Function name: Method save_pose under [Robot]
  • Parameters:
    1. name: [str] Position name
    2. pose: [Pose] Pose to save, either a joint pose (list) or a Cartesian pose (dict). Optional, default None saves the current position
    3. dir: [str] Name of the file containing the position. Optional, default root directory
    4. refer: [JointPose] Reference joint pose. Optional, default None does not save the reference joint pose
  • Return: None
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "save_pose", "params": [{"name": "", "dir": "", "data": {}}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }

Example Program

lebai:save_pose("target_tcp_pose", {x = -0.46, y = -0.121, z = 0.13, rz = -1.57, ry = 0, rx = 1.57})

Load Feature Coordinate System from Resource Library

Read a saved coordinate system.

  • Function name: Method load_frame under [Robot]
  • Parameters:
    1. name: [str] Name
    2. dir: [str] Workspace name. Optional, default root directory
  • Return: [CartesianPose] Offset relative to the base
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "load_frame", "params": [{"name": "", "dir": ""}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {"position": {}, "rotation": {}}, "id": 1 }

Example Program

frame = lebai:load_frame("frame1")
print(frame)

Forward Kinematics

Convert joint angles into Cartesian position and attitude through the robot forward kinematics.

  • Function name: Method kinematics_forward under [Robot]
  • Parameters:
    1. p: [Pose] Pose parameter, either a joint pose (list) or a Cartesian pose (dict)
  • Return: [CartesianPose] Cartesian space position and attitude
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "get_forward_kin", "params": [{"kind": ""}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {"position": {}, "rotation": {}}, "id": 1 }

Example Program

jpose = {0, -0.7854, 1.5708, -0.7855, 1.5708, 0}
cart = lebai:kinematics_forward(jpose)

Inverse Kinematics

Convert Cartesian position and attitude into joint angles through the robot inverse kinematics. The result is related to the current TCP settings and the current joint position.

  • Function name: Method kinematics_inverse under [Robot]
  • Parameters:
    1. p: [CartesianPose] Cartesian position and attitude
    2. refer: [JointPose] Reference joint position for the inverse solution. Optional, defaults to the current feedback joint position. When the inverse solution has multiple solutions, the one closest to refer is used
  • Return: [JointPose] Joint position
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "get_inverse_kin", "params": [{"kind": ""}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {"joint": [0]}, "id": 1 }

Example Program

cpose = {x = -0.465, y = -0.121, z = 0.13, rz = -1.57, ry = 0, rx = 1.57}
jpose = {0, -0.7854, 1.5708, -0.7855, 1.5708, 0}
joints = lebai:kinematics_inverse(cpose, jpose)

Pose Feature Coordinate System Transformation

Find the relative pose of b in the a coordinate system. Take a as the user coordinate system {A}\{A\}, and b as the pose description relative to the coordinate system {A}\{A\}. Finally, return the pose description relative to the robot world coordinate system.

  • Function name: Method pose_trans under [Robot]
  • Parameters:
    1. a: [Pose] Pose AA
    2. b: [Pose] Pose BB
  • Return: [CartesianPose] Pose C=ABC = AB, which is the pose description of b relative to the robot world coordinate system
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "get_pose_trans", "params": [{"from": {"kind": ""}, "from_to": {"kind": ""}}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {"position": {}, "rotation": {}}, "id": 1 }

Example Program

a = {x = 0.3, y = 0, z = 0.36, rz = 0, ry = 0, rx = 1.57}
b = {x = 0.35, y = 0, z = 0.36, rz = 0, ry = 0, rx = 1.57}
c = lebai:pose_trans(a, b)

Inverse of Pose

Pose inversion. Used to find the pose description of the inverse of the homogeneous matrix AA corresponding to pose a. Can be used to solve pose equations.

The inverse of a homogeneous matrix is equal to its transpose A1=ATA^{-1}=A^T.

  • Function name: Method pose_inverse under [Robot]
  • Parameters:
    1. p: [Pose] Pose, either a joint pose (list) or a Cartesian pose (dict)
  • Return: [CartesianPose] Cartesian position and attitude corresponding to the inverse matrix of AA
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "get_pose_inverse", "params": [{"kind": ""}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {"position": {}, "rotation": {}}, "id": 1 }

Example Program

a = {x = 0.3, y = 0, z = 0.36, rz = 0, ry = 0, rx = 1.57}
inverse_a = lebai:pose_inverse(a)

Pose Addition 3.1.13

Pose superposition: add an offset delta on top of pose. The pose after moving delta in the frame direction from the base position.

  • Function name: Method pose_add under [Robot]
  • Parameters:
    1. pose: [Pose] Starting pose
    2. delta: [CartesianPose] Pose offset
    3. frame: [CartesianPose] Direction of the pose offset, only the attitude part is effective. Optional, default robot base orientation
  • Return: [CartesianPose] Pose after the movement

Example Program

base = {x=-0.4, y=0, z=0.1, rz=-1.57, ry=0, rx=1.57}
frame = {x=0, y=0, z=0, rz=0, ry=-0.78, rx=0} -- rotate 45° around y-axis to tilt the z-axis upward
delta = {x=0, y=0, z=0.1, rz=0, ry=0, rx=0} -- move 0.1m along the z-axis
pose = lebai:pose_add(base, delta, frame)
lebai:movej(base, 0.4, 0.1)
lebai:movel(pose, 0.4, 0.1)