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 the mr_tools package
Description: Using the mr_teleoperator stack to connect to and display data from an Xbox/PS controller Keyboard and MouseKeywords: mr_teleoperation, mr_tools, teleoperation, Xbox controller, PS controller, Keyboard, Mouse
Tutorial Level: BEGINNER
Before starting this tutorial, please complete the installation as described in the ROS installation instructions. This tutorial assumes that Ubuntu 12.04 is being used.
Installation
Until the package is indexed in the ROS system, you can check out and install the code manually from the source control repository:
cd ../path_to/your_catkin_workspace/src/ git clone https://github.com/cogniteam/mr_teleoperator.git cd ../path_to/your_catkin_workspace/ catkin_make
and don't forget to source the setup file: (in the root of your catkin workspace)
source devel/setup.bash
Connection
- Connect the controller (Xbox/PS) to USB port on your computer.
- Check to see on which port the controller has connected:
ls /dev/input
- It should be either js1 or js0 (just reconnect it and you'll see a difference, see picture below).
Edit the corresponding parameter on the teleoperator.launch file as needed.
... <param name="dev" value="/dev/input/js0" /> ...
(See mr_tools package for more details on the teleoperator.launch file)
View Data
- In the root of your catkin workspace, make sure you have sourced the setup file:
cd ../path_to/your_catkin_workspace/ source devel/setup.bash
- Run the mr_tools node (this will also automatically launch rqt):
roslaunch mr_tools teleoperator.launch
Inside the newly opened rqt window, in the menu bar select Plugins->Multi-Robot teleoperator.
- Select an input method (joystick, keyboard or mouse) in the first drop-down list, the desired robot in the second drop-down and press "Add".
- Use rostopic echo to view the message data:
rostopic echo /pioneer_(number_you_chose)/cmd_vel
- Use the controllers' joystick and watch the values change accordingly.
Usage Example
For this example section, make sure to give this gazebo tutorial a look, also check out and install this simulator example package:
cd ../path_to/your_catkin_workspace/src/ git clone https://github.com/cogniteam/mrm_sim.git cd ../path_to/your_catkin_workspace/ catkin_make
roslaunch mr_tools teleoperator.launch
and in a new terminal:
roslaunch mrm_sim mrm.launch
A better teleoperator
With a combination of another rqt plugin - http://wiki.ros.org/rqt_image_view, you can make a much more useful and comfortable teleoperator panel.