Running the Pioneer 3DX in Gazebo and ROS Kinetic (Part II)

In Part I of this post, we set up the Pioneer P3-DX in Gazebo, using the models found in the Multi Robot Scenario example.

multirobotscenario
Two Pioneer 3DX robots in the Multi Robot Scenario example

In this post, we would setup the example in our workspace so we can revert to the original if we mess up for convenience.

We would begin by copying the files into the source directory of our workspace, in my case ~/ROS/catkin_ws/src

$ cp -r /opt/ros/kinetic/share/gazebo_plugins/test/multi_robot_scenario/ ~/ROS/catkin_ws/src/multi_robot_scenario

After running,

$ cd ~/ROS/catkin_ws/
$ catkin_make
$ cd src
$ roslaunch multi_robot_scenario/launch/multi_robot_scenario.launch

…you should have them appear in Gazebo and RViz, like they did earlier.
However, if you analyze the launch files, you would realize they are referencing files in the previous location.
For example, in the multi_robot_scenario.launch file in the launch directory, there is this line
include file="$(find gazebo_plugins)/test/multi_robot_scenario/launch/pioneer3dx.gazebo.launch"

You could replace $(find gazebo_plugins)/test/multi_robot_scenario/ with the actual path to the multi_robot_scenario directory.

However, a better approach would be to make the new directory a package so we could reference the root folder dynamically.
To create a package, we would follow the tutorial on that. I was not sure of which dependencies to use, so I chose only xacro, as it was used in the URDF generation. You may change that, based on your needs.

By running,

$ catkin_create_pkg multi_robot_scenario xacro

You should get a folder with the name multi_robot scenario, generated wherever you run it. Copy the CMakeLists.txt and the package.xml files into the multi_robot scenario folder containing the files for the Pioneer 3DX. That is, the one in your catkin_ws/src folder.
Those two files are the main requirements for creating a package. With that done, run

$ cd ~/ROS/catkin_ws/
$ catkin_make

With our new package created, we can reference its location similar to $(find gazebo_plugins).

So we head to our launch directory multi_robot_scenario/launch and edit all the .launch files; replacing $(find gazebo_plugins)/test/multi_robot_scenario/ with $(find multi_robot_scenario)/
This should be done for

> multi_robot_scenario.launch
> pioneer3dx.gazebo.launch
> pioneer3dx.urdf.launch

Now you should be able to run the robot with

$ roslaunch multi_robot_scenario/launch/multi_robot_scenario.launch

In the next tutorial, we would clean up the robot – removing unwanted sensors – and
proceed to control it.

At the end of that tutorial, I would provide a link to a repository where you could access the final files.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s