Page tree
Skip to end of metadata
Go to start of metadata

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.

Contents

Prerequisites

These instructions assume you have setup your catkin workspace in your directory ~/catkin_ws.

Dependencies

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

You will need to follow (some of) the instructions in the rosaria tutorial  to install rosaria from source. http://wiki.ros.org/ROSARIA/Tutorials/How%20to%20use%20ROSARIA
What you need to do is as follows...
Install ROSARIA
# Get a working copy of the rosaria source 
cd ~/catkin_ws/src
git clone https://github.com/amor-ros-pkg/rosaria.git
# Re-setup your ros environment so that the system knows about our new package
source ~/catkin_ws/devel/setup.bash
# Use rosdep to install the dependencies
rosdep update
rosdep install rosaria
# Change directory
cd ~/catkin_ws
# Compile source
catkin_make 
# Re-setup your ros environment so that the system knows about our new package
source ~/catkin_ws/devel/setup.bash

Dependency: P2OS RVIZ Robot Model

Install the P2OS package - the wiki is http://wiki.ros.org/p2os-purdue and the source is https://github.com/allenh1/p2os

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:

install p2os
cd ~/catkin_ws/src/
git clone https://github.com/allenh1/p2os.git
cd ~/catkin_ws
catkin_make
source ~/catkin_ws/devel/setup.bash 
# Check to see that ros is aware of the p2os packages
rospack list | grep p2

This should generate some output that looks something like...

output
p2os_doc /home/bsb/catkin_ws/src/p2os/p2os_doc
p2os_driver /home/bsb/catkin_ws/src/p2os/p2os_driver
p2os_launch /home/bsb/catkin_ws/src/p2os/p2os_launch
p2os_msgs /home/bsb/catkin_ws/src/p2os/p2os_msgs
p2os_teleop /home/bsb/catkin_ws/src/p2os/p2os_teleop
p2os_urdf /home/bsb/catkin_ws/src/p2os/p2os_urdf

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...

cd ~/catkin_ws/src
git clone https://github.com/MobileRobots/amr-ros-config.git
cd ~/catkin_ws
catkin_make
source ~/catkin_ws/devel/setup.bash

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.

bsb@humuhumu:~/catkin_ws$ rospack list | grep amr
amr_robots_description /home/bsb/catkin_ws/src/amr-ros-config/description
amr_robots_gazebo /home/bsb/catkin_ws/src/amr-ros-config/gazebo
amr_robots_launchfiles /home/bsb/catkin_ws/src/amr-ros-config/launch

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:

cd ~/catkin_ws/src
git clone https://github.com/bsb808/nre_p3at.git
# Re-setup your ros environment so that the system knows about our new package
source ~/catkin_ws/devel/setup.bash
# If everything is working, this should put you in the package directory
roscd nre_p3at

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...

  1.   Directly on the commandline
    1. Open a terminal and start roscore
    2. Open a separate terminal and run RosAria: 

      rosrun rosaria RosAria _port:=/dev/ttyUSB0

  2. 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...

sudo adduser USER dialout

Where you substitute your username for USER, e.g.,

sudo adduser bsb dialout

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...

rostopic pub -r 10 my_p3at/cmd_vel geometry_msgTwist -- '[0.5, 0.0, 0.0]' '[0.0, 0.0, 0.0]'

 

Driving via Keyboard

  1. Put the vehicle up on blocks
  2. Open a terminal and start the base driver: roslaunch nre_p3at base.launch
    1. If already running, skip this step
  3. Open another terminal and start the ROS tools (rqt_tf_tree, rqt_topic, rqt_graph) : 

    roslaunch nre_p3at tools.launch

  4. Open a third terminal and start the keyboard teleoperation.  This script will launch the tool in a separate terminal window:

    cd ~/catkin_ws/src/nre_p3at/scripts
    ./teleopkeyboard.sh

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.

roslaunch nre_p3at rviz.launch 

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.

roslaunch nre_p3at complete.launch 

You should see these windows...

 

Troubleshooting

rosrun teleop_twist_keyboard teleop_twist_keyboard.py

  • No labels

1 Comment

  1. Thank you, glad to see someone doing this.