(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Getting Started with p2os

Description: A quick tutorial for installing and running p2os with ROS

Keywords: p2os, pioneer

Tutorial Level: BEGINNER

Requirements

Hardware

  • An ActivMedia Pioneer DX or AT

  • A computer fixed to the Pioneer base

Software

  • ROS Electric

Assumptions

  • The Pioneer base is in good working condition including proper odometry, inflated tires, etc.
  • A second computer will be used for teleoperation of the base
  • Both computers will use ROS as the software platform
  • Both computers will be running Ubuntu
  • An alternate directory has been established for storing the stack.
  • NOTE: As this was written, p2os_teleop has become incompatible with joy_node. If you run into problems while following this tutorial, please refer to this page.

Setting up ROS

See installing ROS for instructions on how to install ROS.

Getting the files

From Ubuntu repositories

  • If you have Ubuntu installed, you may install everything you need with:

sudo apt-get install ros-electric-p2os ros-electric-joystick-drivers

Compiling from source

Checkout SVN repository

  • On both computers, check out the svn repository to your ~/ros directory:

cd ~/ros

svn co https://usc-ros-pkg.svn.sourceforge.net/svnroot/usc-ros-pkg/trunk/p2os/

Compile the code

  • On both computers, install dependencies of p2os and then compile it
  • You need the joystick drivers stack.

sudo apt-get install ros-electric-joystick-drivers 

rosmake p2os --rosdep-install

Configuring network names

  • Under certain circumstances, it may be necessary to edit /etc/hosts on both the base station and the computer local to the Pioneer in order for the p2os node to contact the roscore node across the network. If you find that p2os_dashboard can't fetch the battery status for your pioneer, this is most likely the case.

Gathering information

  • run ifconfig on both computers and note their IP addresses and the name of the computers (in the form <user>@<name>)

Configuring the base station

  • Add the specific IP and name of both computers to /etc/hosts

sudo vim /etc/hosts
  • Move the entry for the the base station from 127.0.0.1 to its IP on the network; ie change:

127.0.0.1    localhost <name of base>

to

127.0.0.1    localhost
<ip of base>    <name of base>
<ip of pioneer pc>    <name of pioneer pc>

Configuring the Pioneer

  • Repeat the above process for the Pioneer; the entries for the two computers in /etc/hosts will be the same

Configuring ROS network parameters

Configuring the base station

  • On the computer which will be running the roscore node (most likely the base station computer), edit ~/ros/setup.sh; add an entry for ROS_MASTER_IP and make sure it is the same as the prefix for ROS_MASTER_URI

... export ROS_MASTER_URI=http://<ip of base>:11311 ...
export ROS_MASTER_IP=<ip of base>

Configuring the Pioneer

  • On the computer local to the Pioneer, set the ROS_MASTER_URI in the command line (or change it in ~/ros/setup.sh to make the change persistent)

export ROS_MASTER_URI=http://<ip of base>:11311

Testing

Starting roscore on the base station

  • Run roscore on the computer being used as a base station:

roscore
  • Make sure that the value of ROS_MASTER_URI (printed when roscore starts up) is correct

Starting the p2os dashboard

  • The p2os dashboard provides basic diagnostic info for a Pioneer, including battery status, enable/disable motors, and a rosout display window.
  • To run the p2os Dashboard on the computer being used as a base station:

rosrun p2os_dashboard p2os_dashboard
  • The dashboard will start to display real-time info once you start the p2os driver on a Pioneer base

Starting p2os on the Pioneer

  • Run p2os on the computer local to the pioneer:

rosrun p2os_driver p2os
  • The ROS node will print out information about the roscore node it is connecting to. Make sure that it is connecting to the roscore node running on your base station.

Starting Teleoperation

  • A teleop-joy launch file has been created for convenience. You must have a joystick to start teleoperation, and you may have to edit the button mappings in the launch file. Run this command on the computer that you've plugged the joystick into:

roslaunch p2os_launch teleop_joy
  • Before you can drive the Pioneer around, you must enable the motors using either the hardware button on the Pioneer or the motor reset button in the p2os dashboard.

Wiki: p2os/Tutorials/Getting Started with p2os (last edited 2012-06-08 16:17:46 by GeorgeBrindeiro)