Skip to content

Setup virtual keyboard joystick

Pavel Vechersky edited this page Jul 11, 2017 · 4 revisions

In order to create a virtual keyboard joystick we utilize the Python-uinput package (https://github.com/devbharat/python-uinput).

Install Python-uinput

Note: the source repository is only needed temporarily so it can be cloned anywhere

git clone git@github.com:devbharat/python-uinput.git
cd python-uinput
python setup.py build
sudo python setup.py install

You must have the uinput kernel module loaded to use Python-uinput. To load the module, run:

modprobe -i uinput

Configure device permissions

Next, we need to allow programs access to the uinput device:

cd udev-rules
sudo cp 40-uinput.rules /etc/udev/rules.d

You might have to restart the machine for the new permissions to take effect.

If this alone does not solve the permissions issue you might have to add your user account to the uinput group:

sudo addgroup uinput
sudo adduser $USER uinput

Once again, restart the machine for the new permissions to take effect.

To test if everything is working properly, run the command below and verify that the virtual keyboard joystick GUI is running, with bars for throttle/roll/pitch/yaw, and responds to keyboard strokes when active:

rosrun rotors_joy_interface key_joystick.py

Once everything is working properly, the cloned Python-uinput repo can be removed.

Install ROS joystick package

Depending on your ROS configuration, you might have to install the joystick package:

sudo apt-get install ros-kinetic-joy

Where 'kinetic' would be changed to your distribution of ROS if different

Running RotorS with virtual joystick

Once all the components are installed and configured, run the following launch file to use RotorS with the virtual joystick:

roslaunch rotors_gazebo mav_with_keyboard.launch

You might have to un-pause the simulation to be able to fly.