Moveit guide

From Robin

Jump to: navigation, search

MoveIt is a framework for motion planning for robot manipulators. MoveIt allows us to specify a desired position for the manipulator and it provides the plan for how the manipulator will get there. This is helpful because we then don't have to specify a sequence of values for the arm for how it should get from its initial configuration to the end configuration. If you want to get more information about MoveIt, check this out.


Contents

Setup

To make it easier working with Tiago and ROS, you can use a Singularity container where the most basic packages you need are already installed. See how you can use the Singularity container on the robin wiki page here.

You might need to set some environment variables to be able to run simulations on your computer successfully. After you enter the Singulairty shell and you are ready to start simulating, check the environment variables ROS_MASTER_URI and ROS_IP. The ROS master should be set to run locally on your computer and the ROS ip should be set to your computer, like this:

 $ export ROS_MASTER_URI=http://localhost:11311
 $ export ROS_IP=vixen-nb.uio.no

If you are not using the vixen computer, change the IP to the computer you are using. In addition, you might need to set these environment variables every time you enter a new Singularity shell.


Planning with MoveIt! in Rviz

Usually when doing motion planning we use the MoveIt! plugin in Rviz. The idea is that you can interactively move Tiago’s arm to create, plan and execute motions. This lets you interact more closely with the manipulator, making it easier to plan legal movements (legal joint/coordinate values that also don't end up in self collisions). To use MoveIt in Rviz, follow the following steps.

  • Open two terminals, and enter the Singularity shell in both, as above.
  • Source ROS: source /opt/ros/melodic/setup.bash
  • In one terminal, run roscore:
 $ roscore
  • In the other terminal, run Rviz:
 $ rosrun rviz rviz
  • To do motion planning in Rviz, you can follow the tutorial here. You can also watch this video to get started with MoveIt in Rviz.
  • The Tiago handbook provides a thorough overview over how to perform motion planning with MoveIt! on pages 217-220.

The figure below shows the MoveIt! GUI and how the robot looks after moving its manipulator around to a random position.


Planning in joint space and cartesian space with MoveIt

In the Tiago workspace (tiago_public_ws) in the Singularity container there are two scripts that you can run to plan a motion with Tiago's arm. This involves running the scripts with some values, either in form of values for each of the joints in Tiago’s arm (planning in joint space) or the coordinates that the gripper should reach (planning in cartesian space). This is only meant as an example, while above is an example of how it is usually done.

To run these scripts, first enter the Singularity shell and open an empty world in Gazebo. This will allow us to watch the simulated movement in Gazebo. Enter the shell like this:

 $ singularity shell --nv /projects/robin/programs/sing-con/ros-melodic-pal/ros-melodic-pal.sif bash 

Then, source ROS and the workspace:

 $ source /opt/ros/melodic/setup.bash
 $ source /tiago_public_ws/devel/setup.bash

Then launch Gazebo:

 $ roslaunch tiago_gazebo tiago_gazebo.launch public_sim:=true end_effector:=pal-gripper

In another terminal, enter another Singularity shell and source ROS and the workspace as shown above. Now you can run the two scripts to either use MoveIt to plan in cartesian space or joint space.

Planning in joint space

Planning in joint space entails giving values for each of Tiago's joints. Run the script "plan_arm_torso_fk" with values for the torso position and each joint in the arm. This example is also shown on the ROS wiki page here, so check it out for more information. Here is how you run the script:

 $ rosrun tiago_moveit_tutorial plan_arm_torso_fk 0 2.7 0.2 -2.1 2.0 1.0 -0.8 0

This figure shows the manipulator of Tiago after running this command.

Planning in cartesian space

Planning in cartesian space entails giving values for the position and orientation of Tiago's end effector. You can run the script “plan_arm_torso_ik” to decide the position and orientation of the end effector. This example is also shown on the ROS wiki page here, so check it out for more information. Run the script like this:

 $ rosrun tiago_moveit_tutorial plan_arm_torso_ik 0.4 -0.6 0.5 -0.011 1.57 0.037 

This figure shows the manipulator of Tiago after running this command.

After running the scripts, you can observe how the arm moves in Gazebo. You can also change the values in the command above and watch how the robot moves now or what happens if you provide illegal values.


From simulation to the physical Tiago

To do motion planning on the physical Tiago, the approach is exactly as described above (using the MoveIt! plugin in Rviz), where the only difference is that you have to set the ROS_MASTER_URI variable to Tiago instead. Follow the tutorial from the handbook to do this, on pages 219-220.


How to make your own programs using MoveIt while using a container

Since you are using a Singularity container, you have ROS and several packages available, while also having your home directory available. Thus, you can create a workspace with all necessary files in your home directory and do all ROS-related stuff through the container. Once you have created all necessary scripts, you can run them in a similar fashion as above.

You can look at the “plan_arm_torso_fk” and “plan_arm_torso_ik” files in the Tiago workspace in the Singularity container as an example for how to use MoveIt in your source files. You can find these files here:

 /tiago_public_ws/src/tiago_tutorials/tiago_moveit_tutorial/src
Personal tools
Front page