This ros package allow to drive a robot through a /cmd_vel topic using keyboard keys.
As default the command can be given only if the mouse focus is on the terminal where the program is launched; but if you want to send commands without any needs to be focused on the teleop terminal, i.e., you want to use the commands directly on simulation or anywhere else, you can set the terminal_focus
parameter to false
. ATTENTION! this operation is risky, especially if you are using a real robot!!
To use this package install the following dependences
pip install pynput
sudo apt install xdotool
change the config/keyboard_teleop.yaml
file to set the following parameters based on your robot specs:
- twist velocity command topic (cmd_vel_topic_name)
- father frame id (cmd_vel_father_frame_id)
- max linear velocity (max_lin_vel)
- max angular velocity (max_ang_vel)
- send commands only if the mouse focus is on the teleop terminal (terminal_focus)
roslaunch keyboard_teleop keyboard_teleop.launch config_name:=YOUR_CONFIG_NAME_WITHOUT_YAML_FILE_EXTENSION