MAVLINKHUD

Overview

The JS parameter group configures the behavior of a USB Joystick or Gamepad when used as the primary control interface. This is most common in ArduSub (ROV) and some Ground Vehicle setups where a traditional RC transmitter is not used.

The joystick commands are sent from the GCS (Mission Planner/QGC) to the autopilot via MAVLink MANUAL_CONTROL messages.

Key Concepts

1. Gain Control (JS_GAIN_...)

Because joysticks often have shorter travel than RC sticks, or are used in sensitive environments, the system uses a "Gain" to scale the inputs.

  • JS_GAIN_DEFAULT: The multiplier applied to all sticks at startup.
  • JS_GAIN_STEPS: The number of increments used when the pilot uses "Gain Up/Down" buttons on the gamepad.

2. Thrust Scaling (JS_THR_GAIN)

Specific scaling for the throttle/vertical axis, allowing for fine depth control while maintaining high horizontal maneuverability.

Parameter Breakdown

  • JS_GAIN_DEFAULT: Starting gain (e.g., 0.5 = 50% power).
  • JS_GAIN_MAX: Maximum allowable gain.
  • JS_GAIN_MIN: Minimum gain.

Integration Guide

  1. Hardware: Plug a gamepad into your PC running the GCS.
  2. Calibrate: Perform "Joystick Calibration" in the GCS.
  3. Functions: Map gamepad buttons to ArduPilot functions (e.g., Arm, Mode Change, Gripper).
  4. Tuning: Use the gain buttons in-mission to adjust sensitivity based on current conditions (e.g., lower gain for precise work near a structure).

Developer Notes

  • Library: ArduSub (mostly).
  • Logic: Input is received via GCS_MAVLINK::handle_manual_control().

JS_GAIN_DEFAULT

Default 0.5
Range 0.1 1.0

Joystick Default Gain (JS_GAIN_DEFAULT)

Description

JS_GAIN_DEFAULT defines the "Responsiveness" of the vehicle when using a USB joystick (most common in ArduSub ROV applications).

It acts as a master multiplier for all control sticks.

  • 0.5 (Default): 50% sensitivity. Moving the stick all the way only commands 50% power. This is excellent for beginners or precision maneuvering.
  • 1.0: 100% sensitivity. Full stick movement commands full power.

Tuning & Behavior

  • Default: 0.5.
  • Usage: If you find the vehicle is too "twitchy" or difficult to control smoothly at boot, decrease this value. If you always find yourself needing more speed, increase it.
  • Live Adjustment: In ArduSub, this gain is often adjusted in real-time during a dive using buttons on the joystick, but it will revert to this default value when the vehicle is rebooted.

JS_GAIN_MAX

Default 1.0
Range 0.1 1.0

Joystick Maximum Gain (JS_GAIN_MAX)

Description

JS_GAIN_MAX sets the upper boundary for the real-time gain adjustment feature.

In many applications (like ROVs), pilots use joystick buttons to "Turn up" or "Turn down" the sensitivity during a mission. This parameter ensures that even if you click the "Increase Gain" button many times, the sensitivity will never exceed this safe limit.

Tuning & Behavior

  • Default: 1.0 (Allow full 100% sensitivity).
  • Safety: If you find that the vehicle is dangerously fast or unstable at 100% gain, reduce this value to 0.8 or 0.7 to "Cap" the maximum performance.

JS_GAIN_MIN

Default 0.25
Range 0.1 0.8

Joystick Minimum Gain (JS_GAIN_MIN)

Description

JS_GAIN_MIN sets the lower boundary for the real-time gain adjustment feature.

This ensures that even if you click the "Decrease Gain" button many times, the vehicle's sensitivity will never drop so low that it becomes unresponsive. This prevents a pilot from accidentally "Disabling" their controls while trying to slow down for precision work.

Tuning & Behavior

  • Default: 0.25 (Minimum 25% sensitivity).
  • Usage: If you need extremely fine precision (e.g. using a robotic arm on an ROV), you might lower this to 0.1 (10%).

JS_GAIN_STEPS

Steps
Default 4
Range 1 10

Joystick Gain Steps (JS_GAIN_STEPS)

Description

JS_GAIN_STEPS determines how many times you have to click a button to go from JS_GAIN_MIN to JS_GAIN_MAX.

It sets the "Resolution" of the in-flight gain adjustment.

  • Default: 4 steps. (e.g., 25%, 50%, 75%, 100%).
  • Usage: Increase this if you want finer control over your vehicle's speed and responsiveness during a mission.

JS_LIGHTS_STEPS

Steps
Default 8
Range 1 20

Joystick Lights Steps (JS_LIGHTS_STEPS)

Description

JS_LIGHTS_STEPS sets the "Brightness Increments" for ROV external lights.

When you use a joystick button to dim or brighten your underwater lights, this parameter defines how much the brightness changes per click.

JS_THR_GAIN

Default 1.0
Range 0.1 1.0

Joystick Throttle Gain (JS_THR_GAIN)

Description

JS_THR_GAIN allows you to independently scale the throttle sensitivity without affecting the rotation or lateral axes.