RoArm-M2-S Robotic Arm Control

From Waveshare Wiki
Jump to: navigation, search

MOVING CTRL - Robotic Arm Movement Control

RoArm-M2-S_Web Usage introduces how to control the movement of the robotic arm through the Web app, including the joint angle control and 3D Cartesian coordinates control.
In this tutorial, we will introduce the JSON command meaning for the robotic arm control, including the joint angle control and 3D Cartesian coordinates control. The joint angle control is categorized into control in the form of an angle system and radian system, and the 3D Cartesian coordinates control is for the coordinate position of the endpoint of the robotic arm.
The JSON command shortcuts in this section are located in the "MOVING CTRL" module of the web interface.

Reset

CMD_MOVE_INIT - Move to the Initial Position

{"T":100}
  • 100: indicates this command is CMD_MOVE_INIT, which can rotate all joints of the robotic arm to the initial position.

Under normal circumstances, the robotic arm will automatically move to its initial position when powered on.

This command will cause the process to block.

Joint Angle Control

CMD_SINGLE_JOINT_CTRL - Single Joint Control (in radians)

{"T":101,"joint":0,"rad":0,"spd":0,"acc":10}
  • 101: indicating this command is CMD_SINGLE_JOINT_CTRL, the rotation of a joint of the robot arm is controlled in the form of an arc system.
  • joint: joint numbers.
    • 1: BASE_JOINT
    • 2: SHOULDER_JOINT
    • 3: ELBOW_JOINT
    • 4: EOAT_JOINT
  • rad: the angle to be rotated (in radians), taking the initial position of each joint, the default angle and rotation direction of each joint are as follows:
    • The default initial angle of BASE_JOINT is 0, and its rotation range is 3.14 to -3.14. When the angle increases, the base joint turns left. When the angle decreases, the base joint turns right.
    • The default initial angle of SHOULDER_JOINT is 0, and its rotation range is 1.57 to -1.57. When the angle increases, the shoulder joint rotates forward. When the angle decreases, the shoulder joint rotates backward.
    • The default initial angle of ELBOW_JOINT is 1.570796, and its rotation range is 3.14 to -1.11. When the angle increases, the elbow joint rotates downward. When the angle decreases, the elbow joint rotates reversely.
    • The initial angle of EOAT_JOINT is 3.141593. RoArm-M2-S adopts the clamp by default with a rotation range of 1.08 to 3.14. When the angle decreases, the clamp joint will open. If you adopt the wrist joint, the rotation range is 1.08 to 5.20. When the angle increases, the wrist joint rotates downward. When the angle increases, the wrist joint rotates upward.
  • spd: The rotation speed, measured in steps per second, is used to control the speed of the servos. In this system, one full rotation of a servo corresponds to 4096 steps. A higher numerical value will result in a faster speed, and when the speed value is set to 0, it will rotate at the maximum speed.
  • acc: The acceleration at the start and end of rotation can be controlled with a numerical value, which should be a value between 0 and 254, measured in 100 steps per second squared. A smaller numerical value results in smoother acceleration and deceleration. For example, if set to 10, it will accelerate and decelerate at 1000 steps per second squared. When the acceleration value is set to 0, it will use the maximum acceleration.

CMD_JOINTS_RAD_CTRL - All Angle Control (in radians)

{"T":102,"base":0,"shoulder":0,"elbow":1.57,"hand":3.14,"spd":0,"acc":10}
  • 102: indicates the command is CMD_JOINTS_RAD_CTRL, which controls the rotation of all joints for the robotic arm in radians.
  • base: the angle of the base joints. You can refer to the rotation angle range through the rad key in the "CMD_SINGLE_JOINT_CTRL" command.
  • shoulder: the angle of shoulder joints
  • elbow: the angle of elbow joints
  • hand: the angle of clamp/wrist joints
  • spd: The speed of rotation, the speed unit is step/second, one revolution of the servo is 4096 steps, the larger the value the faster the speed, when the speed value is 0, it rotates at the maximum speed.
  • acc: Acceleration at the beginning and end of the rotation, the smaller the value the smoother the start and stop, the value can be 0-254, and the unit is 100 steps per second ^ 2. If the setting is 10, it will be in accordance with the 1000 steps per second of the square of the acceleration and deceleration speed change. When the acceleration value is 0, it will run at the maximum acceleration.

CMD_EOAT_HAND_CTRL - EoAT Control (in radians)

{"T":106,"cmd":3.14,"spd":0,"acc":0}
  • 106: this command is CMD_EOAT_HAND_CTRL for setting the rotation angle of the clamp/wrist joint.
  • cmd: the rotation angle to be rotated (in radians). the default initial angle of EOAT_JOINT is 3.141593.
    • RoArm adopts the clamp by default with a rotation range of 1.08 to 3.14. When the angle decreases, the clamp will open.
    • If you change it to the wrist joint, the rotation range is 1.08 to 5.20. When the angle increases, the wrist joint rotates downward. When the angle decreases, the wrist joint rotates upward.
  • spd: the speed of rotation, the speed unit is step/second, one revolution of the servo is 4096 steps, the larger the value the faster the speed, when the speed value is 0, it rotates at the maximum speed.
  • acc: Acceleration at the beginning and end of the rotation, the smaller the value the smoother the start and stop, the value can be 0-254, and the unit is 100 steps per second ^ 2. If the setting is 10, it will be in accordance with the 1000 steps per second of the square of the acceleration and deceleration speed change. When the acceleration value is 0, it will run at the maximum acceleration.

CMD_SINGLE_JOINT_ANGLE - Single Joint Control (in radians)

{"T":121,"joint":1,"angle":0,"spd":10,"acc":10}
  • 121: this command is CMD_SINGLE_JOINT_ANGLE for controlling the rotation of some joints of the robotic arm in radians.
  • joint: joint number.
    • 1: BASE_JOINT
    • 2: SHOULDER_JOINT
    • 3: ELBOW_JOINT
    • 4: EOAT_JOIN, the angle of the clamp/wrist
  • angle: the angle to be rotated. Taking the initial position of each joint, the default angle and rotation direction of each joint are as follows:
    • The default initial angle of BASE_JOINT is 0° with the rotation range of 180° to -180°. When the angle increases, the base joint turns left. When the angle decreases, the base joint turns right.
    • The default initial angle of SHOULDER_JOINT is 0° with the rotation range of 90° to -90°. When the angle increases, the shoulder joint rotates forward. When the angle decreases, the shoulder joint rotates backward.
    • The default initial angle of ELBOW_JOINT is 90° with the rotation range of 180° to -45°. When the angle increases, the elbow joint rotates downward. When the angle decreases, the elbow joint rotates upward.
    • The default initial angle of EOAT_JOINT is 180° with the rotation range of 45°to 180°. When the angle decreases, the clamp will open. If you change it to the wrist joint, the rotation range is 45° to 315°. When the angle increases, the wrist joint rotates downward. When the angle decreases, the wrist joint rotates upward.
  • spd: The speed of rotation, the speed unit is °/s, the larger the value the faster the speed, when the speed value is 0, it rotates at the maximum speed.
  • acc: Acceleration at the beginning and end of the rotation, the smaller the value the smoother the start and stop in °/s^2. When the acceleration value is 0, the operation is in accordance with the maximum acceleration.

CMD_JOINTS_ANGLE_CTRL - All Joints Control (In angles)

{"T":122,"b":0,"s":0,"e":90,"h":180,"spd":10,"acc":10}
  • 122: this command is CMD_JOINTS_ANGLE_CTRL controlling the rotation of all joints of the robot arm in angles.
  • b: the angle of the base joint. For the angle of the base joint, see the description of the angle key in the "CMD_SINGLE_JOINT_ANGLE" command for the range of angular rotation.
  • s: the angle of the shoulder joint.
  • e: the angle of the elbow joint.
  • h: the angle of the clamp/wrist joint.
  • spd: The speed of rotation, the speed unit is °/s, the larger the value the faster the speed, when the speed value is 0, it rotates at the maximum speed.
  • acc: Acceleration at the beginning and end of the rotation, the smaller the value the smoother the start and stop, the value can be 0-254 in °/s^2. When the acceleration value is 0, the operation is in accordance with the maximum acceleration.

3D Cartesian Coordinate Control

CMD_SINGLE_AXIS_CRTL - Individual Axis Position Control of Robotic Arm EoAT (inverse kinematics)

{"T":103,"axis":2,"pos":0,"spd":0.25}

The definition of the axes of the robot arm is based on the right-hand rule, with the X-axis positively oriented directly in front of the robot arm, the Y-axis positively oriented to the left of the front of the robot arm, and the Z-axis positively oriented directly above the vertical of the robot arm.

  • 103: Indicates that this command is CMD_SIGNLE_AXIS_CRTL to control the robotic arm motion by giving the coordinate position of a separate axis to the EoAT of the robotic arm.
  • axis: indicates the axis number. 1-X axis; 2-Y axis; 3-Z axis; 4-T axis, clamp/wrist angle (in radian).
  • pos: A specific position of an axis in mm. e.g. the example above is to move the EoAT of the robotic arm to position 0 of the Y-axis, which is directly in front of the robotic arm.
  • spd: The speed of the movement, the larger the value the faster the speed, this move command contains a curve speed control function at the bottom of the command, so the speed is not constant.

This command causes the process to block.

CMD_XYZT_GOAL_CTRL - EoAT Control (inverse kinematics)

{"T":104,"x":235,"y":0,"z":234,"t":3.14,"spd":0.25}
  • 104: indicates this command is CMD_XYZT_GOAL_CTRL for controlling the movement of EoAT.
  • x, y, z, t: represents the specific position of four axes, the unit is mm. For more details, you can refer to the above introduction of CMD_SINGLE_AXIS_CTRL.
  • spd: indicates the movement speed. The bigger the value is, the faster the speed is. This movement command includes a curve speed control function at the bottom, so the speed is not constant.

This command may cause the movement to be blocked.

CMD_XYZT_DIRECT_CTRL - EoAT Position Control (inverse kinematics)

{"T":1041,"x":235,"y":0,"z":234,"t":3.14}
  • 1041: Indicates that this instruction is CMD_XYZT_DIRECT_CTRL, which controls the movement of the end point position of the robot arm.
  • x, y, z, t: The specific position of each of the four axes in mm. For details, refer to the description in the CMD_SINGLE_AXIS_CTRL command above.

Note: the difference between this command and the above command is that this command will not cause blocking. As there is no interpolation calculation in the bottom layer, the robotic arm will move to the target point at the fastest speed after calling this command. It is suitable for the case that a new target point is given continuously by this command, and the difference in the target point position between each command should not be too big.

CMD_SERVO_RAD_FEEDBACK - Get Feedback from Robotic Arm

{"T":105}
  • 105: indicates this command is CMD_SERVO_RAD_FEEDBACK for getting the feedback of the EoAT including coordinates, all joint angles, and the load.

After inputting this command, it feedbacks below:

{"T":1051,"x":309.0444117,"y":3.318604879,"z":238.2448043,"b":0.010737866,"s":-0.004601942,"e":1.570796327,"t":3.141592654,"torB":-56,"torS":-20,"torE":0,"torH":0}
  • x, y, z: respectively represents the EoAT coordinates of the X, Y, and Z axis.
  • b, s, e, t: respectively represents the base joint, shoulder joint, elbow joint, and EoAT joint angles (in radian).
  • torB, torS, torE, torH: respectively represent the load of the base joint, shoulder joint, elbow joint, and EoAT.

CMD_CONSTANT_CTRL - Continuous Movement Control (angle control + inverse kinematics control)

{"T":123,"m":0,"axis":0,"cmd":0,"spd":0}
  • 123: this command is CMD_CONSTANT_CTRL for enabling each joint of the robotic arm or the EoAT of the robotic arm to move continuously after an instruction is input.
  • m: continuous movement control mode
    • 0: angle control mode
    • 1: coordinate control mode
  • axis: Control different joint rotations in different modes.
    • In angle control mode: when the value of m is 0, it controls the angle rotation of all joints for the robotic arm. 1-Base joint, 2-SHOULDER joint, 3-ELBOW joint, and 4-HAND clamp/wrist joint.
    • Coordinate control mode: when the value of m is 1, it controls the rotation of the EoAT coordinates. 1-X axis, 2-Y axis, 3-Z axis, and 4-HAND clamp/wrist joint.
  • cmd: movement status.
    • 0-STOP movement.
    • 1-INCREASE: The angle increases in angle control mode; the coordinates increase in inverse kinematics control mode.
    • 2-DECREASE: The angle decreases in angle control mode; the coordinates decrease in inverse kinematics control mode.
  • spd: the speed coefficient, the bigger the value, the faster the speed. As the rotation speed of each joint is limited, the value is suggested in the range of 0-20.

This chapter introduces the JSON command meaning for the robotic arm, for more learning, you can click here to view.

RoArm-M2-S Tutorial Directory

RoArm-M2-S User Tutorial

RoArm-M2-S ROS2 Basic Tutorial