# EMU VH6B IO Handler fault definitions
# Highly Confidential and Proprietary Zoox Information. Copyright (c) Zoox.

component: IoHandler
source_enum: kEmuIoHandler
namespace: zoox
proto_imports:
  - "vehicle/common/proto/emu_diagnostics.proto"
faults:
  - id: 0
    name: CpuTempInvalid
    severity: WARNING
    description: CPU temperature is invalid.
  - id: 1
    name: CpuOverTemp
    severity: ERROR
    description: CPU temperature is higher than the maximum allowed temperature.
    reaction:
      trajectory: NoGo
  - id: 2
    name: CpuUnderTemp
    severity: ERROR
    description: CPU temperature is lower than the minimum allowed temperature.
    reaction:
      trajectory: NoGo
  - id: 3
    name: PrimaryGpsStale
    severity: WARNING
    description: Primary GPS driver was not updated in the last tick.
    troubleshooting_steps: Move to a location with better signal, check antenna connection.
  - id: 4
    name: SecondaryGpsStale
    severity: WARNING
    description: Secondary GPS driver was not updated in the last tick.
    troubleshooting_steps: Move to a location with better signal, check antenna connection.
  - id: 5
    name: PrimaryGpsNoLock
    severity: WARNING
    description: Primary GPS module does not have a valid connection.
    troubleshooting_steps: Move to a location with better signal, check antenna connection.
  - id: 6
    name: SecondaryGpsNoLock
    severity: WARNING
    description: Secondary GPS module does not have a valid connection.
    troubleshooting_steps: Move to a location with better signal, check antenna connection.
  - id: 7
    name: TimeNotReady
    severity: ERROR
    description: EMU system time and PTP time have not been synced to GPS time since boot. Timestamps will be incorrect; PTP will not start until a recent time is set.
    troubleshooting_steps: |
      Try each of the following:\
      a) Move to a location with better signal, check antenna connection.\
      b) Connect PCU to internet to sync time from NTP.\
      c) Run `echo 'date $(date '+%m%d%I%M%Y.%S')' | ssh -t root@emu` from another machine connected to the EMU that has a valid local time.\
      You can verify this error by running `date` on the EMU to see if it has a recent date set.
    reaction:
      allowed_missions: ManualOperations
    latching: false
  - id: 8
    name: SystemTimeFreeRunning
    severity: WARNING
    description: EMU system time is currently free-running (not synced to GPS time).
    troubleshooting_steps: Move to a location with better signal, check antenna connection.
    freeze_frame: zoox.common.proto.IoHandlerSystemTimeFF
  - id: 9
    name: PtpTimeFreeRunning
    severity: WARNING
    description: PTP time is currently free-running (not synced to GPS time).
    troubleshooting_steps: Move to a location with better signal, check antenna connection.
    freeze_frame: zoox.common.proto.IoHandlerEthMacTimeFF
  - id: 10
    name: SystemTimeSyncFailed
    severity: WARNING
    description: Unable to synchronize EMU system clock with GPS time.
    freeze_frame: zoox.common.proto.IoHandlerSystemTimeFF
  - id: 11
    name: SystemTimeOffset
    severity: WARNING
    description: EMU system time has a large offset (>50 ms) from GPS time. This is normal at boot, but should converge over time.
    freeze_frame: zoox.common.proto.IoHandlerSystemTimeFF
  - id: 12
    name: SystemTimeJitter
    severity: WARNING
    description: EMU system time correction has large variance from tick to tick (>50 us). May cause sensor calibration issues and/or NoGos.
    freeze_frame: zoox.common.proto.IoHandlerSystemTimeFF
  - id: 13
    name: PtpTimeSyncFailed
    severity: WARNING
    description: Unable to synchronize Ethernet MAC clock with PTP time.
    freeze_frame: zoox.common.proto.IoHandlerEthMacTimeFF
  - id: 14
    name: PtpTimeOffset
    severity: WARNING
    description: PTP time has a large offset (>50 ms) from GPS time. This is normal at boot, but should converge over time.
    freeze_frame: zoox.common.proto.IoHandlerEthMacTimeFF
  - id: 15
    name: PtpTimeJitter
    severity: WARNING
    description: PTP time correction has large variance from tick to tick (>50 us). May cause sensor calibration issues and/or NoGos.
    freeze_frame: zoox.common.proto.IoHandlerEthMacTimeFF
  - id: 16
    name: SystemToPtpTimeOffsetTooLarge
    severity: ERROR
    description: The EMU system clock and Ethernet MAC clock delta is larger than expected (>1 ms).
    freeze_frame: zoox.common.proto.IoHandlerTimeManagerFF
    troubleshooting_steps: Attempt to resolve by power-cycling the EMU
    reaction:
      trajectory: NoGo
    latching: false
  - id: 17
    name: SystemTimeNotReady
    severity: ERROR
    description: The EMU system clock has not been set yet.
    troubleshooting_steps: Wait ~1-2 minutes. If the system clock has not been set by then, contact Firmware
    reaction:
      allowed_missions: ManualOperations
    latching: false
