Joystick/Gamepad

This article explains how you can control your vehicle with a Joystick or Gamepad using the Mission Planner which sends “RC Override” messages to the vehicle.

Other GCSs may also support “RC overrides” but they are not covered in this article.

../_images/joystick_LogitechF310.jpg

Logitech F310 Joystick

Tip

Even if flying with a joystick, you should keep a regular transmitter/receiver connected and ready for use as a backup. In future versions of ArduPilot, after more failsafe testing has been completed this recommendation may change.

What you will need

You will need the following equipment:

  • USB joystick or Gamepad such as the Logitech F310 (shown above).

  • A telemetry connection between your ground station and vehicle.

  • A laptop computer running Mission Planner.

Calibration

First you must calibrate the joystick using the Windows joystick/game controller wizard.

../_images/joystick.jpg

Setup with the Mission Planner

  • Connect your USB joystick/gamepad to the laptop computer

  • Open the Mission Planner Flight Data screen. On the Actions tab push the Joystick button

    ../_images/joystick_MPSetup.png
  • Ensure the Logitech joystick appears in the drop-down

  • The Enable button, once pushed, will tell the mission planner to start sending commands to the vehicle so for the initial setup do not push it.

  • On the “Roll” row, click the Auto Detect button and then waggle the control you wish to use for roll, left and right.

  • The channel can be reversed with the Reverse checkbox

  • The Expo number should be in the range of -100 to 100

    • 0 = no expo

    • 100 = low response around the middle, very fast response at the edges

    • -100 = very fast response around the middle, less response at the edges (very few people use negative expo)

  • Repeat for Pitch, Throttle and Rudder and push the Save button

  • You will likely want to set-up other buttons for Arm and Disarm

  • Instead of setting up a stick or button for ch5 (the flight mode channel), it is better to set individual buttons to initiate a flight mode by selecting Change Mode and then push the Settings button and select the flight mode from the drop-down (see pic above)

  • When done, push the Save button. This records the min and max calibrations and records the neutral positions of the joystick for the trim value. Mission Planner will then scale the joystick signal to the RC channel’s RCx_MIN/MAX/TRIM parameters in the autopilot when sending RC override commands by the Joystick.

  • In the CONFIG/TUNING | Full Parameter List, check that the SYSID_MYGCS parameter matches the system ID of your GCS. This parameter limits which GCS can send override signals to the vehicle.

    Tip

    For Mission Planner the default GCS system ID is 255. The

    default system ID for APM Mission Planner 2 is 252 (but the GCS will automatically set its ID to match SYSID_MYGCS for RC Override commands).

Note

If you get an error PreArm: RC not calibrated (following calibration) you will additionally need to manually change RC1_MIN to 1101 and RC1_MAX to 1901 (and then repeat for RC2_, RC3_ and RC4_ max/min parameters).

This error is caused because Mission Planner maps the Joystick exactly to the RC min and max range, but the pre-arm checks assume that if the values are not at least 1 PWM us off the default value, that calibration has not been done. If you have RC calibrated your transmitter/receiver system already, this will not be necessary. DO NOT RC CALIBRATE THE JOYSTICK, it is not the same control mechanism as is used for RC systems. It uses MAVLink override messages.

Testing the controls before flying

Before flying for the first time you should test that all features work well.

To check the above controls move in the correct direction:

  • Click the Enable button on the Joystick setup screen to enable sending messages to the vehicle

  • Connect your autopilot to the computer with a USB cable

  • Push the Mission Planner’s Connect button

  • Go to the Initial Setup | Mandatory Hardware | Radio Calibration screen and ensure the green bars all move in the correct direction. Remember the bars move in the same direction as the sticks except for Pitch which moves in the opposite direction.

  • If any controls are reversed, check the Reverse checkbox on the Joystick setup screen.

Next test you are able to arm, disarm and switch into the various flight modes (not need to connect the battery)

Testing the failsafes

All of these tests should be performed on the ground with the battery disconnected or at least with the propellers off the vehicle.

Simulate disabling the joystick in flight with transmitter off (i.e. no failover to regular transmitter):

  1. Turn regular transmitter off

  2. Connect with the mission planner, push Joystick window’s Enable button and ensure RC overrides are being sent to the vehicle. (use Radio Calibration screen or Flight Data’s status screen)

  3. Arm vehicle, switch to Stabilize or Loiter mode and raise the throttle

  4. Ensure the motors are spinning by checking the Flight Data screen’s “ch1out” ~ “ch4out”

  5. Push Joystick screen’s Disable button

  6. “Failsafe” should appear on the HUD and the vehicle should switch to “LAND” or “RTL”

  7. Repeat the above test but at step #5 actually disconnect the joystick from the computer. The results should be the same.

../_images/joystick_FailsafeTesting1.jpg

Simulate failing over to the regular transmitter/receiver

  1. Turn the regular transmitter on and ensure you can control the vehicle (perhaps by checking the Radio calibration page or the Flight Data screen’s Status tab’s “ch1in” ~ “ch8in”).

  2. With the regular transmitter leave the vehicle in AltHold mode and raise the throttle to mid

  3. On the Joystick screen push the Enable button

  4. Arm the vehicle in STABILIZE mode and raise throttle to full (with the Joystick).

  5. Check the throttle is at full in the Flight Data screen’s Status tab by checking “ch3in” is very high (around 1900 usually)

  6. On the Joystick screen push the Disable button and check the “ch3in” has dropped to a mid value (around 1500)

  7. The vehicle should remain in its current flight mode (Stabilize) but controls have been returned to the transmitter. The pilot’s inputs should be reflected in the “ch1in” ~ “ch8in” values. Switch the vehicle to AltHold mode by moving the flight mode switch.

Simulate loss of radio contact:

If radio contact is lost, the vehicle should respond as if the Joystick was “Disabled” or disconnected from the PC. You can test this by repeating the test above but instead of pushing the Disable button on the Joystick screen, disconnect the radio. In order to see the status of the vehicle you will need to connect two Mission Planner’s separately (only possible on Pixhawk). The Mission Planner with the Joystick should be connected through telemetry and the 2nd Mission Planner should be connected through a USB connection.

Reducing lag in the controls

It is nearly impossible to make the Joystick as responsive as a regular transmitter but lag can be reduced by:

  • Reducing the rate of other telemetry data being sent between the vehicle and GCS from the MP’s Config/Tuning | Planner page

    ../_images/joystick_ReduceLag_MPRates.png
  • If using a SiK Radio or RFD900 Radio these can be put into Low Latency mode as described here.