The simulated vehicle can be controlled using your own control code by publishing commands to the /uav/input/rateThrust
or /uav/input/motorspeed
ROS Topics. It is also possible to fly under manual control, using a regular QWERTY keyboard or a game controller. FlightGoggles uses the universal_teleop package to publish the manual inputs to the /uav/input/rateThrust
topic.
Default Controls
An example launch file for manual flight control is included and can be called using the following command:
roslaunch flightgoggles teleopExample.launch
Keyboard
To use a keyboard for operation, the keyboard controller window (see figure below) must be focused.
Hold down spacebar
to enable keyboard control. Similar to a Mode 2 RC Controller, left hand ASDW
keys control thrust and yaw rate, and right hand JKLI
keys control roll and pitch rate.
Game Controller
When using a game controller, the joystick mode switch should be in mode D
. To enable joystick control, hold down LT
. Similar to Mode 2 RC Controllers, the left joystick controls thrust and yaw rate, and the right joystick controls roll and pitch rate.
We tested this set-up using a Logitech Gamepad F310. Other game pads can work, but you may have to remap the buttons and pots in the universal_teleop configuration.
Taking Off
In order to start the dynamics simulation, the vehicle must be armed by publishing an empty message (i.e., std_msgs/Empty
) to the topic /uav/input/arm
. This can, for example, be done from a terminal using the command:
rostopic pub /uav/input/arm std_msgs/Empty
You can reset the dynamics to their initial state by publishing an empty message std_msgs/Empty
to the topic /uav/input/reset
, e.g. from a terminal using the command:
rostopic pub /uav/input/reset std_msgs/Empty
Collisions reset the simulator to its initial condition. The vehicle must be armed again in order to resume flight after a reset. To fly around without colliders enabled for the purpose of exploring the environment, colliders can be disabled by setting ignore_collisions
to true in the launch file or by passing it as an argument when launching, as follows:
roslaunch flightgoggles teleopExample.launch ignore_collisions:=1