Motion
Replay Motion Trajectory
Execute a saved trajectory.
- Function name: Method
move_trajectoryunder [Robot] - Parameters:
- name: [str] Trajectory name
- dir: [str] Name of the file containing the trajectory. Optional, default root directory
- Return: [int] Motion command ID
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "move_trajectory", "params": [{"name": "", "dir": ""}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {"id": 1}, "id": 1 }
Example Program
motion_id = lebai:move_trajectory("traj1")
print(motion_id)
motion_id = lebai.move_trajectory("traj1")
print(motion_id)
Enter Teaching Mode
When the robot is in idle state, calling this command can enter teaching (free drive) mode. In teaching mode, each joint of the robot can be freely dragged, hence also called free drive mode. End-effector load configuration will affect the teaching effect. When the set value is larger than the actual load, the robot will force upward; otherwise, it will force downward. Please check carefully.
WARNING
When the robot is not in idle state, calling this command will generate error 1000: Robot must be idle to teach.
- Function name: Method
teach_modeunder [Robot] - Parameters: None
- Return: None
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "start_teach_mode", "params": [{}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Example Program
lebai:teach_mode()
lebai.teach_mode()
Exit Teaching Mode
When the robot is in teaching state, i.e., teaching (free drive) mode, calling this command can exit teaching mode and return to idle state. No error is generated when called in other modes.
- Function name: Method
end_teach_modeunder [Robot] - Parameters: None
- Return: None
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "end_teach_mode", "params": [{}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Example Program
lebai:end_teach_mode()
lebai.end_teach_mode()
Pause Motion
Pause all motion. Does not affect the task running status.
- Function name: Method
pause_moveunder [Robot] - Parameters: None
- Return: None
Example Program
lebai:pause_move()
lebai.pause_move()
Resume Motion
Resume all motion. Does not affect the task running status.
- Function name: Method
resume_moveunder [Robot] - Parameters: None
- Return: None
Example Program
lebai:resume_move()
lebai.resume_move()
Stop Motion
Stop all motion, but cannot cancel subsequently issued motion commands. This command is the internal implementation mechanism of the move_until series commands.
- Function name: Method
stop_moveunder [Robot] - Parameters: None
- Return: None
Example Program The following code can implement the move_until functionality:
motion_id = lebai:movej({0.2, 0.5, 0.4, 0, 0, 1.57}, 1.0, 0.2, 0, 0)
while true
do
if lebai:get_motion_state(motion_id) == "FINISHED"
then
break
end
if lebai:get_di("FLANGE", 1) == 1
then
lebai:stop_move()
end
end
motion_id = lebai.movej([0.2, 0.5, 0.4, 0, 0, 1.57], 1.0, 0.2, 0, 0)
while True:
if lebai.get_motion_state(motion_id) == "FINISHED":
break
if lebai.get_di("FLANGE", 1) == 1:
lebai.stop_move()
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "stop_move", "params": [{}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Wait for Motion Completion
Block and wait for the specified motion to complete. Waits for all motion to complete when no motion ID is specified.
- Function name: Method
wait_moveunder [Robot] - Parameters:
- id: [int] Motion ID returned by move_xxx. Optional, defaults to all motion
- Return: None
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "wait_move", "params": [{"id": 1}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Example Program
motion_id = lebai:movej({0.2, 0.5, 0.4, 0, 0, 1.57}, 1.0, 0.2, 0, 0)
lebai:wait_move(motion_id)
motion_id = lebai.movej([0.2, 0.5, 0.4, 0, 0, 1.57], 1.0, 0.2, 0, 0)
lebai.wait_move(motion_id)
Get Motion State
Query the motion state.
- Function name: Method
get_motion_stateunder [Robot] - Parameters:
- id: [int] Motion ID returned by move_xxx
- Return: [str] Motion state:
WAITqueuing;RUNNINGmoving;FINISHEDcompleted
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "get_motion_state", "params": [{"id": 1}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {"state": ""}, "id": 1 }
Example Program
motion_id = lebai:movej({0.2, 0.5, 0.4, 0, 0, 1.57}, 1.0, 0.2, 0, 0)
state = lebai:get_motion_state(motion_id)
motion_id = lebai.movej([0.2, 0.5, 0.4, 0, 0, 1.57], 1.0, 0.2, 0, 0)
state = lebai.get_motion_state(motion_id)
Get Running Motion ID
- Function name: Method
get_running_motionunder [Robot] - Parameters: None
- Return: [int] ID of the currently executing motion
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "get_running_motion", "params": [{}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {"id": 1}, "id": 1 }
Example Program
motion_id = lebai:get_running_motion()
motion_id = lebai.get_running_motion()
Joint Motion
Execute linear motion in joint space. To use this command, the robot must be stationary or the previous command must be movej or movel with blending.
- Function name: Method
movejunder [Robot] - Parameters:
- p: [Pose] Position parameter. If
[0.1, 0.2, 0.2, 0.3, 0.1, 0.2], it represents a joint position expressed in joint angles; if{'x': 0.01, 'y': 0, 'z': 0, 'rz': 0, 'ry': 0, 'rx': 0}, it represents a Cartesian coordinate position. Refer to Position and Attitude for details - a: [float] Joint acceleration of the motion (rad/s2)
- v: [float] Joint velocity of the motion (rad/s)
- t: [float] Motion time (s). When t > 0, the velocity v and acceleration a parameters are invalid. If the time is very short, the motion command may not be completed within the set time, but the robot will move to the target position at the maximum safe acceleration and velocity. Optional, default 0
- r: [float] Motion blend radius (m). Used to specify the smoothing effect of the path, range 0 to 1. The larger the value, the larger the allowed deviation from the trajectory path when moving continuously through multiple points, and the larger the arc of the trajectory to achieve smoothing. Optional, default 0
- p: [Pose] Position parameter. If
- Return: [int] Motion command ID
WARNING
- When the position parameter is a Cartesian coordinate position, if the input Cartesian coordinate position is a singular point or exceeds the motion range and the inverse solution fails, an error will be reported.
- The safety settings contain the safe angle range settings for each joint. If the input joint position exceeds the range, an error will be reported during motion. The joint safe angle range must be set according to the requirements.
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "move_joint", "params": [{"pose": {}, "params": {}}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Example Program
motion_id = lebai:movej({0, -0.7854, 1.5708, -0.7855, 1.5708, 0}, 5, 1.5, 0, 0.5)
motion_id = lebai:movej({x = -0.46, y = -0.121, z = 0.13, rz = -1.57, ry = 0, rx = 1.57}, 5, 1.5, 0, 0.5)
motion_id = lebai.movej([0, -0.7854, 1.5708, -0.7855, 1.5708, 0], 5, 1.5, 0, 0.5)
motion_id = lebai.movej({'x': -0.46, 'y': -0.121, 'z': 0.13, 'rz': -1.57, 'ry': 0, 'rx': 1.57}, 5, 1.5, 0, 0.5)
Joint Following Motion
When towardj motion commands are issued consecutively, the target positions of previously issued motion commands are ignored. There is no need to move to the previously issued target position; the motion targets the position parameter of the latest command. Unlike movej, where the issued positions form a trajectory and the arm executes the trajectory step by step to completion.
- Function name: Method
towardjunder [Robot] - Parameters:
- p: [Pose] Position parameter. If
[0.1, 0.2, 0.2, 0.3, 0.1, 0.2], it represents a joint position expressed in joint angles; if{'x': 0.01, 'y': 0, 'z': 0, 'rz': 0, 'ry': 0, 'rx': 0}, it represents a Cartesian coordinate position - a: [float] Joint acceleration of the motion (rad/s2)
- v: [float] Joint velocity of the motion (rad/s)
- t: [float] Motion time (s). When t > 0, the velocity v and acceleration a parameters are invalid. Optional, default 0
- r: [float] Motion blend radius (m). Used to specify the smoothing effect of the path, range 0 to 1. Optional, default 0
- p: [Pose] Position parameter. If
- Return: [int] Motion command ID
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "toward_joint", "params": [{"pose": {}, "params": {}}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Example Program
lebai:towardj({0, -0.7854, 1.5708, -0.7855, 1.5708, 0}, 5, 1.5, 0, 0.1)
lebai:towardj({-0.3, -0.7854, 1.5708, -0.7855, 1.5708, 0}, 5, 1.5, 0, 0.1)
lebai.towardj([0, -0.7854, 1.5708, -0.7855, 1.5708, 0], 5, 1.5, 0, 0.1)
lebai.towardj([-0.3, -0.7854, 1.5708, -0.7855, 1.5708, 0], 5, 1.5, 0, 0.1)
Joint Constant Speed Motion
Without specifying a position, each joint moves at a constant speed according to the velocity vector. The duration of motion is determined by the motion time parameter. By default t = 0, moving until the limit is reached. When other motion commands are received, the current command is immediately terminated and the new motion command is executed.
- Function name: Method
speedjunder [Robot] - Parameters:
- a: [float] Joint acceleration of the motion (rad/s2)
- v: [JointPose] Velocity of each joint (rad/s), e.g.,
[0.1, 0.2, 0.2, 0.3, 0.1, 0.2] - t: [float] Motion time (s). Optional, default t = 0, moving until the limit is reached
- Return: [int] Motion command ID
WARNING
The velocity parameter is a list representing the velocity setpoints of each joint, unlike the float type in movej.
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "speed_joint", "params": [{"speed": [], "params": {}}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Example Program
motion_id = lebai:speedj(5, {0.1, 0, 0, 0, 0, 0}, 0.5)
motion_id = lebai.speedj(5, [0.1, 0, 0, 0, 0, 0], 0.5)
Linear Motion
Linear motion in Cartesian space to the target pose.
- Function name: Method
movelunder [Robot] - Parameters:
- p: [Pose] Position parameter. If
[0.1, 0.2, 0.2, 0.3, 0.1, 0.2], it represents a joint position expressed in joint angles (converted to a coordinate position via forward kinematics); if{'x': 0.01, 'y': 0, 'z': 0, 'rz': 0, 'ry': 0, 'rx': 0}, it represents a Cartesian coordinate position - a: [float] Tool space acceleration of the motion (m/s2)
- v: [float] Tool space velocity of the motion (m/s). Note that the velocity and acceleration here are described in tool space
- t: [float] Motion time (s). When t > 0, the velocity v and acceleration a parameters are invalid. Optional, default 0
- r: [float] Motion blend radius (m). Used to specify the smoothing effect of the path, range 0 to 1. Optional, default 0
- p: [Pose] Position parameter. If
- Return: [int] Motion command ID
WARNING
When the position parameter is a Cartesian coordinate position and is at a Singular Position or exceeds the Workspace Boundary, the inverse solution will fail and an error will be reported. In such cases, switch to Joint Motion. When the input joint position exceeds the safe angle range, an error will be reported during motion.
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "move_linear", "params": [{"pose": {}, "params": {}}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Example Program
motion_id = lebai:movel({x = -0.46, y = -0.121, z = 0.13, rz = -1.57, ry = 0, rx = 1.57}, 2, 1, 0, 0.5)
motion_id = lebai.movel({'x': -0.46, 'y': -0.121, 'z': 0.13, 'rz': -1.57, 'ry': 0, 'rx': 1.57}, 2, 1, 0, 0.5)
Linear Constant Speed Motion
Without specifying a position, move at a constant speed according to the velocity vector in the specified reference coordinate system until the limit is reached. When other motion commands are received, the current command is immediately terminated and the new motion command is executed.
- Function name: Method
speedlunder [Robot] - Parameters:
- a: [float] Space acceleration (m/s2)
- v: [CartesianPose] Velocity in each direction (m/s), e.g.,
{'x': 0.01, 'y': 0, 'z': 0, 'rz': 0, 'ry': 0, 'rx': 0} - t: [float] Motion time (s). Optional, default t = 0, moving until the limit is reached
- frame: [CartesianPose] Motion coordinate reference frame. Optional, default base orientation
- Return: [int] Motion command ID
WARNING
The velocity parameter is the velocity setpoint in each direction.
Example Program
lebai:speedl(0.1, {x = 0.01, y = 0, z = 0, rz = 0, ry = 0, rx = 0}, 0, {x = 0, y = 0, z = 0, rz = 0, ry = 0, rx = 0})
lebai.speedl(0.1, {'x': 0.01, 'y': 0, 'z': 0, 'rz': 0, 'ry': 0, 'rx': 0}, 0, {'x': 0, 'y': 0, 'z': 0, 'rz': 0, 'ry': 0, 'rx': 0})
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "speed_line", "params": [{"speed": {}, "params": {}, "frame": {}}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Circular Motion
Performs circular motion in tool space. The path is the unique circle formed by the current position, via and p.
WARNING
If the three points lie on a straight line and a circle cannot be drawn, or if the distances between the points are too small such that the unique circle becomes too large or too small, the command will fail. The robot pose after completing the circular motion matches p, regardless of rad.
- Function name: Method
movecunder [Robot] - Parameters:
- via: [Pose] Via position
- p: [Pose] Target position
- rad: [float] Radian of the path arc (rad). Used to specify the arc size of the circular motion. Specially and by default, when rad = 0, it moves to p as the endpoint; if rad > 0, it moves in a circular trajectory passing through via and p, rotating the corresponding rad; if rad < 0, it moves in the reverse direction circular trajectory, and via and p may not be passed in this mode
- a: [float] Tool space acceleration (m/s2)
- v: [float] Tool space velocity (m/s)
- t: [float] Motion time (s). Optional, default 0
- r: [float] Motion blend radius (m). Optional, default 0
- Return: [int] Motion command ID
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "move_Circular", "params": [{"pose_via": {}, "pose": {}, "rad": 0, "params": {}}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Example Program
via = {x = -0.41, y = -0.071, z = 0.13, rz = -1.57, ry = 0, rx = 1.57}
p = {x = -0.46, y = -0.121, z = 0.13, rz = -1.57, ry = 0, rx = 1.57}
motion_id = lebai:movec(via, p, 3.14, 1, 0.5, 0, 0.1)
via = {'x': -0.41, 'y': -0.071, 'z': 0.13, 'rz': -1.57, 'ry': 0, 'rx': 1.57}
p = {'x': -0.46, 'y': -0.121, 'z': 0.13, 'rz': -1.57, 'ry': 0, 'rx': 1.57}
motion_id = lebai.movec(via, p, 3.14, 1, 0.5, 0, 0.1)
Servo Motion (PVAT)
Specify the velocity and acceleration of each joint to make the robot perform continuous servo motion.
WARNING
- The minimum settable time is 0.01 (10ms); path points smaller than this value will be skipped.
- The sending interval between two adjacent points must be less than t; exceeding t will cause the robot to automatically decelerate and stop.
- Note the parameter order, velocity comes first.
- Function name: Method
move_pvatunder [Robot] - Parameters:
- p: [JointPose] Joint position
- v: [list[float]] Velocity of each joint (rad/s), e.g.,
[0.1, 0.2, 0.2, 0.3, 0.1, 0.2] - a: [list[float]] Acceleration of each joint (rad/s2), e.g.,
[1, 1, 1, 1, 0.5, 0.5] - t: [float] Motion time (s)
- Return: None
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "move_pvat", "params": [{"duration": 0.01, "joints": [{"pose": 0, "velocity": 0.1, "acc": 0.1}]}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Example Program
lebai:move_pvat({0, -0.7854, 1.5708, -0.7855, 1.5708, 0}, {0.1, 0.2, 0.2, 0.3, 0.1, 0.2}, {1, 1, 1, 1, 0.5, 0.5}, 0.5)
lebai.move_pvat([0, -0.7854, 1.5708, -0.7855, 1.5708, 0], [0.1, 0.2, 0.2, 0.3, 0.1, 0.2], [1, 1, 1, 1, 0.5, 0.5], 0.5)
Servo Motion (PVT)
Same as Servo Motion (PVAT), the acceleration of each joint is automatically estimated by the robot.
- Function name: Method
move_pvtunder [Robot] - Parameters:
- p: [JointPose] Joint position
- v: [list[float]] Velocity of each joint (rad/s), e.g.,
[0.1, 0.2, 0.2, 0.3, 0.1, 0.2] - t: [float] Motion time (s)
- Return: None
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "move_pvat", "params": [{"duration": 0.01, "joints": [{"pose": 0, "velocity": 0.1, "acc": 0}]}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Example Program
lebai:move_pvt({0, -0.7854, 1.5708, -0.7855, 1.5708, 0}, {0.1, 0.2, 0.2, 0.3, 0.1, 0.2}, 0.5)
lebai.move_pvt([0, -0.7854, 1.5708, -0.7855, 1.5708, 0], [0.1, 0.2, 0.2, 0.3, 0.1, 0.2], 0.5)
Servo Motion (PT)
Same as Servo Motion (PVAT), the velocity and acceleration of each joint are automatically estimated by the robot.
- Function name: Method
move_ptunder [Robot] - Parameters:
- p: [JointPose] Joint position
- t: [float] Motion time (s)
- Return: None
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "move_pvat", "params": [{"duration": 0.01, "joints": [{"pose": 0, "velocity": 0, "acc": 0}]}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Example Program
lebai:move_pt({0, -0.7854, 1.5708, -0.7855, 1.5708, 0}, 0.5)
lebai.move_pt([0, -0.7854, 1.5708, -0.7855, 1.5708, 0], 0.5)
