xarm_set_motion_config

1. Introduction

Save motion-related parameters.

Button: [Settings] - [Motion]

2. Request & Response

```
{
    "cmd": "xarm_set_motion_config",
    "data": {
        "tcpAcc": 50001,
        "jointAcc": 100,
        "posStep": 1,
        "attitudeStep": 1,
        "jointStep": 1,
        "collSens": 1,
        "teachSens": 1,
        "initPos": [0,0,0,0,0,0]
    },
    "id": "1"
}
```

3. Code Example

background

tcp_acc = int(data.get('tcpAcc', 0))
joint_acc = int(data.get('jointAcc', 0))
if tcp_acc:
    self._xarm_set_params(**{
        'Q': tcp_acc,
    }, is_radian=False)
if joint_acc:
    self._xarm_set_params(**{
        'Q2': joint_acc,
    }, is_radian=False)
GLOBAL.XArm.xarm_params = self._xarm_get_params(is_radian=False)
print(GLOBAL.XArm.xarm_params)
pos_step = float(data.get('posStep', 0))
attitude_step = float(data.get('attitudeStep', 0))
joint_step = float(data.get('jointStep', 0))
if pos_step:
    GLOBAL.XArm.xarm_position_step = pos_step
if attitude_step:
    GLOBAL.XArm.xarm_attitude_step = attitude_step
if joint_step:
    GLOBAL.XArm.xarm_joint_step = joint_step
if tcp_acc:
    GLOBAL.XArm.xarm_tcp_acc = tcp_acc
if joint_acc:
    GLOBAL.XArm.xarm_joint_acc = joint_acc
GLOBAL.XArm.save()
coll_sens = int(data.get('collSens', -1))
teach_sens = int(data.get('teachSens', -1))
sens_is_change = False
if GLOBAL.XArm.xarm.collision_sensitivity != coll_sens and coll_sens >= 0:
    sens_is_change = True
    GLOBAL.XArm.xarm.set_collision_sensitivity(coll_sens)
if GLOBAL.XArm.xarm.teach_sensitivity != teach_sens and teach_sens >= 0:
    sens_is_change = True
    GLOBAL.XArm.xarm.set_teach_sensitivity(teach_sens)
if sens_is_change:
    GLOBAL.XArm.xarm.save_conf()
    GLOBAL.XArm.xarm.set_state(0)
init_pos = data.get('initPos', None)
if init_pos:
    GLOBAL.XArm.xarm_initial_point = list(map(float, init_pos))
GLOBAL.XArm.save()
response(client, cmd_id, 0)

front_end

self.setMotionConfig = (config, callback) => {
  const params = window.GlobalConstant.INIT_CMD_PARAMS_COMMON_DATA();
  Object.assign(params.data, config);
  self.sendCmd(window.GlobalConstant.SET_MOTION_CONFIG, params, (dict) => {
    if (callback) {
      callback(dict);
    }
  });
};

Last updated