|Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.|
Arm manipulationDescription: Arm manipulation with Moveit!
Tutorial Level: ADVANCED
Next Tutorial: Running the demos
All robot arms can be controlled using FollowJointTrajectoryAction interface (published under /arm_trajectory_controller/follow_joint_trajectory).
The gripper can be controlled using the GripperActionController interface (published under /gripper_controller/gripper_cmd).
The MoveIt is fully integrated on all robot arms.
For simplicity, we will use the ARMadillo robot for all following examples. In this tutorial we will use the armadillo simulation to run Moveit. Type the following command in a new terminal:
$ roslaunch armadillo2 armadillo2.launch gazebo:=true moveit:=true
Then, open another terminal and type this command:
* Important - When using the arm in the real world, please stand up behind the robot for your safety.
* If you wish to put the arm in driving mode, first move the arm to "cobra center" position. After the arm reached the position, move the arm to "driving" position.
MoveIt! is a state of the art software for mobile manipulation, incorporating the latest advances in motion planning, manipulation, 3D perception, kinematics, control and navigation. It provides an easy-to-use platform for developing advanced robotics applications, evaluating new robot designs and building integrated robotic products for industrial, commercial, R&D and other domains.
First open Rviz plug-in in rqt, and choose the following settings:
After that you will see the robot model like this:
Now move the arm by dragging the blue orb at the end of the arm:
Now execute the goal by pressing on plan. If planning process done successfully, you can then press execute.
Planning Goals For Moveit
Say you are working with RGB-D camera, to identify some object. After you extract the tf of that object, you might want to grab it with the robot's arm. To do so, follow these steps:
1. Transform tf from depth_camera_link to base_footprint. Moveit only accepts goals that are relative to base_footprint tf. To do so, you can use ROS LookUpTransform. Another way of doing this demonstrated inside the file find_object.cpp, which is located in robotican_common package (this code uses tf::MessageFilter in line 329 to do the transform to base_footprint).
2. Send the transformed tf as a goal to Moveit. This is done with Moveit library. A demo code can be found in moveit_group_goal.cpp file, which is located inside robotican_demos package.
3. If arm refuses to move, make sure the goal you are sending to Moveit is within arm's legal limits. It's also possible that your robot's arm has less than 6 DOF, which limits it to a small area of possible goals and orientations.
To increase probability of a successful goal execution, you can use IKfast solver that isn't taking arm orientation into account, which means more possibilities to reach some goal. If goal precision is not a top priority, you can also use a loop to try different goals around the original goal. Sometimes origin goal will fail, but if you were to sent a goal right next to it, i.e. 5 cms away from original goal, it will execute successfully. A demo for this method can be found in moveit_custom_goal.cpp file, which is located inside robotican_demos package. This demo node demonstrate how a certain goal can be achieved most of the time (as long as the goal is in arm's legal range). To run the node:
1. Make sure you are on komodo_bgu_release branch (git checkout komodo_bgu_release)
2. Download recent updates from branch (git pull origin komodo_bgu_release)
3. Compile (catkin_make)
4. Open terminal and write $ roslaunch robotican_komodo komodo.launch gazebo:=true moveit:=true
5. Open another terminal and write $ robotican_demos moveit_custom_goal 0.50 0.0 0.95 n
Notice that the node gets 4 parameters:
1. x value
2. y value
3. z value
4. y/n - determine whether to try more goals (with small offset) around the original goal.
When trying to write $ robotican_demos moveit_custom_goal 0.50 0.0 0.95 n for instance, Moveit will report it can't move the arm to the goal, but executing $ robotican_demos moveit_custom_goal 0.50 0.0 0.95 y will make moveit successfully plan and move the arm to the original goal + small offset. For deeper understanding on how it works, please refer to line 97-157 inside the demo file. This demo provide you with a quick way to check if a certain goal is valid, and also provide a good example on how to increase the probability of successful goal execution.