Teleoperation allows you to manually control TurtleBot. Keyboard and joystick are the two primary ways to do this. Before we experiment with these two methods, we need to set up TurtleBot to receive our commands.
On TurtleBot run:
Now it’s ready to receive commands from the workstation.
To use the keyboard for teleoperation, run the following on the workstation:
The terminal prints out the keyboard commands for manually controlling TurtleBot’s position, rotation and more.
By default TurtleBot works with Logitech joysticks but there’s a “gotcha” – they use a “deadman” button which must be held down at all times while operating the joystick, otherwise nothing will happen.
Why is there a deadman axis button?
Your joystick may not be perfectly centered when you start the launch file and TurtleBot may start moving slightly if a deadman axis wasn’t enforced.
Updating the Deadman Axis Button
When we first set up the joystick, the default button was #5, which wasn’t ideal for us. It’s possible that your joystick doesn’t even have a button #5, so we needed to change it.
The first thing to figure out is which buttons correspond to which numbers. In a terminal window run:
Note that on the left are the axes and on the right are the buttons. When you press down each button, the corresponding number will change from off to on. Experiment until you find the best button for your joystick; we chose #0, which is the primary trigger button on our joystick.
Now that you’ve selected which button you want to be your deadman axis, let’s make a new custom launch file. Navigate to the folder where logitech.launch is located and make a copy that we can edit by running:
roscd is similar to
cd (change directory) but is configured to automatically find the correct location’s ROS file. This is much more convenient than typing out
In the text editor go to the line immediately after:
and add a new line if the axis_deadman doesn’t exist yet:
This will set our deadman axis to #0 and you should type in your chosen button value. Save and exit the editor.
Open a new terminal window and start teleoperation with our new launch file:
You can see these values on the joystick ROS wiki page.
Teleoperation via joystick in your office, home, etc: