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_manipulationunder [Robot] - Parameters:
- 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
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:
raise RuntimeError("manipulation too low")
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_poseunder [Robot] - Parameters:
- 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)
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_poseunder [Robot] - Parameters:
- name: [str] Position name
- dir: [str] Name of the file containing the position. Optional, default root directory
- raw_pose: Type of the returned pose. Optional, default
Falsereturns a joint pose; when set toTrue, 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")
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_poseunder [Robot] - Parameters:
- name: [str] Position name
- pose: [Pose] Pose to save, either a joint pose (list) or a Cartesian pose (dict). Optional, default
Nonesaves the current position - dir: [str] Name of the file containing the position. Optional, default root directory
- refer: [JointPose] Reference joint pose. Optional, default
Nonedoes 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})
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_frameunder [Robot] - Parameters:
- name: [str] Name
- 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)
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_forwardunder [Robot] - Parameters:
- 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)
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_inverseunder [Robot] - Parameters:
- p: [CartesianPose] Cartesian position and attitude
- 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)
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 , and b as the pose description relative to the coordinate system . Finally, return the pose description relative to the robot world coordinate system.
- Function name: Method
pose_transunder [Robot] - Parameters:
- Return: [CartesianPose] Pose , 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)
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 corresponding to pose a. Can be used to solve pose equations.
The inverse of a homogeneous matrix is equal to its transpose .
- Function name: Method
pose_inverseunder [Robot] - Parameters:
- 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
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)
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_addunder [Robot] - Parameters:
- pose: [Pose] Starting pose
- delta: [CartesianPose] Pose offset
- 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)
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)
