The differential drive plugin of the robot is capable of receiving ROS Twist messages (geometry_msgs/Twist), which consist of the current linear and angular velocities of the robot. The teleoperation of the robot means moving the robot manually using a joy stick or keyboard by using ROS Twist messages. We will now look at how to move the Turtlebot 2 robot using keyboard teleoperation.
We have to install a package to teleoperate the TurtleBot 2 robot. The following command will install the TurtleBot teleoperation package:
$ sudo apt-get install ros-kinetic-turtlebot-teleop
To start teleoperation, we have to start the Gazebo simulator first, and then start the teleoperation node using the following command:
$ roslaunch turtlebot_teleop keyboard_teleop.launch
In the terminal, we can see the key combination for moving the robot. You can move it using those keys, and you will see the robot moving in Gazebo and Rviz, as shown in the following screenshot:
When we press the buttons on the keyboard, it will send a Twist message to the differential drive controller, and the controller will move the robot in the simulation. The teleop node sends a topic called /cmd_vel_mux/input/teleop (geometry_msgs/Twist), which is shown in the following diagram: