xarm_set_speed
1. Introduction
Set the speed percent of [Live Control] page.
2. Request & Response
{
"cmd": "xarm_set_speed",
"data": {
"percent": 1
},
"id":"set_speed_100%"
}
Name | Type | Required fields | Description |
---|---|---|---|
percent | int | Yes | set the speed percent of the Arm 0.01-1(1-100%); 1%=2.3mm/s |
code=0->success;
code!=0->Failed, refer to xarm_api_code;
3. Code Example
background
percent = float(data.get('percent')) # percent
if percent > 1:
percent = 1
max_tcp_speed = GLOBAL.XArm.xarm_params.get('LIMIT_VELO', GLOBAL.Config.LIMIT_VELO)[1]
# max_joint_speed = GLOBAL.XArm.xarm_params.get('LIMIT_ANGLE_VELO', GLOBAL.Config.LIMIT_ANGLE_VELO)[1]
max_joint_speed = GLOBAL.XArm.xarm_max_joint_speed
tcp_speed = max_tcp_speed * percent * GLOBAL.XArm.xarm_speed_factor
joint_speed = max_joint_speed * percent * GLOBAL.XArm.xarm_speed_factor
GLOBAL.XArm.xarm_speed_percent = percent
GLOBAL.XArm.save()
self._xarm_set_params(**{
'F': tcp_speed,
'F2': joint_speed
}, is_radian=False)
GLOBAL.XArm.xarm_params = self._xarm_get_params(is_radian=False)
return response(client, cmd_id, 0, 'ok')
front_end
self.setSpeedPercent = (percent, callback) => {
const params = window.GlobalConstant.INIT_CMD_PARAMS_COMMON_DATA();
Object.assign(params.data, {
percent: percent
});
self.sendCmd(window.GlobalConstant.SET_SPEED_PERCENT, params, (dict) => {
if (callback) {
callback(dict);
}
});
}
Last updated