Motion
Replay Motion Trajectory
motion_id = lebai:move_trajectory(name)
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "move_trajectory", "params": [{"name": "", "dir": ""}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {"id": 1}, "id": 1 }
Enter Teaching Mode
lebai:teach_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 load configuration will affect teaching effect. When the set value is larger than the actual load, the robot will force upward, and vice versa, 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.
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "start_teach_mode", "params": [{}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Exit Teaching Mode
lebai:end_teach_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.
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "end_teach_mode", "params": [{}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Pause Motion
Pause all motions. Does not affect task running state.
lebai:pause_move()
Resume Motion
Resume all motions. Does not affect task running state.
lebai:resume_move()
Stop Motion
lebai:stop_move()
Stop all motions, but cannot cancel subsequent new motion commands. This command is the internal implementation mechanism of the move_until series commands.
Example Program
You can implement move_until functionality with the following code
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
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "stop_move", "params": [{}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Wait for Motion Completion
lebai:wait_move(motion_id)
- Parameters
motion_idmotion_id returned by move_xxx. Optional, default is 0 for all motions
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "wait_move", "params": [{"id": 1}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Get Motion State
state = lebai:get_motion_state(motion_id)
- Parameters
motion_idmotion_id returned by move_xxx
- Returns
stateMotion state: "WAIT" queuing; "RUNNING" in motion; "FINISHED" completed
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "get_motion_state", "params": [{"id": 1}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {"state": ""}, "id": 1 }
Get Currently Executing Motion ID
motion_id = lebai:get_running_motion()
- Returns
motion_idmotion_id returned by move_xxx
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "get_running_motion", "params": [{}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {"id": 1}, "id": 1 }
Joint Motion
motion_id = lebai:movej(p, a, v, t, r)
- Parameters
pPose relative to base- If
{0.1, 0.2, 0.2, 0.3, 0.1, 0.2}, represents joint positions - If
{x = 0, y = 0, z = 0, rz = 0, ry = 0, rx = 0}, represents coordinate positions - See Position and Pose for details
- If
aJoint acceleration of main axis (rad/s2)vJoint velocity of main axis (rad/s)tMotion time (s). Whent > 0, velocity parametervand accelerationaare invalidrBlending radius (m). Used to specify path smoothing effect
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "move_joint", "params": [{"pose": {}, "params": {}}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Joint Following Motion
motion_id = lebai:towardj(p, a, v, t, r)
- Parameters
- Same as Joint Motion
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "toward_joint", "params": [{"pose": {}, "params": {}}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Joint Constant Speed Motion
No position specified, moves at constant speed according to velocity vector until limit. When receiving other motion commands, will immediately terminate current command and execute new motion command.
motion_id = lebai:speedj(a, v, t)
- Parameters
aJoint acceleration (rad/s2)vVelocity of each joint (rad/s), like{0.1, 0.2, 0.2, 0.3, 0.1, 0.2}tMotion time (s). Optional, defaultt = 0, moves until limit
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "speed_joint", "params": [{"speed": [], "params": {}}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Linear Motion
motion_id = lebai:movel(p, a, v, t, r)
- Parameters basically same as Joint Motion:
p. Coordinate position, or joint position (will be converted to coordinate position through forward kinematics)a. Tool space acceleration (m/s2)v. Tool space velocity (m/s). Note that velocity and acceleration here are described in tool space
WARNING
Abnormalities may occur near the Singular Positions and Workspace Boundaries, and Joint Motion need to be used instead
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "move_linear", "params": [{"pose": {}, "params": {}}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Linear Constant Speed Motion
No position specified, moves at constant speed according to velocity vector until limit. When receiving other motion commands, will immediately terminate current command and execute new motion command.
motion_id = lebai:speedl(a, v, t, frame)
- Parameters
aSpace acceleration (m/s2)vVelocity in each direction (m/s)tMotion time (s). Optional, defaultt = 0, moves until limitframeReference frame. Optional, default base 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})
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "speed_line", "params": [{"speed": {}, "params": {}, "frame": {}}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Arc Motion
motion_id = lebai:movec(via, p, rad, a, v, t, r)
Performs arc motion in tool space, path is unique circle formed by current position, via and p. If three points lie on a straight line and cannot form a circle, or if distance between points is too small resulting in circle being too large or small, command will fail. Robot pose after completing arc motion matches p, regardless of rad.
- Parameters
via. Via positionp. Target positionrad. Arc angle of path (rad). Used to specify arc motion angle- Specially and by default, when
rad = 0indicates moving topas endpoint - If
rad > 0, indicates moving in arc motion trajectory, passing throughviaandp, and rotating correspondingrad - If
rad < 0, indicates moving in reverse direction arc motion trajectory,viaandpmay not be passed in this mode
- Specially and by default, when
a. Tool space acceleration (m/s2)v. Tool space velocity (m/s)t. Motion time (s)r. Blending radius (m)
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 }
Servo Motion (PVAT)
lebai:move_pvat(p, v, a, t)
Specify velocity and acceleration of each joint to make robot perform continuous servo motion.
WARNING
- Minimum settable time is 0.01 (10ms), path points less than this value will be skipped
- Sending interval between 2 adjacent points must be less than t, exceeding t will cause robot to automatically slow down and stop
- Parameters
pJoint positionvVelocity of each joint (rad/s)aAcceleration of each joint (rad/s2)tMotion time (s)
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 }
Servo Motion (PVT)
lebai:move_pvt(p, v, t)
Same as Servo Motion (PVAT), robot automatically estimates acceleration of each joint
- Parameters
pJoint positionvVelocity of each joint (rad/s)tMotion time (s)
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 }
Servo Motion (PT)
lebai:move_pt(p, v, t)
Same as Servo Motion (PVAT), robot automatically estimates velocity and acceleration of each joint
- Parameters
pJoint positiontMotion time (s)
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 }
