rosflight / rosflight_joy

A simple collection of joystick helper nodes for use with the rosflight stack
4 stars 6 forks source link

rosflight_joy

These nodes use pygame to directly access the joysticks with python, and automatically detects the joystick type and mappings. You'll need to install pygame to get them working

pip install pygame

Or whatever environment you're using.

There is a rosflight_joy_base class which does the auto-detection. The other nodes create objects which inherit from this base class, but change the way the inputs are interpreted and which message is ultimately sent out. Just change which node you are running to change modes.

rc_keyboard node

Another node is provided called rc_keyboard which mimics the functionality of a joystick device through pressing keys on a keyboard. It is intended to be a convenience node for those using the rosflight_joy package in simulation. It provides some basic functionality, but only allows for very coarse control - as one would expect when flying using keyboard presses.

User instructions

First, press alt+TAB until rc_keyboard window is focused. Once focused, pressing the following keys will result in these commands:

Automatic arm and takeoff

rc_keyboard can optionally arm the aircraft automatically, as well as shift to full throttle after arming to allow for autonomous navigation to take over.

This node assumes that the RC channels are set to: [ROLL, PITCH, THROTTLE, YAW, RC_OVERRIDE, ARM (or none), none, none]. i.e., it assumes that the ROSflight parameters RC_ATT_OVRD_CHN and RC_THR_OVRD_CHN are set to channel 4, and ARM_CHANNEL is set to channel 5 (although this last one is optional). Note that the channel number is zero-indexed.

The node listens for the following ROS parameters:

Format: param_name: (type, default value) Description of what is published to /RC topic, where low = -1 (min value), high = 1 (max value), and neutral = 0 (middle value)

The node waits for an incoming message on the /version topic before publishing anything.