component: Loc6Dof
proto_imports:
  - vehicle/localization/diagnostics/loc6dof_diagnostics.proto
  - vehicle/localization/diagnostics/missing_data_freeze_frame.proto
metric: Loc6DofMetric
namespace: zoox::localizer6dof
faults:
  - id: 1
    name: SmoothPoseMissing
    severity: WARNING
    description: Smooth pose data is missing. Check the Pose component.
    freeze_frame: zoox.localization.MissingDataFreezeFrame
  - id: 2
    name: LidarDataMissing
    severity: ERROR
    description: Lidar data is missing. Make sure the lidars are on and not in error mode.
    freeze_frame: zoox.localization.MissingDataFreezeFrame
    deprecated: true
    triggers_nogo: true
  - id: 3
    name: FullSpinMissing
    severity: WARNING
    description: Full spin is missing. This is when the localizer does not receive a full metaspin from the **perception** spin loader. It's usually caused by missing smooth pose data, or missing lidar data (there should be some other faults), and make sure the perception module is running. This could also be triggered if the metaspin could not be formed with enough points (eg. invalid lidar data, or too much occlusion).
    freeze_frame: zoox.localization.MissingDataFreezeFrame
  - id: 4
    name: Uninitialized
    severity: ERROR
    description: Localizer could not initialize. Make sure you are in a cold start box, or keep driving a bit more. Note that this is expected if you are outside of a map area.
    freeze_frame: zoox.localizer6dof.Loc6DofUninitializedFreezeFrame
    deprecated: true
    triggers_nogo: true
  - id: 5
    name: UnableToLocalize
    severity: WARNING
    description: Localizer could not localize. This can be due to missing sensor data (there should be some other faults), or because the hero is outside of the mapped area (or no map, or wrong map). This is only a problem if this lasts for too long, in which case there will be a NOGO.
    freeze_frame: zoox.localizer6dof.Loc6DofUnableToLocalizeFreezeFrame
    deprecated: true

  # Specific errors for when the localizer fails to initialize.
  - id: 6
    name: UninitializedOptixContext
    severity: ERROR
    description: Localizer could not initialize because the optix context could not be created. This is typically because the nvidia_uvm module is not loaded. Try 'sudo modprobe nvidia_uvm' and restart the localizer and file a bug with the INFRA team. If this does not work there may be even more problems with the GPU and Cuda environment.
    freeze_frame: zoox.localizer6dof.Loc6DofUninitializedFreezeFrame
    triggers_nogo: true
  - id: 7
    name: UninitializedMapParam
    severity: ERROR
    description: Localizer could not initialize because the parameter giving the location of the 3D map is missing. This is a bug and is not recoverable.
    freeze_frame: zoox.localizer6dof.Loc6DofUninitializedFreezeFrame
    triggers_nogo: true
  - id: 8
    name: UninitializedTileLoader
    severity: ERROR
    description: Localizer could not initialize because it failed to create the tile loader. This is a bug and is not recoverable.
    freeze_frame: zoox.localizer6dof.Loc6DofUninitializedFreezeFrame
    triggers_nogo: true
  - id: 9
    name: UninitializedListTiles
    severity: ERROR
    description: Localizer could not initialize because it could not find any tile in the map directory. This is a bug and is not recoverable.
    freeze_frame: zoox.localizer6dof.Loc6DofUninitializedFreezeFrame
    triggers_nogo: true
  - id: 10
    name: UninitializedWaitingPose
    severity: ERROR
    description: Localizer could not initialize because it is still waiting for a pose from MoFo. Keep driving.
    freeze_frame: zoox.localizer6dof.Loc6DofUninitializedFreezeFrame
    triggers_nogo: true
    deprecated: true

  # Metaspin warnings
  - id: 11
    name: InsufficentPointsToPopulateMetaspin
    severity: WARNING
    description: Received metaspin with insufficent number of points.
    freeze_frame: zoox.localizer6dof.Loc6DofInsufficientPointsFreezeFrame

  - id: 12
    name: PoseRestarted
    severity: ERROR
    description: the Pose system was restarted. You need to restart the localizer too.
    triggers_nogo: true

  - id: 13
    name: ZrnMissing
    severity: WARNING
    description: Still waiting for the ZRN (cold start not possible).

  - id: 14
    name: ConfidenceTooLow
    severity: ERROR
    description: The localizer confidence is very low. Please check that you are in a properly mapped area.
    triggers_nogo: true

  # Failures of the aligner: those correspond to error codes from the aligner.
  # The first group of 3 is when that happens at initialization (cold start) and
  # those are error level faults. The second group is warning level faults for
  # when this happens at runtime (in which case we keep trying with subsequent
  # spins, until we nogo for localizer missing for too long).
  - id: 15
    name: UninitializedNoSeed
    severity: ERROR
    description: Localizer could not initialize because it could not get any seed. Make sure you are parked in a cold start box, or drive around a bit more to fall back to legacy initialization.
    triggers_nogo: true
  - id: 16
    name: UninitializedAllSeedsFailed
    severity: ERROR
    description: Localizer could not initialize because none of the seeds resulted in a successful alignment. Make sure you are parked in a cold start box, or drive around a bit more to fall back to legacy initialization. Make sure to be in a mapped area and you have the correct map.
    triggers_nogo: true
  - id: 17
    name: UninitializedConfidenceTooLow
    severity: ERROR
    description: Localizer could not initialize because none of the seeds had a high enough confidence. If you are initializing from cold start, make sure you are parked in a cold start box. If you are in a cold start box and this error has been present for some time, then fall back to legacy initialization by driving around. If you are trying to init by driving, drive a bit more.
    triggers_nogo: true
  - id: 18
    name: UnableToLocalizeNoSeed
    severity: WARNING
    description: Localizer could not localize because it could not get any seed. This is only a problem if this lasts for too long, in which case there will be a NOGO.
  - id: 19
    name: UnableToLocalizeAllSeedsFailed
    severity: WARNING
    description: Localizer could not localize because none of the seeds resulted in a successful alignment. This can be due to missing sensor data (there should be some other faults), or because the hero is outside of the mapped area (or no map, or wrong map). This is only a problem if this lasts for too long, in which case there will be a NOGO.
  - id: 20
    name: UnableToLocalizeConfidenceTooLow
    severity: WARNING
    description: Localizer could not localize because none of the seeds had a high enough confidence. This can be due to missing sensor data (there should be some other faults), or because the hero is outside of the mapped area (or no map, or wrong map). This is only a problem if this lasts for too long, in which case there will be a NOGO.
