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. |
Setting up the P2OS Environment
Description: This tutorial will go over all the necessary steps to install and use P2OS-Purdue.Tutorial Level: BEGINNER
Next Tutorial: GMapping With P2OS Robots
Contents
New In Hydro and Groovy
In ROS Hydro you can run this command to install P2OS (if you use Ubuntu).
sudo apt-get install ros-hydro-p2os-driver ros-hydro-p2os-teleop ros-hydro-p2os-launch ros-hydro-p2os-urdf
or
sudo apt-get install ros-groovy-p2os-driver ros-groovy-p2os-teleop ros-groovy-p2os-launch ros-groovy-p2os-urdf
Setting Up the ROS Environment
If you already have a working ROS environment, it is safe to disregard this step. Just change to your workspace and clone the git repository as seen below.
Firstly, you will need the pr2-controllers package. On Ubuntu, you can just run this command:
sudo apt-get install ros-groovy-pr2-controllers ros-groovy-joystick-drivers
Now we set up the environment (if you already have one, you only need to do the last 3 lines).
mkdir -p ~/ros_ws/src cd ~/ros_ws/src catkin_init_workspace cd ~/ros_ws/ catkin_make source devel/setup.bash echo "source ~/ros_ws/devel/setup.bash" >> ~/.bashrc cd src && git clone http://www.hmt-git.com/p2os.git source ../devel/setup.bash cd ~/ros_ws catkin_make
Creating the p2osTutorials Package
Now that we have a workspace established, we can create a package to hold our code.
roscreate-pkg p2osTutorial roscpp geometry_msgs nav_msgs source ~/.bashrc
The above code generates the package with the necessary dependencies for these tutorials, then refreshes rospkg.
Enabling the P2OS Motors
There are three ways of enabling the motors:
run a node from the vanderbilt-ros-pkg
To use the vanderbilt p2os_enableMotor package, do the following:
roscd && cd ../src git clone http://www.hmt-git.com/allenh1/vanderbilt-ros-pkg.git source ../devel/setup.bash rosmake p2os_enableMotor rosrun p2os_enableMotor enableMotor
p2os_dashboard
For hydro you have to download it sepratrly
just use rostopic
rostopic pub /cmd_motor_state p2os_driver/MotorState 1
<launch> <node name="rostopic" pkg="rostopic" type="rostopic" args="pub -1 /cmd_motor_state p2os_driver/MotorState 1"/> </launch> or with a launch file
That should make the pioneer movable. The motors are not enabled by default. That's it! All done.