RoArm-M2-S 8. Control Robotic Arm with Commands

From Waveshare Wiki
Jump to: navigation, search
RoArm-M2-S 8. Control Robotic Arm with Commands
RoArm-M2-S.jpg

I2C, UART
TTL Serial Bus Servo Control Interface,
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

8. Control Robotic Arm with Commands

Keep the terminal window in which the roarm_driver robotic arm driver node is running, open a new terminal and run the Launch file for command and control, this demo relies on Moveit2 for motion planning:

cd ~/roarm_ws_em0/
ros2 launch roarm_moveit_cmd command_control.launch.py rviz_config:=~/roarm_ws_em0/src/roarm_main/roarm_moveit_cmd/config/command_control.rviz

CAUTION: After executing this command, the arm will rotate (the small arm is extended directly in front and parallel to the horizontal plane), do not place fragile items around the arm and keep it away from children.
If you want to display a robotic arm in Rviz2, you can refer to 4.2 Running the Moveit2 Drag and Drop Interaction demo.

8.1 Obtain Current Position

Open the third new terminal, and enter the robotic arm ROS2 workspace to enable the node to obtain the current position:

cd ~/roarm_ws_em0/
ros2 run roarm_moveit_cmd getposecmd

Open the fourth terminal, and enter the robotic arm ROS2 workspace to invoke the service to obtain the current position:

cd ~/roarm_ws_em0/
ros2 service call /get_pose_cmd roarm_moveit/srv/GetPoseCmd

8.2 Control EoAT (End of Arm Thing) of the Robot Arm to the Specified Position

Open a new terminal, enter the workspace of the robotic arm ROS2 and start the node used for motion control (for receiving the target position):

cd ~/roarm_ws_em0/
ros2 run roarm_moveit_cmd movepointcmd

A new terminal is opened to enter the workspace of the robotic arm ROS2 and invoke the service used to control the position of the EoAT of the robotic arm:

cd ~/roarm_ws_em0/
ros2 service call /move_point_cmd roarm_moveit/srv/MovePointCmd {"x: 0.2,y: 0,z: 0"}

xyz is the coordinate of the target position of the robot arm in m. You can control the robot arm to move to the target position by calling this service.

8.3 Drawing a Circle at a Fixed Height

In Rviz2, click Add to add the RobotModel.

M2-S-round.png

Select "Description Topic" in the "RobotModel" option, select "/robot_description", and then Links option shows.

M2-Sround1.png

In the Links option, find link4, expand it and check Show Trail to view the trajectory of the end link4.

M2-Sround2.png

Next, start the node used to draw the circle in the new terminal:

cd ~/roarm_ws_em0/
ros2 run roarm_moveit_cmd movecirclecmd

Call this service to get the robot arm to draw a circle at a specified location:

cd ~/roarm_ws_em0/
ros2 service call /move_circle_cmd roarm_moveit/srv/MoveCircleCmd {"x: 0.2,y: 0,z: 0,radius: 0.1"}

You can see the circle drawn by the robotic arm in the Rviz 2 interface.

RoArm-M2-S ROS2 Humble + Moveit2 Tutorial