# VH6 Autonomous Engagement/Disengagement Causes
# Highly Confidential and Proprietary Zoox Information. Copyright (c) Zoox.
component: Autonomy
source_enum: kEmuAutonomy
namespace: zoox
proto_imports:
  - "vehicle/common/proto/emu_diagnostics.proto"
can_messages:
  - status_msg: EMU_autonomyStatus
    log_msg: EMU_autonomyLog
can_import: firmware/common/can/generated/vh6/emu.h
can_namespace: vh6
faults:
  # Autonomy Gates
  - id: 0
    name: NoAutonomyAllowedFromDriveState
    severity: ERROR
    latching: false
    reaction:
      allowed_missions: ManualOperations
    description: The current DriveManager state does not allow a transition to autonomy.
    troubleshooting_steps: Transition to DriveStateManual or DriveStateRemote.
  - id: 1
    name: EmuTrackerNotReady
    severity: ERROR
    latching: false
    reaction:
      allowed_missions: ManualOperations
    description: Tracker source is EMU and SmootherState is not in AUTONOMOUS_READY or AUTONOMOUS.
  - id: 2
    name: PcuTrackerNotReady
    severity: ERROR
    latching: false
    reaction:
      allowed_missions: ManualOperations
    description: Tracker source is PCU and TrackerState is not AVAILABLE or AUTONOMOUS.
  - id: 3
    name: NoMdiForAutonomousMode
    severity: ERROR
    latching: false
    reaction:
      allowed_missions: ManualOperations
    description: If desired autonomous mode is not Full, there must be an MDI installed.
    troubleshooting_steps: Request Full Autonomous mode or install an MDI
  - id: 4
    name: NoNorthMdiForNorthDriveDir
    severity: ERROR
    latching: false
    reaction:
      allowed_missions: ManualOperations
    description: Requested drive direction was North but there is no North-facing MDI.
    troubleshooting_steps: Have AI request South drive direction or install a North-facing MDI.
  - id: 5
    name: NoSouthMdiForSouthDriveDir
    severity: ERROR
    latching: false
    reaction:
      allowed_missions: ManualOperations
    description: Requested drive direction was South but there is no South-facing MDI.
    troubleshooting_steps: Have AI request North drive direction or install a South-facing MDI.
  - id: 6
    name: NorthEpasNotCalibrated
    severity: ERROR
    latching: false
    reaction:
      allowed_missions: ManualOperations
    description: North EPAS must be calibrated.
    troubleshooting_steps: Run a steering calibration.
  - id: 7
    name: SouthEpasNotCalibrated
    severity: ERROR
    latching: false
    reaction:
      allowed_missions: ManualOperations
    description: South EPAS must be calibrated.
    troubleshooting_steps: Run a steering calibration.
  - id: 8
    name: MdiTakeover
    severity: ERROR
    latching: false
    reaction:
      allowed_missions: ManualOperations
    description: User is taking control using the MDI pedals or steering wheel.
  - id: 9
    name: EmuTrackerValidityTimeout
    severity: ERROR
    latching: false
    reaction:
      allowed_missions: ManualOperations
    description: EMU tracker did not switch to an Autonomous State within the timeout.
  - id: 10
    name: DriveGearMismatchWhileMoving
    severity: ERROR
    latching: false
    reaction:
      allowed_missions: ManualOperations
    description: Mismatch between commanded and actual drive gear while hero is not stationary.
  - id: 11
    name: DriveDirMismatchWhileMoving
    severity: ERROR
    latching: false
    reaction:
      allowed_missions: ManualOperations
    description: Mismatch between commanded and actual drive direction while hero is not stationary.
  # @todo @jira{FW-11700} Refine fault reactions for disengagements
  - id: 12
    name: CommandedVelocityExceedsOddLimits
    severity: ERROR
    latching: false
    reaction:
      allowed_missions: ManualOperations
    description: Commanded velocity exceeds max velocity allowed in current ODD.
  - id: 13
    name: TrackerNotInAutonomousMode
    severity: ERROR
    latching: false
    reaction:
      allowed_missions: ManualOperations
    description: AutonomousMode from tracker is None or unknown.
  - id: 14
    name: TrackerChangedSourceWhileRunning
    severity: ERROR
    latching: false
    reaction:
      allowed_missions: ManualOperations
    description: Tracker changed its source (PCU vs EMU vs Pseudoplanner) while currently in Autonomous.
  - id: 15
    name: TrackerChangedAutonomousModeWhileRunning
    severity: ERROR
    latching: false
    reaction:
      allowed_missions: ManualOperations
    description: Tracker changed its AutonomousMode (Lateral vs Longitudinal vs Full) while currently in Autonomous.
  - id: 16
    name: DriveManagerFault
    severity: WARNING
    latching: false
    description: DriveManager reports a fault that requires stopping.
    troubleshooting_steps: Inspect DriveManager alerts for fault cause.
  - id: 17
    name: ActiveMdiFault
    severity: WARNING
    latching: false
    description: The active MDI reports a fault.
    troubleshooting_steps: Inspect ManualControl diagnostics for fault cause.
  - id: 18
    name: AiReferenceStaleEmuTracker
    severity: ERROR
    latching: false
    description: The AI reference IPC data from the EMU tracker is stale.
    reaction:
      allowed_missions: ManualOperations
  - id: 19
    name: MeasuredVelocityExceedsOddLimits
    severity: ERROR
    latching: false
    reaction:
      allowed_missions: ManualOperations
    description: Measured velocity exceeds max velocity allowed in current ODD.
  - id: 20
    name: NoAutonomyRequest
    severity: INFO
    description: PCAN GUI is not requesting AI, or Remote is not requesting AI (if in Remote)
    troubleshooting_steps: Press the AI button on the PCAN GUI, and the Remote (if in Remote)
  - id: 21
    name: AiCommandStale
    severity: ERROR
    latching: false
    reaction:
      allowed_missions: ManualOperations
    description: AI command is stale
    troubleshooting_steps: Ensure tracker or pseudoplanner is running and engaged.
  - id: 22
    name: DoorsOpenInAutonomous
    severity: WARNING
    latching: false
    description: Doors are open while in Autonomous with the autonomous door check param enabled. Longitudinal control is disabled.
    troubleshooting_steps: Close the vehicle's doors, or update the `disable_door_check_autonomous_drive` param in the drive params to `true`.
    freeze_frame: zoox.common.proto.DoorStateFF
  - id: 23
    name: SteeringNotCentered
    severity: ERROR
    latching: false
    reaction:
      allowed_missions: ManualOperations
    description: The steering racks are not currently centered. Transitioning to Autonomous is not allowed.
    troubleshooting_steps: Ensure steering is being commanded to center before attempting to enter Autonomous.
    freeze_frame: zoox.common.proto.SteeringNotCenteredFF
