Driving a Robot with a Keyboard
Connect to your robot and log in, following the instructions in Connecting to your robot for the first time. Log in to the robot from an ssh window, as before.
After logging in, the magni_base program will be running under ROS. To verify this, type:
Next, start the keyboard teleop program. In the ssh window, type:
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
This will launch the teleop program in the robot. There will be a screen that shows the commands in a sort of crude graphical way.
Because the robot has a ‘dead man timer’ you must rapidly continue to press keys or the robot will automatically stop as a safety measure. Sometimes users hit the keys too slow and will see the robot do jerky movements but that is the deadman timer kicking in for too slow of a rate of keypresses.
Reading from the keyboard and Publishing to Twist!
The robot will respond to keystrokes as follows:
|j||rotate counter clockwise|
|m||circle backwards left|
|.||circle backwards right|
You can increase or decrease the speed that will be used also from keys on the keyboard but it is often desired to first stop the robot and then when you issue the increase or decrease the robot will not keep moving. You may want to increase speed AS the robot is moving and that is ok as well.
|k||optionally stop the robot|
Running teleop-twist from a workstation
You can also run teleop-twist keyboard from a properly setup ROS workstation that has the Magni robot setup as it’s ROS master. To do this you can connect your configured ROS workstation to the network of the robot (which can be to connect to the robot Access point OR have the robot connect to your wireless network along with your workstation).
Take a look a the first two links about connecting to a network and setting up a ROS workstation Doing More.
Must Have teleop-twist setup on your ROS workstation
Install teleop-twist on your workstation which will be setup to have the robot be the ROS master. The program can be run as discussed above because the
cmd_vel topic will be fed movement commands by the teleop-twist program on your workstation and the robot will then move just as it would if the teleop-twist were run on the robot itself.
sudo apt install ros-kinetic-teleop-twist-keyboard