Welcome to ROSMASTER X3 Plus repository
2.MoveIt control the real machine(VM)
2、MoveIt control the real machine
2、MoveIt control the real machine2.1、Prepare2.2. Simulation startup2.3. Control real machine2.4.matters needing attention2.4.1. Start the robotic arm2.4.2.Start the MoveIT
MoveIt website:http://docs.ros.org/en/melodic/api/moveit_tutorials/html/index.html
2.1、Prepare
According to different models, you only need to set the purchased model in [.bashrc], X1 (ordinary four-wheel drive) X3 (Mike wheel) X3plus (Mike wheel mechanical arm) R2 (Ackerman differential) and so on. Section takes X3 as an example
Open the [.bashrc] file
sudo vim .bashrc
Find the [ROBOT_TYPE] parameter and modify the corresponding model
xxxxxxxxxxexport ROBOT_TYPE=X3plus # ROBOT_TYPE: X1 X3 X3plus R2 X7This lesson applies to all MoveIT cases for robots; MoveIT is mainly for robots with robotic arms.
2.2. Simulation startup
Just control the robot in the simulation under the MoveIT simulation.
xxxxxxxxxxroslaunch arm_moveit_demo x3plus_moveit_demo.launch sim:=true # Recommended virtual machineParameter use_rviz: Whether to enable rviz, if true, enable.
Parameter use_gui: Whether to open the GUI control interface, if true, this parameter is only valid when sim is true.
xxxxxxxxxxrqt_graph
Node diagram is as follows:

2.3. Control real machine
Controlling the real machine is to control the real robot in combination with MoveIT.
- Host by robots
xxxxxxxxxxroslaunch yahboomcar_bringup bringup.launch # robot endroslaunch arm_moveit_demo x3plus_moveit_demo.launch sim:=false # Recommended virtual machine- Host virtual machine
xxxxxxxxxxroscore # virtual machineroslaunch yahboomcar_bringup bringup.launch # robot endroslaunch arm_moveit_demo x3plus_moveit_demo.launch sim:=false # Recommended virtual machineNode diagram is as follows:

Corresponding relationship between robotic arm servos and joints: from the lowest end of the robotic arm to the end of the gripper.
| Robotic Arm Servo | joint | joint |
|---|---|---|
| The first servo | joint1 | joint1 |
| The second servo | joint2 | joint2 |
| The third servo | joint3 | joint3 |
| The fourth servo | joint4 | joint4 |
| The fifth servo | joint5 | joint5 |
| Servo that controls the gripper | grip_joint | Gripper |
Handle to control robotic arm
| Button | Robotic Arm | Button | Robotic Arm |
|---|---|---|---|
| X | Joint 1 turn left (data reduce) | B | Joint 1 turn right (data increase) |
| A | Joint 2 down (data reduce) | Y | Joint 2 up (data increase) |
| Left row left button | Joint 3 down (data reduce) | left row right button | Joint 3 up (data increase) |
| Left row down button | Joint 4 down (data reduce) | Left row up button | Joint 4 up (data increase) |
| L1(default) | Joint 5 turn left (data increase) | L2(default) | Joint 5 turn right (data increase) |
| L1 | Gripper tightening (data increase) | L2 | Gripper release (data reduce) |
Handle【R2】button: Get the current joint angle of the mechanical arm.
Use the handle 【SELECT】button to switch control 【joint 5】or control 【gripper】.
At this point, use the handle to control the robotic arm, and you will find that the real machine runs synchronously with the MoveIT simulation.
2.4.matters needing attention
Note: There may be problems, not necessarily.
2.4.1. Start the robotic arm
Regardless of whether you are using MoveIT or not, when you start the handle to control the real robot, thehandle state is connected, but the robot cannot be controlled.In this case, the handle control node may be acquiring the current position of the manipulator, and the current position data of the manipulator is [-1] (out of range or read failure).
Solution: Click the [START] button of the handle several times, and at the same time grab the gripper and gently shake the mechanical arm up and down until the buzzer sounds.
2.4.2.Start the MoveIT
The MoveIt simulation environment starts slowly, wait patiently and observe the terminal. An error as shown in the figure below occurs. The solution is shown in the figure. If the terminal reports an error and the motion planning library is not loaded, click [Reset] in the lower left corner to reload. At first, during the loading process, don't click [Reset] in a hurry. If you click it before it is loaded, the system will be reloaded, so it can't be started.

As shown in the figure below, if [Replanning: yes] appears on the terminal, and green [OMPL] appears below the Planning Library, the startup is successful.
