Simple motion planning

The RViz plugin provides a very interesting mechanism to interact with MoveIt! but it could be considered quite limited or even cumbersome due to the lack of automation. In order to fully make use of the capabilities included in MoveIt!, several APIs have been developed, which allow us to perform a range of operations over it, such as motion planning, accessing the model of our robot, and modifying the planning scene.

In the following section, we will cover a few examples on how to perform different sorts of simple motion planning. We will start by planning a single goal, continue with planning a random target, proceed with planning a predefined group state, and finally, explain how to improve the interaction of our snippets with RViz.

In order to simplify the explanations, a set of launch files have been provided to launch everything required. The most important one takes care of launching Gazebo, MoveIt!, and the arm controllers:

    $ roslaunch rosbook_arm_gazebo rosbook_arm_empty_world.launch  

Another interesting launch file has been provided by the Setup Assistant, which launches RViz and the motion planning plugin. This particular one is optional, but it is useful to have, as RViz will be used further in this section:

    $ roslaunch rosbook_arm_moveit_config moveit_rviz.launch config:=true  

A number of snippets have also been provided, which cover everything explained in this section. The snippets can be found in the rosbook_arm_snippets package. The snippets package doesn't contain anything other than code, and launching the snippets will be done by calling rosrun instead of the usual roslaunch.

Every snippet of code in this section follows the same pattern, starting with the typical ROS initialization, which won't be covered here. After the initialization, we need to define the planning group on which motion planning is going to be performed. In our case, we only have two planning groups, the arm and the gripper, but in this case, we only care about the arm. This will instantiate a planning group interface, which will take care of the interaction with MoveIt!:

moveit::planning_interface::MoveGroupplan_group("arm"); 

After the instantiation of the planning group interface, there is usually some code dedicated to deciding on the goal that will be specific to each of the types of goals covered in this section. After the goal has been decided, it needs to be conveyed to MoveIt! so that it gets executed. The following snippet of code takes care of creating a plan and using the planning group interface to request MoveIt! to perform motion planning and, if successful, also execute it:

moveit::planning_interface::MoveGroup::Plan goal_plan; 
if (plan_group.plan(goal_plan)) 
{ 
  .plan_group.move(); 
} 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.79.241