Planning a single goal

To plan a single goal, we literally only need to provide MoveIt! with the goal itself. A goal is expressed by a Pose message from the geometry_msgs package. We need to specify both the orientation and the pose. For this particular example, this goal was obtained by performing manual planning and checking the state of the arm. In a real situation, goals will probably be set depending on the purpose of the robotic arm:

geometry_msgs::Pose goal; 
goal.orientation.x = -0.000764819; 
goal.orientation.y = 0.0366097; 
goal.orientation.z = 0.00918912; 
goal.orientation.w = 0.999287; 
goal.position.x = 0.775884; 
goal.position.y = 0.43172; 
goal.position.z = 2.71809; 

For this particular goal, we can also set the tolerance. We are aware that our PID is not incredibly accurate, which could lead to MoveIt! believing that the goal hasn't been achieved. Changing the goal tolerance makes the system achieve the waypoints with a higher margin of error in order to account for inaccuracies in the control:

plan_group.setGoalTolerance(0.2); 

Finally, we just need to set the planning group target pose, which will then be planned and executed by the snippet of code shown at the beginning of this section:

plan_group.setPoseTarget(goal); 

We can run this snippet of code with the following command; the arm should position itself without any issues:

    $ rosrun rosbook_arm_snippets move_group_plan_single_target  
..................Content has been hidden....................

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