xarm_move_step
Introduction
Button: [Live Control] - X+ / X- / Y+ / Y- / Z+ / Z-
long-press: keep moving in a certain direction until the button is released, need to use with xarm_move_step_over and xarm_move_step_online.
short-press: move a step in a certain direction.
Request & Response
Message
php
{
"cmd": "xarm_move_step",
"data": {
"isLoop": true,
"direction": "joint-angle-increase",
"isMoveTool": true,
"acc": 500,
"axis": 3
},
"id": "1"
}
request
Name | Type | Required fields | Description |
---|---|---|---|
isloop | bool | Yes | Whether a long press or not |
direction | String | Yes | Direction of movement: |
- 'position-x-increase', 'position-x-decrease', 'position-y-increase', 'position-y-decrease', 'position-z-increase', 'position-z-decrease' | |||
- 'attitude-roll-increase', 'attitude-roll-decrease', 'attitude-pitch-increase', 'attitude-pitch-decrease', 'attitude-yaw-increase', 'attitude-yaw-decrease' | |||
- 'joint-angle-increase', 'joint-angle-decrease' | |||
- Aligning the Hand (xArm5 only): 'set-end-level' | |||
isMoveTool | bool | Yes | Whether to use Tool Coordinate or Base Coordinate (by default) |
isSetInitialPoint | bool | No | Not Used |
Response
code=0->success;
code!=0->Failed, refer to xarm_api_code
Code Example
background
python
if direction == 'position-x-increase' or direction == 'position-x-decrease':
self._xarm_sync_tcp(0)
x = GLOBAL.XArm.xarm_position_step if direction == 'position-x-increase' else -GLOBAL.XArm.xarm_position_step
if isMoveTool:
code = GLOBAL.XArm.xarm.set_tool_position(x=x, speed=tcp_speed)
else:
code = GLOBAL.XArm.xarm.set_position(x=x, relative=True, speed=tcp_speed)
front_end
javascript
moveStep(direction, isLoop) {
window.CommandsRobotSocket.moveStep({ 'direction': direction, 'isLoop': isLoop, 'isMoveTool': this.isToolCoord });
},
moveStep = (data, callback) => {
const params = window.GlobalConstant.INIT_CMD_PARAMS_COMMON_DATA();
Object.assign(params.data, data);
Object.assign(params.data, {
mode: self.model.robot.state.info.xarm_mode,
});
self.sendCmd(window.GlobalConstant.MOVE_STEP_START, params, (dict) => {
if (callback) {
callback(dict);
}
});
}