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.
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.
First, press alt+TAB until rc_keyboard
window is focused. Once focused, pressing the following keys will result in these commands:
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)
auto_arm
: (bool, false) if true,
F
(channel 2, throttle)z
(channel 3, yaw) <-- in case ARM_CHANNEL
is not setaux1
(channel 4, RC override)aux2
(channel 5, arm toggle)/status
reports armed: true
, after which publish low on aux1
(RC override) and neutral to z
(yaw)auto_takeoff
: (bool, false) if true AND auto_arm
is true,
F
(channel 2, throttle) after successful armThe node waits for an incoming message on the /version
topic before publishing anything.