-
Notifications
You must be signed in to change notification settings - Fork 770
Setup virtual keyboard joystick
In order to create a virtual keyboard joystick we utilize the Python-uinput package (https://github.com/devbharat/python-uinput).
Note: the source repository is only needed temporarily so it can be cloned anywhere
git clone [email protected]: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
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.
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
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.