A set of instructions and tutorials are provided to perform simulations in Gazebo using the Pioneer 3Dx model.
The recommended workstation setup is
- System: Ubuntu 16.04 LTS
- ROS distro: Kinetic
- Install ROS Kinetic
- Setup your sources.list and keys
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
- Installation of ROS-Desktop-Full Install: (Recommended) which includes ROS, rqt, rviz, robot-generic libraries, Gazebo7, etc.
sudo apt-get update sudo apt-get install ros-kinetic-desktop-full
- Initialize rosdep
sudo rosdep init rosdep update
- Environment setup
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc source ~/.bashrc
- Dependencies for building packages
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential
- Install catkin_tools (Recommended over catkin_make)
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros-latest.list' wget http://packages.ros.org/ros.key -O - | sudo apt-key add - sudo apt-get update sudo apt-get install python-catkin-tools
- Setup a catkin workspace (if not done already):
mkdir -p ~/catkin_ws/src cd ~/catkin_ws catkin init
- Use catkin_build to build packages
cd ~/catkin_ws catkin build
- Note that
catkin build
is another build tool thancatkin_make
. Make sure you will only use one method. In case you want to switch between the two tools, you need to delete the build directory first by running:cd ~/catkin_ws sudo rm -r build sudo rm -r devel sudo rm -r logs
- Install Git which is needed to install some packages from source
sudo apt-get update sudo apt-get install git-core
- Gazebo 7 is installed by default with ROS-Desktop-Full installation. It is the recmmended version for ROS Kinetic
- Make sure you have the ROS packages "ros-control" and "ros-controllers" installed
sudo apt-get install ros-kinetic-ros-control ros-kinetic-ros-controllers
Install packages needed for simulations based on pioneer_gazebo_ros
sudo apt-get install ros-kinetic-move-base ros-kinetic-move-base-msgs ros-kinetic-gmapping
cd ~/catkin_ws/src
git clone https://github.com/JenJenChung/pioneer_gazebo_ros.git
git clone https://github.com/JenJenChung/pioneer_description.git
git clone https://github.com/JenJenChung/pioneer_2dnav.git
git clone https://github.com/JenJenChung/nav_bundle.git
git clone https://github.com/JenJenChung/simple_navigation_goals.git
catkin build
- using a single Pioneer 3dx robot with an empty world
-
Modify the file
~/catkin_ws/src/pioneer_gazebo_ros/pioneer_gazebo/launch/pioneer_world.launch
to include the preferred world (environment) for simulation. To start with an empty world with no obstacles, replace the following line<arg name="world_name" value="$(find pioneer_gazebo)/worlds/utm_0.world"/>
with
<arg name="world_name" value="$(find pioneer_gazebo)/worlds/blank.world"/>
Note: for a list of available worlds files, check
~/catkin_ws/src/pioneer_gazebo_ros/pioneer_gazebo/worlds
-
Run the simulation and control interface:
roslaunch pioneer_gazebo pioneer_world.launch && roslaunch pioneer_ros pioneer_controller_spin_recover.launch
-
Odometery (position and velocity) of the robot is being published over the topic
/odom
of type nav_msgs/Odometry -
Velocity commands can be sent to the robot using the topic
/pioneer/cmd_vel
of type geometry_msgs/Twist
-
- using multiple Pioneer 3dx robots in an empty world
-
Modify the file
~/catkin_ws/src/pioneer_gazebo_ros/pioneer_gazebo/launch/pioneer_world.launch
to include the preferred world (environment) for simulation. To start with an empty world with no obstacles, replace the following line<arg name="world_name" value="$(find pioneer_gazebo)/worlds/utm_0.world"/>
with
<arg name="world_name" value="$(find pioneer_gazebo)/worlds/blank.world"/>
Note: for a list of available worlds files, check
~/catkin_ws/src/pioneer_gazebo_ros/pioneer_gazebo/worlds
-
Run the simulation, spawn vehicles at random initial positions, and run control interface:
cd ~/catkin_ws/src/pioneer_gazebo_ros ./run_multi_pioneer
-
Odometery topic and velocity commands of each robot will have a namesapce, for example,
/pioneer1/odom
and/pioneer1/pioneer/cmd_vel
-