This page is a minimal example of testing the functionality of a Pioneer P3AT robot platform. The example is developed to illustrate some of the basic ROS tools for interacting with the hardware and as a means of testing the status (health) of the P3AT hardware.
These instructions assume you have setup your catkin workspace in your directory ~/catkin_ws.
We will be using a custom package called nre_p3at https://github.com/bsb808/nre_p3at
This package make use of other ROS packages - dependencies which you will need to install in your local workspace.
Dependency: ROSARIA Pioneer Interface
The rosaria package supplies the driver for the P3AT: http://wiki.ros.org/ROSARIA
Dependency: P2OS RVIZ Robot Model
Note: As indicated on the wiki page for p2os, there are Ubuntu apt packages that you can install, BUT in my installation (Ubuntu 14.04 with Indigo) I was not able to find the ros-indigo-p2os-urdf package! I instead installed from source which seemed to work fine.
Here is a brief version of how to install from source:
This should generate some output that looks something like...
Dependency: AMR-ROS-CONFIG Gazebo Robot Model
You should install a local copy of this ROS package: https://github.com/MobileRobots/amr-ros-config by doing the following...
Now open a new terminal so that ROS re-sources all the installed packages. To make sure you have installed the correct packages, issue this command and check that the output is consistent.
Setup ROS Package: nre_p3at
The ROS package for this example is this repository : https://github.com/bsb808/nre_p3at You will want a working copy of this source code in your catkin workspace:
Connecting ROS to P3AT using RosAria
One on of the first things you will want to do - the "hello world" example - is to establish a serial connection between a computer and the P3AT platform. The PeAT connects to your computer via a RS232 link. There is some information on setting up Serial on Linux.
To do this we'll need to run the RosAria driver. There are two equivalent ways to do this...
- Directly on the commandline
- Open a terminal and start roscore
- Open a separate terminal and run RosAria:
rosrun rosaria RosAria _port:=/dev/ttyUSB0
- Use the launch script from our nre_p3at ROS package like this...
roslaunch nre_p3at base.launch
If you have the correct serial port and everything is working you should see that the RX, TX and STATUS lights on the P3AT are blinking and you should see the following in the terminal:
One likely reason that this will not work is that you do not have a serial connection to the P3AT. If this is the case you will see something like this...
If you see this error message, try giving yourself permissions to access the serial port with a command like this...
Where you substitute your username for USER, e.g.,
Unfortunately you will need to logout and log back in for this change to take effect.
Driving via Command Line
You should be able to publish Twist messages to the pioneer with this...
Driving via Keyboard
- Put the vehicle up on blocks
- Open a terminal and start the base driver: roslaunch nre_p3at base.launch
- If already running, skip this step
- Open another terminal and start the ROS tools (rqt_tf_tree, rqt_topic, rqt_graph) :
roslaunch nre_p3at tools.launch
- Open a third terminal and start the keyboard teleoperation. This script will launch the tool in a separate terminal window:
This should open a new terminal window which you can use to drive the P3AT that looks like the image below. You can then use the keys to set the robot velocity.
Visualization Using RVIZ
The ps2os_urdf provides the URDF model for visualizing the P3AT in rviz.
The nre_p3at package has a short launch script for to setup the URDF model and start rviz with an appropriate configuration file.
You should see something like this...
You should notice that there are some red errors on the left of the rviz window and that the P3AT is a shadow. This is because we are running the visualization without anything to visualize!
Putting it All Together
Once you have verified that you have all the pieces and parts, you can use the command below that starts the rosaria driver, starts the graphical tools, starts rviz and then starts the teleoperation in a separate terminal.
- Note - Sometimes (not always) if you disconnect and re-connect to the Pioneer the connection will fail to make the serial connection. You can power-cycle the robot to alleviate this.
You should see these windows...
rosrun teleop_twist_keyboard teleop_twist_keyboard.py