This was developed for ROS1. For integration with ROS2, use this updated version: https://github.com/jbennet-t/keyboard_control2
This is a basic keyboard teleoperation/control module built for ROS Noetic. Interfaces with Twist in ROS, and publishes to /cmd_vel for simple robot control.
- cd to the src folder in your catkin workspace, and clone this repository there (assuming you have ros and git installed)
git clone https://github.com/jbennet-t/keyboard_control.git
- Install the python getch module:
pip3 install getch
- In the first terminal tab, run
roscore
- In a new tab, source
devel/setup.bash
- cd to
/opt/ros/noetic/share/stage_ros
or wherever stage_ros is installed for your ROS version - Run
rosrun stage_ros stageros $(rospack find stage_ros)/world/willow-erratic.world
- A window with the sim running should appear
- In a new tab, source
devel/setup.bash
- roscd to wherever you cloned the repository (
.../src/keyboard_control
) - Run the program:
rosrun keyboard_control keyboard_input.py
Note: you may have to install pip3 and if it is not already part of your python install
- pip install: https://pip.pypa.io/en/stable/installing/