Code Used in this Tutorial Available

Code can be found at moveit_tutorials repository in doc folder. Use kinetic-devel branch.

MoveIt! Commander and Command Line Tool

The moveit_commander Python package offers wrappers for the functionality provided in MoveIt!. Simple interfaces are available for motion planning, computation of Cartesian paths, and pick and place.

Command Line Tool

The moveit_commander package also includes a command line tool for controlling the robot.

First, launch the MoveIt! simulated environment interface:

roslaunch pr2_moveit_config demo.launch

Now initiate the moveit_commander interface:

rosrun moveit_commander

The command below will start a command line interface tool that allows you to connect to a running instance of the move_group node. The first command you should type is:

use <group name>

This will connect to the move_group node for the group name you specified (in the PR2, for instance, you could connect to left_arm). You can now execute commands on that group. This command, current, will show you the current state of your group:


To record that state under a specific name you can simply type:

rec c

This will remember the current joint values of the robot group under the name c. Matlab-like syntax is available for modifying joint values. The code above copies the joint values of c into a new variable named goal. We then modify the first joint of goal to 0.2. You may need to use a different value instead of 0.2 (it needs to be within your allowed bounds and not cause collisions). The go command plans a motion and executes it.

To get the robot to move, you could type, for example:

goal = c
goal[0] = 0.2
go goal

Instead of calling go you could also type:

plan goal

This is slightly inefficient, but the advantage is that the plan command allows you to visualize the computed motion plan in Rviz before you actually issue the execute command.

For a list of supported commands, you can type “help”.

Open Source Feedback

See something that needs improvement? Please open a pull request on this GitHub page