RoArm-M3 Moveit2 Drag-and-drop Interaction in Moveit2
| ||
4. Moveit2 Drag-and-drop Interaction
4.1 Moveit2 Introduction
MoveIt2 is an open-source software used for robot motion planning, operation, and control. It provides a set of simple user interfaces that can help developers handle complex motion planning problems.
MoveIt2 supports a variety of algorithms and strategies, including motion planning, motion execution, motion monitoring, kinematic analysis, collision detection, and more. Its powerful features make it widely used in industrial, research, and educational fields.
MoveIt2 runs in the ROS2 (Robot Operating System 2) environment and can be seamlessly integrated with other ROS2 tools and libraries, greatly improving the efficiency and convenience of robot development.
In this tutorial, we'll use MoveIt2 to control the movement of the robotic arm. By dragging the end point of the robotic arm, MoveIt2 can automatically calculate the motion path of the robotic arm and control the actual movement of the robotic arm through the drive node.
4.2 Run Moveit2 Drag-and-drop Interaction Demo
If you followed the previous tutorial, before running this demo, you need to close the interface for viewing the joints of the Rviz2 robotic arm model. In the terminal window for viewing the joints of the Rviz2 robotic arm model, press Ctrl+C to close this process. The operation terminal of the robotic arm drive node does not need to be manually closed, otherwise, control of the real robotic arm will be impossible.
If you have also ended the terminal process of the robotic arm drive node, you need to run it again according to the content in 3. Drive Node to Control Real-world Robotic Arm. Keep the drive node of the robotic arm running, and then run the Moveit2 drag-and-drop interaction demo.
- You can run the Moveit2 drag-and-drop interaction demo in the terminal interface that closes the Rviz2 window to run and view the robotic arm model joints. This demo includes inverse kinematics solving, allowing you to interact with the robotic arm by dragging the end joint. To start Rviz2, run the following command:
ros2 launch roarm_moveit roarm_moveit.launch.py
- You can also run it after entering the container on the new terminal interface. To run it on the new terminal interface, you must first enter the workspace of the robotic arm ROS2, and then run the demo of the robotic arm Moveit2 drag-and-drop interaction, as follows:
cd /home/ws/roarm_ws/ ros2 launch roarm_moveit roarm_moveit.launch.py
Note: After executing this command, the robotic arm will rotate (the upper arm extends straight ahead, parallel to the horizontal plane), please do not place fragile items around the robotic arm and keep away from children.
If the robotic arm is not displayed after starting Rviz2, change the map behind the Fixed Frame in the Display window, change the map to base_link, and press Enter to confirm, as shown in the following figure.
Then click "Add" in the bottom left corner, select "MotionPlanning", and click "OK". In this way, the model of the robotic arm can be viewed in the Rviz2 visualization interface. You can refer to the operations in section 3.5 to change the viewing angle of the robotic arm.
Now, you can change the posture of the robotic arm by dragging the drag ball at the end of the robotic arm or the XYZ axes. After dragging to change the posture, you need to click on "Plan & Execute" in the Planning tab on the left side of the Rviz2 visualization interface to make the robotic arm execute according to the posture action of dragging. After execution, it is necessary to reset the robotic arm to the initial position on the Rviz2 startup interface. Then, change the "Goal State" option in the Planning tab to "home", and click "Plan & Execute" again to make the robotic arm respond to the motion.
Planning Group: You can change the shape of the end joints, change from hand to gripper, you can adjust the angle of the end joints in the "gripper" form. In the Joints tab on the left, swipe to set the angle of the Link3_to_gripper, then go back in the Planning tab, change the "Start State" option to "<previous>", and then click "Plan & Execute" to make the robotic arm respond. After changing the "Goal State" option in the Planning tab to "open", the gripper will fully open; after changing it to "close", the gripper will close.