component: MofoDiagnostic
proto_imports:
  - vehicle/mofo_gateway/diagnostics/mofo_diagnostics.proto
  - base/diag/monitors/stale/messages.proto
  - base/diag/monitors/timing/messages.proto
  - vehicle/localization/diagnostics/missing_data_freeze_frame.proto
metric: MofoMetric
namespace: zoox::mofo
faults:
  - id: 1
    name: HardwareUnresponsive
    severity: ERROR
    description: MoFo hardware is unresponsive over the network
    triggers_nogo: true
  - id: 2
    name: ImuRateTooLow
    severity: WARNING
    description: IMU measurement rate below acceptable threshold
    # The fault GpsRateTooLow was renamed to PrimaryGpsRateTooLow. In older
    # logs, this fault although now named primary, could represent low data
    # rate on _either_ the primary or secondary GPS data streams. After renamed,
    # this fault will only represent the primary GPS. See
    # `SecondaryGpsRateTooLow` for the secondary GPS data stream fault.
  - id: 3
    name: PrimaryGpsRateTooLow
    severity: WARNING
    description: >
      Primary GPS measurement rate is below the acceptable threshold. This may
      occur in sky-view occluded areas if the reciever is unable to consistently
      form a position and/or time solution. Also a failed or congested network
      may attribute to data loss, and thus causing measurements to be lost in
      transit to the gateway.
  - id: 4
    name: OdometryRateTooLow
    severity: WARNING
    description: Wheel-odom measurement rate below acceptable threshold
  - id: 5
    name: FilterUninitialized
    severity: ERROR
    description: Sliding-window filter is uninitialized
    triggers_nogo: true
  - id: 6
    name: SolverTookTooLong
    severity: WARNING
    description: Solver took too long
  - id: 7
    name: RMSTooHigh
    severity: WARNING
    description: RMS uncertainty is above acceptable threshold
  - id: 8
    name: VersionMismatch
    severity: WARNING
    description: Wrong MoFo version
  - id: 9
    name: GPSResidualTooHigh
    severity: WARNING
    description: Difference between the filter state and the GPS measurement is too high.
  - id: 10
    name: PressureOutOfRange
    severity: WARNING
    description: Pressure measurement is out of range.
  - id: 11
    name: TemperatureOutOfRange
    severity: WARNING
    description: Temperature measurement is out of range.
  - id: 12
    name: NoGPSFix
    severity: WARNING
    description: The GPS receiver has not had a position fix for a while. This can results in some instability in the smooth pose. Make sure the vehicle has a clear view of the sky.
  - id: 13
    name: SocketReadTimeout
    severity: WARNING
    description: MoFo communications socket timed out during read().  May indicate a networking issue.
  - id: 14
    name: SocketReadError
    severity: WARNING
    description: MoFo communications socket produced an error during read().
  - id: 15
    name: OdometryIntervalLow
    severity: WARNING
    description: Odometry interval is too low
    freeze_frame: zoox.diag.IntervalFreezeFrame
  - id: 16
    name: OdometryIntervalHigh
    severity: WARNING
    description: Odometry interval is too high
    freeze_frame: zoox.diag.IntervalFreezeFrame
  - id: 17
    name: OdometryFrequencyLow
    severity: WARNING
    description: Odometry frequency is too low
    freeze_frame: zoox.diag.FrequencyFreezeFrame
  - id: 18
    name: OdometryFrequencyHigh
    severity: WARNING
    description: Odometry frequency is too high
    freeze_frame: zoox.diag.FrequencyFreezeFrame
  - id: 19
    name: OdometryStale
    severity: WARNING
    description: Odometry has gone stale
    freeze_frame: zoox.diag.StaleFreezeFrame
  - id: 20
    name: EncoderRateTooLow
    severity: WARNING
    description: Wheel encoder measurement rate below acceptable threshold
  - id: 21
    # The PoseInvalid fault is in vehicle/planner/diagnostics/hero_state_faults.yaml
    # This one was introduced for a brief period of time while experimenting
    # with publishing the hero state directly from the inertial pose component,
    # Kept here because we have a small number of logs that have this fault set.
    name: PoseInvalid
    severity: ERROR
    description: >
      An inconsistency between the pose and the localization system has been
      detected.  Autonomous will not be possible until the localizer node is
      restarted.  If you are not in autonomous mode, this error is not critical,
      however, it should be reported to the CLAMS team. Potential causes are
      vehicle uncalibrated, pose system error, localizer error, localizer map
      error or network problems.
    triggers_nogo: true
    deprecated: true
  - id: 22
    name: WheelVelocityScaleLarge
    severity: INFO
    description: The wheel velocity scale factor deviation from the nominal value of 1 is large
    freeze_frame: zoox.mofo.WheelVelocityScaleDivergence
  - id: 23
    name: WheelVelocityScaleTooLarge
    severity: ERROR
    description: The wheel velocity scale factor deviation from the nominal value of 1 is too large
    freeze_frame: zoox.mofo.WheelVelocityScaleDivergence
    triggers_nogo: true
  - id: 24
    name: StatusMIA
    severity: WARNING
    description: The MoFo status message has not been published recently
  - id: 25
    name: ImuDataMissing
    severity: ERROR
    description: Imu data missing. Check for errors under Drivers/MofoGateway. This is unrecoverable, restart Pose, Localizer, Perception, Planner, etc...
    freeze_frame: zoox.localization.MissingDataFreezeFrame
    triggers_nogo: true
  - id: 26
    name: WheelSpeedDataMissing
    severity: WARNING
    description: Wheel speed data is missing. This is likely an issue with the firmware or the network switch. Also check for other diagnostics in the Drivers section.
    freeze_frame: zoox.localization.MissingDataFreezeFrame
  - id: 27
    name: SteeringAnglesDataMissing
    severity: WARNING
    description: Steering angles data is missing. This is likely an issue with the firmware or the network switch. Also check for other diagnostics in the Drivers section.
    freeze_frame: zoox.localization.MissingDataFreezeFrame
  - id: 28
    name: FilterUninitializedImuBiasInit
    severity: ERROR
    description: Pose component is uninitialized because it's waiting for imu bias initialization to complete. Stay stationary.
    triggers_nogo: true
  - id: 29
    name: FilterUninitializedHeadingInit
    severity: ERROR
    description: Pose component is uninitialized because it's waiting for a global heading. Park in a cold start box and wait for cold start to complete (see Localizer diagnostics), or init by driving around the block (legacy init).
    triggers_nogo: true
  - id: 30
    name: GyroBiasLarge
    severity: INFO
    description: The gyro bias vector is large.
    freeze_frame: zoox.mofo.GyroBiasDivergence
  - id: 31
    name: GyroBiasTooLarge
    severity: ERROR
    description: The gyro bias vector is too large.
    freeze_frame: zoox.mofo.GyroBiasDivergence
    triggers_nogo: true
  - id: 32
    name: AccelBiasLarge
    severity: INFO
    description: The accelerometer bias vector is large.
    freeze_frame: zoox.mofo.AccelBiasDivergence
  - id: 33
    name: AccelBiasTooLarge
    severity: ERROR
    description: The accelerometer bias vector is too large.
    freeze_frame: zoox.mofo.AccelBiasDivergence
    triggers_nogo: true
  - id: 34
    name: MapTwistLarge
    severity: INFO
    description: The map twist distortion is large.
    freeze_frame: zoox.mofo.MapTwistDivergence
  - id: 35
    name: MapTwistTooLarge
    severity: ERROR
    description: The map twist distortion is too large.
    freeze_frame: zoox.mofo.MapTwistDivergence
    triggers_nogo: true
  - id: 36
    name: ImuStale
    severity: ERROR
    description: Imu data missing for too long
    triggers_nogo: true
  - id: 37
    name: PrimaryGpsStale
    severity: INFO
    description: >
      One or more primary GPS messages were not received at the expected
      interval of 1Hz. This can be caused by network data loss or if the
      receiver is in a GPS denied environment. Low occurences of this fault is
      benign to vehicle opeations. However, in the event of high re-occurences
      in nominal sky-view conditions, this fault should be investigated. A
      prolonged period of this fault will trigger the 'PrimaryGpsOutage'.
  - id: 38
    name: PrimaryGpsOutage
    severity: ERROR
    description: >
      The primary GPS message has not been seen after a 5 minute period. If
      faulted, Pose operation will also fault if not already initialized, and
      time provided by Chrony will become invalid. This fault can occur if the
      vehicle is in obstructed view of satellites, also check if the
      'SecondaryGpsOutage' is also faulted. Otherwise operators should check
      MoFo health.
    triggers_nogo: true
  - id: 39
    name: SecondaryGpsStale
    severity: INFO
    description: >
      One or more secondary GPS messages were not received at the expected
      interval of 1Hz. This can be caused by network data loss or if the
      receiver is in a GPS denied environment. Low occurences of this fault is
      benign to vehicle opeations. However, in the event of high re-occurences
      in nominal sky conditions, this fault should be investigated. A prolonged
      period of this fault will trigger the 'SecondaryGpsOutage'.
  - id: 40
    name: SecondaryGpsOutage
    severity: INFO
    description: >
      The secondary GPS message has not been seen after a 5 minute period. This
      fault can occur if the vehicle is in obstructed view of satellites, also
      check if the 'PrimaryGpsOutage' if also faulted. Otherwise operators
      should check MoFo health. There is no operational impact to the vehicle
      unless 'PrimaryGpsOutage' is also faulted.
  - id: 41
    name: SecondaryGpsRateTooLow
    severity: WARNING
    description: >
      Secondary GPS measurement rate is below the acceptable threshold. This may
      occur in sky-view occluded areas if the reciever is unable to consistently
      form a position and/or time solution. Also a failed or congested network
      may attribute to data loss, and thus causing measurements to be lost in
      transit to the gateway.
  - id: 42
    name: LidarLocalizerResidualLarge
    severity: INFO
    description: The lidar localizer residual is large.
    freeze_frame: zoox.mofo.LidarLocalizerResidualDivergence
  - id: 43
    name: LidarLocalizerResidualTooLarge
    severity: INFO
    description: The lidar localizer residual is too large.
    freeze_frame: zoox.mofo.LidarLocalizerResidualDivergence
  - id: 44
    name: ImuResidualLarge
    severity: INFO
    description: The IMU residual is large.
    freeze_frame: zoox.mofo.ImuResidualDivergence
  - id: 45
    name: ImuResidualTooLarge
    severity: INFO
    description: The IMU residual is too large.
    freeze_frame: zoox.mofo.ImuResidualDivergence
