HexArth Motion Control
From Waveshare Wiki
Robot Motion Control
In HexArth_Web Usage, it introduces how to control robot motion via the Web interface, including joint motion control and self-balancing control.
This tutorial explains the specific meanings of JSON commands for robot motion control. It mainly covers the meanings of JSON commands for vector motion control, pose angle rotation control, and self-balancing control. Individual joint angle control is divided into degree-based and radian-based forms. Individual 3D Cartesian coordinate control is for controlling the coordinate position of each leg's endpoint on a hexapod robot.
CMD_MOVE_INIT - Move to Initial Position
{"T":100}
- 100: It indicates that this command is CMD_MOVE_INIT, which commands all robot joints to rotate to their initial positions.
Normally, the robot automatically moves to the initial position upon boot.
CMD_SPEED_CTRL- Motion Speed Control Settings
{"T":1,"X":0.02,"Y":0.02,"Yaw":0.0}
- 1: Indicates this command is CMD_SPEED_CTRL, used to set the robot's movement speed.
- X represents the running speed in the forward/backward direction. Value range: -0.07 ~ +0.07, unit: m/s. Positive for forward, negative for backward.
- Y represents the running speed in the left/right strafing direction. Value range: -0.07 ~ +0.07, unit: m/s. Positive for left, negative for right.
- Yaw represents the running speed for in-place rotation. Value range: -0.6 ~ +0.6, unit: rad/s. Positive for left turn, negative for right turn.
CMD_AMP_CTRL- Pose Angle Rotation Control Settings
{"T":3,"r":0.1,"p":0.0,"y":0.0,"f":1}
- 3: Indicates this command is CMD_AMP_CTRL, used to set the amplitude and frequency for pose angle rotation.
- r represents the amplitude of rotation around the x-axis. Value range: 0.0 ~ 0.3.
- r represents the amplitude of rotation around the y-axis. Value range: 0.0 ~ 0.3.
- r represents the amplitude of rotation around the z-axis. Value range: 0.0 ~ 0.3.
- r represents the frequency of the pose angle rotation. Value range: 0.0 ~ 0.4.
CMD_BALANCED_ENABLE- Self-Balancing Mode Settings
{"T":4,"cmd":1}
- 4: Indicates this command is CMD_BALANCED_ENABLE, used to enable/disable the robot's self-balancing mode.
- cmd: Parameter for setting the self-balancing mode. 1 enables self-balancing mode, 0 disables it. (Self-balancing mode is mutually exclusive with other motion controls; enabling it prevents other motion controls).
CMD_DEFAULTZ- Body Height Settings
{"T":5,"cmd":-80.83}
- 5: Indicates this command is CMD_DEFAULTZ, used to set the robot's body height.
- cmd: The desired body height. The initial position body height is -83.18, unit is mm, value range is -140.83 ~ -60.83.
CMD_XYZT_CLAWS_CTRL- Single Leg Endpoint Position Control (Inverse Kinematics)
{"T":701,"leg":0,"x":-0.18,"y":-109.69,"z":-80.83}
- 701: Indicates that this command is CMD_XYZT_CLAWS_CTRL, used to control the position of a single robot leg.
- leg represents the leg number. Value range: 0 ~ 5. Right front leg is number 0, right-side legs increase sequentially clockwise; left front leg is number 3, left-side legs increase sequentially counterclockwise.
- x, y, z: Specific positions for the three axes, unit: mm.
CMD_RAD_CLAWS_CTRL- Single Leg Joint Control (Radian-based)
{"T":702,"leg":0,"coxa":0,"femur":0,"tibia":1.57}
- 702: Indicates that this command is CMD_RAD_CLAWS_CTRL, used to control the position of each joint for a single leg.
- leg represents the leg number. Value range: 0 ~ 5. Right front leg is number 0, right-side legs increase sequentially clockwise; left front leg is number 3, left-side legs increase sequentially counterclockwise.
- coxa is the hip joint rotation angle. Due to different leg mounting orientations on the hexapod robot, the initial angle and movable range differ for each hip joint. Specifically: Right front leg and left rear leg have an initial Coxa angle of -0.5235 rad, movable range -1.134 rad ~ 0 rad. Left front leg and right rear leg have an initial Coxa angle of 0.5235 rad, movable range 0 rad ~ 1.134 rad. Middle legs have an initial Coxa angle of 0 rad, movable range -0.7853 rad ~ 0.7853 rad.
- femur is the thigh joint rotation angle. The initial angle is 0.5235 rad, movable range 0 rad ~ 1.57 rad. Increasing the angle rotates the joint downward, decreasing rotates upward.
- tibia is the shank joint rotation angle. The initial angle is 2.619 rad, movable range 0 rad ~ 3.1415 rad. Increasing the angle rotates the joint downward, decreasing rotates upward.
CMD_ANGLE_CLAWS_CTRL- Single Leg Joint Control (Degree-based)
{"T":703,"leg":0,"coxa":0,"femur":0,"tibia":90}
- 703: Indicates this command is CMD_ANGLE_CLAWS_CTRL, used to control the position of each joint for a single leg.
- leg represents the leg number. Value range: 0 ~ 5. Right front leg is number 0, right-side legs increase sequentially clockwise; left front leg is number 3, left-side legs increase sequentially counterclockwise.
- coxa is the hip joint rotation angle. Due to different leg mounting orientations on the hexapod robot, the initial angle and movable range differ for each hip joint. Specifically: Right front leg and left rear leg have an initial Coxa angle of -30°, movable range -65° ~ 0°. Left front leg and right rear leg have an initial Coxa angle of 30°, movable range 0° ~ 65°. Middle legs have an initial Coxa angle of 0°, movable range -45° ~ 45°.
- femur is the thigh joint rotation angle. The initial angle is 30°, movable range 0° ~ 90°. Increasing the angle rotates the joint downward, decreasing rotates upward.
- tibia is the shank joint rotation angle. The Initial angle is 150°, movable range 0° ~ 180°. Increasing the angle rotates the joint downward, decreasing rotates upward.