MAVLINKHUD

TRAINING Mode (Plane)

Executive Summary

TRAINING Mode is designed to teach a student pilot how to fly manually without the risk of losing control. It behaves exactly like MANUAL mode (direct stick-to-servo connection) as long as the aircraft remains within safe bank and pitch limits. If the student flies too close to the limit, the autopilot intervenes to gently "bounce" the plane back into the safe zone. Unlike FBWA, it does not self-level when you release the sticks.

Hardware Dependency Matrix

Training mode requires full attitude estimation to know when to intervene.

Sensor Requirement Code Implementation Notes
Gyroscope CRITICAL Required for rate stabilization during intervention.
Accelerometer CRITICAL Required to determine bank/pitch angles for the limiter.
GPS NONE Not used.

Control Architecture (Engineer's View)

TRAINING mode implements a Conditional Switch logic.

  1. Safe Zone (Manual Pass-through):
    • Condition: Current_Roll < ROLL_LIMIT AND Current_Pitch < PITCH_LIMIT.
    • Behavior: The pilot's inputs are passed directly to the servos (with Manual Expo applied). The autopilot does nothing.
    • Feel: The plane flies naturally. It will maintain a bank if you leave it there. It will stall if you fly too slow.
  2. Danger Zone (Intervention):
    • Condition: The aircraft exceeds the angle limits.
    • Behavior: The controller overrides the manual pass-through and engages the Stabilize controller.
    • Target: It sets a target angle equal to the limit (e.g., 45 degrees).
    • Effect: If the pilot tries to roll past 45 degrees, the servo fights them to hold 45 degrees. If they release the stick, the plane stays at 45 degrees (or whatever limit was hit).
    • Code Path: ModeTraining::update().

Pilot Interaction

  • Learning: This mode is superior to FBWA for learning aerodynamics because you must use the elevator to maintain altitude in a turn (coordinated flight). In FBWA, the autopilot hides this physics requirement.
  • Limits: You cannot roll upside down or loop.
  • Self-Leveling: NO. If you bank 20 degrees and let go, the plane stays at 20 degrees (unlike Stabilize/FBWA).

Failsafe Logic

  • Sensor Failure: If the AHRS drifts or fails, the "Safe Zone" might actually be upside down. Switch to MANUAL if the plane fights you incorrectly.

Key Parameters

Parameter Default Description
ROLL_LIMIT_DEG 45 Max bank angle before intervention.
PITCH_LIMIT_MAX 20 Max pitch up.
PITCH_LIMIT_MIN -25 Max pitch down.
MAN_EXPO_ROLL 0 Expo applied during the manual phase.

Source Code Reference