Kinematics/ROS API

In this section, we will walk you through the ROS API for using kinematics. In general, the kinematics components are best used by integrating them directly using the RobotModel C++ class as explained in this tutorial. However, if you find yourself needing to do kinematics only occasionally or from python, use the ROS API described in this section.

Inverse Kinematics
The ROS API for the inverse kinematics is extremely simple. Here, we will walk through the code to initiate an inverse kinematics request.

STEP 2: Fill in the request message
You just need to fill in the name of the group and the desired pose for the end-effector. The node will internally infer the name of the end-effector link and a seed state for the solver.

STEP 4: Add a seed state
You can add a seed state to the request so that the solver will try and find a solution close to the seed state.



STEP 5: Collision-Aware IK
You can set the flag that forces the solver to check for collisions for the solution it generates.

The entire code
The entire code can be seen here in the moveit_pr2 github project.

Compiling the code
Follow the instructions for compiling code from source.

The launch file
To run the code, you will need a launch file that brings up the move_group node that provides the kinematics services. The entire launch file is here on github. All the code in this tutorial can be compiled and run from the pr2_moveit_tutorials package that you have as part of your MoveIt! setup.

Running the code

 * First, roslaunch the launch file to run the code directly from pr2_moveit_tutorials:


 * Second, make sure you can visualize the result by following the Rviz instructions for adding a "RobotState" display.


 * Third, run the executable that calls the ROS API for the inverse kinematics. You should see the arm move to the new desired end-effector position.

Additional Reading

 * RobotState Display - Visualization of the RobotState using Rviz

Links

 * RobotModel Code API
 * RobotState Code API
 * Back to Kinematics