Executing a trajectory

So, at this point, we've seen some methods that allow us to plan a trajectory with Python code. But, what about executing this trajectory with the real robot? In fact, it's very simple. In order to execute a trajectory, we just need to call the go() function from the planning group, like this:

group.go(wait=True) 

By executing this line of code, we will be telling our robot to execute the last trajectory that has been set for the planning group.

First of all, we'll need to launch the MoveIt RViz environment by executing the following command:

$ roslaunch fetch_moveit_config fetch_planning_execution.launch  

We will create a new Python script called execute_trajectory.py and copy the code from joint_planning.py before adding a line into our new script in order to execute that trajectory.

Moreover, we can try this with any of the codes we have created for planning trajectories. When the code finishes executing, we'll see in Gazebo how the simulated robot is planning the specified motion described in the preceding code, as shown in the following screenshot:

Executing a trajectory
When you have finished this chapter, make sure to return the robot to the home position.

And that's it! We have finished this section! I really hope that you enjoyed it and, most of all, that you have learned a lot! Now, if you want to learn how we can add perception to motion planning tasks, just go to the next section!

..................Content has been hidden....................

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