#################################### ##FILL ME IN #################################### ## links to any required tutorials ## note.0= [[ps3joy/Tutorials/PairingJoystickAndBluetoothDongle|How to Pair the PS3 Joystick with a Bluetooth Dongle]] ## descriptive title for the tutorial ## title = Writing a Teleoperation Node for the PS3 Joystick ## multi-line description to be displayed in search ## description = This tutorial covers how to write a teleoperation node and use it to drive the turtle in the [[turtlesim]]. ## the next tutorial description (optional) ## next = ## links to next tutorial (optional) ## next.0.link= ## next.1.link= ## what level user is this tutorial for ## level= BeginnerCategory ## keywords = teleoperation, joystick, PS3 #################################### <> <> <> === Create a Scratch Package === Before starting this tutorial, take the time to create a scratch package to work in and manipulate the example code. See [[ROS/Tutorials/CreatingPackage|creating a ROS package]] to learn more about creating a package. In the tutorials folder, create a package called learning_ps3joy, with dependencies on roscpp, turtlesim and ps3joy: {{{ $ roscd tutorials $ roscreate-pkg learning_ps3joy roscpp turtlesim ps3joy }}} Uncomment the rosbuild_genmsg() line in the CMakeLists.txt file of the learning_ps3joy package and run [[rosmake]]. === Writing a Simple Teleoperation Node === First, create learning_ps3joy/src/turtle_teleop_ps3joy.cpp in your favorite editor, and place the following inside it: <> === Compiling and Running Turtle Teleop === Add the following line to your CMakeLists.txt file: {{{ rosbuild_add_executable(turtle_teleop_ps3joy src/turtle_teleop_ps3joy.cpp) }}} Run [[rosmake]] on your package. === Setting up the PS3 Joystick === Before we can run the joystick and teleop together we need to make the joystick accessible. Connect your PS3 joystick as we did in the [[ps3joy/Tutorials/PairingJoystickAndBluetoothDongle|previous tutorial]]. {{{ $ sudo bash $ rosrun ps3joy ps3joy.py }}} Now list the permissions of the joystick: {{{ $ ls -l /dev/input/js0 }}} You will see something similar to: . {{{ crw-rw-XX- 1 root dialout 188, 0 2009-08-14 12:04 /dev/input/js0 }}} If XX is rw: the js device is configured properly. If XX is --: the js device is not configured properly and you need to: {{{ $ sudo chmod a+rw /dev/input/js0 }}} === Writing a Launch File to Start all of the Nodes === Now let's make a launch file to start all of the nodes we need to start: create the file launch/turtle_ps3joy.launch and paste the following into it: <> Use the left joystick of the PS3 controller to drive. ## AUTOGENERATED DO NOT DELETE ## TutorialCategory ## TutorialTurtlesim ## JoyStickDriverCategory