UserCmd State
After switching to the UserCmd State, users can send external joint position commands for all joints, as well as actuator configuration commands (e.g. PD parameters). The robot executes these commands and updates its state accordingly.
State Details
| State Name | Task Name | Joystick Mapping | DDS Mapping | Frequency |
|---|---|---|---|---|
| UserCmd | UserCmdTask | None | 10 | 400Hz |
| Available for Hanging | Available for Standing | Auto Protection Switch |
|---|---|---|
| Yes | No | No |
Joystick Control
This state has no joystick control.
Client Control
| Velocity Control | Pose Control | Joint Control | Motor Config |
|---|---|---|---|
| No | No | Full body | Full body |
Enter UserCmd State
After starting AuroraCore, use the set_fsm_state function to enter the UserCmd State.
client = AuroraClient.get_instance(domain_id=123, robot_name="gr3")
time.sleep(1)
client.set_fsm_state(10) # switch to UserCmd State
Joint Control
Use set_group_cmd for joint control. Since position commands take effect immediately, interpolation is recommended to avoid sudden changes.
Available control groups: left_leg, right_leg, waist, head, left_manipulator, right_manipulator, left_endeffector, right_endeffector
left_manipulator_init_pose = client.get_group_state("left_manipulator", key="position")
left_manipulator_target_pose = [0.0, 0.0, 0.0, -1.2, 0.0, 0.0, 0.0]
total_steps = 200
for i in range(total_steps):
left_manipulator_pose = [s + (e - s) * i / total_steps for s, e in zip(left_manipulator_init_pose, left_manipulator_target_pose)]
client.set_group_cmd({"left_manipulator": left_manipulator_pose})
time.sleep(0.01)
Motor Configuration
Use set_motor_cfg_pd to configure joint PD parameters.
Available control groups: left_leg, right_leg, waist, head, left_manipulator, right_manipulator
kp_config = {
"left_leg": [400, 200, 200, 400, 200, 26],
"right_leg": [400, 200, 200, 400, 200, 26],
"waist": [200, 300, 200],
"head": [100, 100],
"left_manipulator": [400, 200, 200, 200, 50, 50, 50],
"right_manipulator": [400, 200, 200, 200, 50, 50, 50],
}
kd_config = {
"left_leg": [20, 20, 20, 20, 20, 2.6],
"right_leg": [20, 20, 20, 20, 20, 2.6],
"waist": [10, 15, 10],
"head": [10, 10],
"left_manipulator": [20, 10, 10, 10, 2.5, 2.5, 2.5],
"right_manipulator": [20, 10, 10, 10, 2.5, 2.5, 2.5],
}
client.set_motor_cfg_pd(kp_config, kd_config)