Welcome to DOFBOT SE repository
1. MoveIt Configuration
MoveIt2 Configuration
MoveIt2 Configuration1. Environment Setup1.1 Installing MoveIt21.2 Creating a Folder2. MoveIt2 Configuration2.1. Launching the Assistant2.2. Collision Detection2.3. Virtual Joints2.4. Motion Planning Groups2.5 Robot Positions2.6. End Effector2.7. Passive Joints2.8. URDF File2.9. ROS2 Controllers2.10: MoveIt Controllers2.11 Sensors2.12 Launch Files2.13. Author Information2.14. Generate Configuration3. Configuration Verification4.1. Modifying Configuration Files4.2. Building the Package4.3. Launching MoveItReferences
MoveIt2 is an advanced software framework for robot motion simulation, planning, and control.
Note: This configuration is pre-installed; please skip this step, otherwise it may damage your system environment!
1. Environment Setup
- Ubuntu 22.04 Virtual Machine
- ROS Humble
1.1 Installing MoveIt2
xxxxxxxxxxsudo apt install ros-humble-moveit*
1.2 Creating a Folder
Create the automatically generated configuration file for MoveIt2:
xxxxxxxxxxmkdir ~/dofbot_ws/src/dofbot_moveit
2. MoveIt2 Configuration
MoveIt Setup Assistant is a graphical tool used to simplify and accelerate the creation and configuration of MoveIt2 configuration packages.
Using this tool, users can easily generate configuration files for robot motion planning and control without the need to manually edit complex configuration files.
2.1. Launching the Assistant
Launch the MoveIt Setup Assistant:
xxxxxxxxxxros2 launch moveit_setup_assistant setup_assistant.launch.py
For first-time use, you can choose to create a new MoveIt configuration package; for subsequent sessions involving only minor modifications, you can choose to edit an existing MoveIt package.
Creating a new MoveIt configuration package requires importing the robot's URDF model. Simply importing a standalone URDF model file into the MoveIt Assistant will result in an error; instead, you must use the compiled package (specifying the path to the URDF file).
xxxxxxxxxx/home/yahboom/dofbot_ws/src/dofbot_urdf/urdf/dofbot.urdf

Once the URDF file has been selected, click "Load File," and the MoveIt Assistant will display the robot model:

2.2. Collision Detection
The Self-Collision Matrix is a feature used to optimize motion planning. Its primary function is to generate a matrix that describes whether collisions are possible between the various links within the robot model.
This matrix helps the motion planner avoid unnecessary collision checks while planning paths, thereby improving planning efficiency.
To generate the self-collision matrix, simply click the corresponding option within the MoveIt Setup Assistant to generate it automatically:


2.3. Virtual Joints
A virtual joint is used to define the relationship between the robot model and the external world. Virtual joints are typically used to describe the connection between a robot's base and a fixed reference frame (such as the world coordinate system).

To fix the robot's base link (base_link) relative to the world frame:
- Virtual Joint Name: virtual_joint
- Child Link: base_link
- Parent Frame Name: world
- Joint Type: fixed


2.4. Motion Planning Groups
Planning groups represent a crucial step in configuring a robot's motion planning.
A planning group defines which joints and links within the robot can move together, as well as how their motion is to be planned.

Planning Group for Robotic Arm: arm_group
- Group Name: arm_group
- Kinematic Solver: kdl_kinematics_plugin/KDLKinematicsPlugin
- Kin. Search Resolution (Sampling density in joint space): 0.005
- Kin. Search Timeout (Solution time): 0.005

- Add Joints: Select the joints belonging to the robotic arm
Joints: Arm1_Joint, Arm2_Joint, Arm3_Joint, Arm4_Joint, Arm5_Joint


Planning Group for Gripper: grip_group
- Group Name: grip_group
- Kinematic Solver: None
- Kin. Search Resolution (Sampling density in joint space): 0.005
- Kin. Search Timeout (Solution time): 0.005

- Add Links: Select the gripper's connecting rods.
Links: rlink1, rlink2, rlink3


2.5 Robot Positions
Robot Arm Positions
Configure three sets of predefined robot arm poses within the robot configuration settings:

You can manually adjust the sliders to set the state of each individual joint: Up, Down, or Init.



Gripper Positions
Configure two sets of predefined gripper poses within the robot configuration settings:

You can manually adjust the sliders to set the gripper state: Open or Close.



2.6. End Effector
Set the gripper group as the end effector:

End Effector: gripper
- End Effector Name: gripper
- End Effector Group: gripp_group
- Parent Link: Arm5_Link
- Parent Group: None


2.7. Passive Joints
Passive joints are non-actuated joints that cannot be directly controlled. If the robotic arm has no passive joints, simply skip this step.

2.8. URDF File
The MoveIt Setup Assistant automatically configures the command interfaces and state interfaces for each joint; use the default generated information.

2.9. ROS2 Controllers
ROS2 Controllers is a framework designed for real-time robot control; it can be used to automatically generate simulation controllers to drive the robot's joints.

Add Arm Controller:
- Controller Name: arm_group_controller
- Controller Type: joint_trajectory_controller/JointTrajectoryController
- Add Planning Group Joints: arm_group



Add Gripper Controller:
- Controller Name: grip_group_controller
- Controller Type: position_controllers/GripperActionController
- Add Planning Group Joints: grip_group



2.10: MoveIt Controllers
MoveIt requires a trajectory controller featuring the FollowJointTrajectoryAction interface to execute planned trajectories; this interface transmits the generated trajectories to the robot's ROS 2 controllers.
When adding MoveIt Controllers, ensure that the controller names match the names configured within the ROS 2 Controllers.

Add Arm Controller:
- Controller Name: arm_group_controller
- Controller Type: FollowJointTrajectory
- Add Planning Group Joints: arm_group



Add Gripper Controller:
- Controller Name: grip_group_controller
- Controller Type: Gripper Command
- Add Planning Group Joints: grip_group



2.11 Sensors
Configure settings for the 3D sensors used by the robot: No configuration required.

2.12 Launch Files
Configure the automatically generated launch files: Use default options. 
2.13. Author Information
Add author information for the purpose of generating the software package:

2.14. Generate Configuration
Generate the configuration files into the specified folder:

A "Confirm Package Update" dialog box will pop up; click OK, then click Exit Setup Assistant at the bottom.

3. Configuration Verification
The configuration files generated by the MoveIt Setup Assistant require minor modifications to resolve startup warnings and issues regarding the model failing to load.
4.1. Modifying Configuration Files
joint_limits.yaml
Modify the joint_limits.yaml file: change the maximum velocity and acceleration values for all joints to decimal numbers.

4.2. Building the Package
xxxxxxxxxxcd ~/dofbot_wscolcon build --packages-select dofbot_moveitsource install/setup.bash
4.3. Launching MoveIt
xxxxxxxxxxros2 launch dofbot_moveit demo.launch.py
Launching the simulation may take some time. Loading is complete once the message You can start planning now! appears in the terminal, or when a "trackball" (a newly added spherical marker) appears on the robotic arm.

References
MoveIt2 Humble: https://moveit.picknik.ai/humble/index.html