phytrace_sdk/models/enums.rs
1//! Enumeration types for the PhyTrace UDM.
2//!
3//! All enums are serialized using snake_case naming convention.
4
5use serde::{Deserialize, Serialize};
6
7// =============================================================================
8// Event Classification
9// =============================================================================
10
11/// Classification of UDM events.
12#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
13#[serde(rename_all = "snake_case")]
14pub enum EventType {
15 // Telemetry events
16 /// Periodic telemetry snapshot
17 #[default]
18 TelemetryPeriodic,
19 /// Telemetry triggered by significant change
20 TelemetryOnChange,
21 /// Full system snapshot
22 TelemetrySnapshot,
23
24 // State transition events
25 /// Robot state changed
26 StateTransition,
27 /// Operational mode changed
28 ModeChange,
29
30 // Task events
31 /// Task started
32 TaskStarted,
33 /// Task completed successfully
34 TaskCompleted,
35 /// Task failed
36 TaskFailed,
37 /// Task cancelled
38 TaskCancelled,
39
40 // Navigation events
41 /// Navigation goal reached
42 GoalReached,
43 /// Path blocked, replanning
44 PathBlocked,
45 /// Rerouting in progress
46 Rerouting,
47
48 // Safety events
49 /// Safety violation detected
50 SafetyViolation,
51 /// Emergency stop activated
52 EmergencyStop,
53
54 // System events
55 /// System startup
56 SystemStartup,
57 /// System shutdown
58 SystemShutdown,
59 /// Error occurred
60 Error,
61
62 // Custom events
63 /// Custom event type (use extensions for details)
64 Custom,
65}
66
67// =============================================================================
68// Source Classification
69// =============================================================================
70
71/// Classification of the telemetry source.
72#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
73#[serde(rename_all = "snake_case")]
74pub enum SourceType {
75 // Mobile robots
76 /// Autonomous Mobile Robot
77 #[default]
78 Amr,
79 /// Automated Guided Vehicle
80 Agv,
81 /// Autonomous Forklift
82 AutonomousForklift,
83 /// Delivery Robot
84 DeliveryRobot,
85 /// Cleaning Robot
86 CleaningRobot,
87 /// Inspection Robot
88 InspectionRobot,
89 /// Security Robot
90 SecurityRobot,
91
92 // Manipulators
93 /// Industrial Robot Arm
94 IndustrialArm,
95 /// Collaborative Robot (Cobot)
96 Cobot,
97 /// Mobile Manipulator
98 MobileManipulator,
99
100 // Vehicles
101 /// Autonomous Vehicle
102 AutonomousVehicle,
103 /// Electric Vehicle
104 ElectricVehicle,
105 /// Drone / UAV
106 Drone,
107
108 // Other
109 /// Humanoid Robot
110 Humanoid,
111 /// Quadruped Robot
112 Quadruped,
113 /// Human (for tracking humans in simulation/HRI scenarios)
114 Human,
115 /// Custom Platform
116 Custom,
117 /// Simulation Instance
118 Simulation,
119}
120
121// =============================================================================
122// Operational Enums
123// =============================================================================
124
125/// Operational mode of the robot.
126#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
127#[serde(rename_all = "snake_case")]
128pub enum OperationalMode {
129 /// Fully autonomous operation
130 #[default]
131 Autonomous,
132 /// Manual control (teleoperation)
133 Manual,
134 /// Semi-autonomous with human oversight
135 SemiAutonomous,
136 /// Remote teleoperation
137 Teleoperated,
138 /// Learning/training mode
139 Learning,
140 /// Maintenance mode
141 Maintenance,
142 /// Emergency mode
143 Emergency,
144 /// Idle/standby
145 Idle,
146}
147
148/// Current operational state of the robot.
149#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
150#[serde(rename_all = "snake_case")]
151pub enum OperationalState {
152 /// Powered off
153 Off,
154 /// Booting up
155 Booting,
156 /// Ready and waiting
157 #[default]
158 Ready,
159 /// Executing a task
160 ExecutingTask,
161 /// Navigating to destination
162 Navigating,
163 /// Performing manipulation
164 Manipulating,
165 /// Charging
166 Charging,
167 /// Paused
168 Paused,
169 /// In error state
170 Error,
171 /// Emergency stopped
172 EmergencyStopped,
173 /// Shutting down
174 ShuttingDown,
175 /// In recovery mode
176 Recovering,
177}
178
179/// Error severity levels.
180#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
181#[serde(rename_all = "snake_case")]
182pub enum ErrorSeverity {
183 /// Informational message
184 #[default]
185 Info,
186 /// Warning - operation can continue
187 Warning,
188 /// Error - operation may be impacted
189 Error,
190 /// Critical - immediate attention required
191 Critical,
192 /// Fatal - system cannot continue
193 Fatal,
194}
195
196// =============================================================================
197// Motion Enums
198// =============================================================================
199
200/// Current motion state.
201#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
202#[serde(rename_all = "snake_case")]
203pub enum MotionState {
204 /// Not moving
205 #[default]
206 Stationary,
207 /// Moving at constant velocity
208 Moving,
209 /// Accelerating
210 Accelerating,
211 /// Decelerating
212 Decelerating,
213 /// Rotating in place
214 Rotating,
215 /// Reversing
216 Reversing,
217}
218
219// =============================================================================
220// Power Enums
221// =============================================================================
222
223/// Battery chemistry type.
224#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
225#[serde(rename_all = "snake_case")]
226pub enum BatteryChemistry {
227 /// Lithium Iron Phosphate
228 #[default]
229 LiFePo4,
230 /// Lithium Nickel Manganese Cobalt
231 Nmc,
232 /// Lithium Cobalt Oxide
233 LiCoO2,
234 /// Lithium Manganese Oxide
235 Lmo,
236 /// Lead Acid
237 LeadAcid,
238 /// Nickel Metal Hydride
239 NiMh,
240 /// Solid State
241 SolidState,
242 /// Other/Unknown
243 Other,
244}
245
246/// Charging state.
247#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
248#[serde(rename_all = "snake_case")]
249pub enum ChargingState {
250 /// Not connected to charger
251 #[default]
252 NotCharging,
253 /// Connected, preparing to charge
254 Preparing,
255 /// Actively charging
256 Charging,
257 /// Charge complete, still connected
258 Complete,
259 /// Charging error
260 Error,
261}
262
263/// Power source type.
264#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
265#[serde(rename_all = "snake_case")]
266pub enum PowerSource {
267 /// Running on battery
268 #[default]
269 Battery,
270 /// Connected to external power
271 External,
272 /// Solar powered
273 Solar,
274 /// Fuel cell
275 FuelCell,
276 /// Hybrid
277 Hybrid,
278}
279
280// =============================================================================
281// Safety Enums
282// =============================================================================
283
284/// Overall safety state.
285#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
286#[serde(rename_all = "snake_case")]
287pub enum SafetyState {
288 /// Normal operation
289 #[default]
290 Normal,
291 /// Warning - proceed with caution
292 Warning,
293 /// Protective stop active
294 ProtectiveStop,
295 /// Emergency stop active
296 EmergencyStop,
297 /// Safety interlock triggered
298 SafetyInterlock,
299 /// Reduced speed mode
300 ReducedSpeed,
301}
302
303/// Emergency stop type.
304#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
305#[serde(rename_all = "snake_case")]
306pub enum EStopType {
307 /// Software-triggered e-stop
308 #[default]
309 Software,
310 /// Hardware button pressed
311 Hardware,
312 /// Remote e-stop signal
313 Remote,
314 /// Automatic safety system
315 Automatic,
316}
317
318/// Safety zone type.
319#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
320#[serde(rename_all = "snake_case")]
321pub enum SafetyZoneType {
322 /// Warning zone - reduce speed
323 #[default]
324 Warning,
325 /// Slowdown zone - significantly reduce speed
326 Slowdown,
327 /// Stop zone - immediate stop required
328 Stop,
329 /// Restricted zone - entry prohibited
330 Restricted,
331 /// Collaborative zone - human-robot interaction area
332 Collaborative,
333}
334
335/// Violation severity.
336#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
337#[serde(rename_all = "snake_case")]
338pub enum ViolationSeverity {
339 /// Low severity - logged only
340 #[default]
341 Low,
342 /// Medium severity - warning issued
343 Medium,
344 /// High severity - action required
345 High,
346 /// Critical - immediate stop
347 Critical,
348}
349
350/// Types of safety violations.
351#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
352#[serde(rename_all = "snake_case")]
353pub enum ViolationType {
354 /// Speed limit exceeded
355 #[default]
356 SpeedExceeded,
357 /// Entered restricted zone
358 ZoneViolation,
359 /// Too close to obstacle
360 ProximityViolation,
361 /// Collision detected
362 CollisionDetected,
363 /// Stability issue
364 StabilityViolation,
365 /// Force/torque limit exceeded
366 ForceLimitExceeded,
367 /// Communication loss
368 CommunicationLoss,
369 /// Sensor failure
370 SensorFailure,
371}
372
373// =============================================================================
374// Navigation Enums
375// =============================================================================
376
377/// Localization quality.
378#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
379#[serde(rename_all = "snake_case")]
380pub enum LocalizationQuality {
381 /// Excellent localization
382 Excellent,
383 /// Good localization
384 #[default]
385 Good,
386 /// Fair localization
387 Fair,
388 /// Poor localization
389 Poor,
390 /// Lost / unknown position
391 Lost,
392}
393
394/// Path planning state.
395#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
396#[serde(rename_all = "snake_case")]
397pub enum PathState {
398 /// No path planned
399 #[default]
400 None,
401 /// Path being computed
402 Planning,
403 /// Valid path available
404 Valid,
405 /// Executing current path
406 Executing,
407 /// Path blocked, replanning
408 Blocked,
409 /// Path completed
410 Completed,
411 /// Path planning failed
412 Failed,
413}
414
415/// Obstacle classification.
416#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
417#[serde(rename_all = "snake_case")]
418pub enum ObstacleType {
419 /// Unknown obstacle
420 #[default]
421 Unknown,
422 /// Static obstacle (wall, furniture)
423 Static,
424 /// Dynamic obstacle (person, other robot)
425 Dynamic,
426 /// Human detected
427 Human,
428 /// Another robot
429 Robot,
430 /// Vehicle
431 Vehicle,
432 /// Temporary obstacle
433 Temporary,
434}
435
436// =============================================================================
437// Perception Enums
438// =============================================================================
439
440/// Sensor status.
441#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
442#[serde(rename_all = "snake_case")]
443pub enum SensorStatus {
444 /// Sensor operating normally
445 #[default]
446 Ok,
447 /// Sensor degraded
448 Degraded,
449 /// Sensor error
450 Error,
451 /// Sensor offline
452 Offline,
453 /// Sensor calibrating
454 Calibrating,
455}
456
457/// GPS fix type.
458#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
459#[serde(rename_all = "snake_case")]
460pub enum GpsFixType {
461 /// No fix
462 #[default]
463 NoFix,
464 /// 2D fix
465 Fix2d,
466 /// 3D fix
467 Fix3d,
468 /// Differential GPS
469 Dgps,
470 /// RTK float
471 RtkFloat,
472 /// RTK fixed
473 RtkFixed,
474}
475
476/// Detection classification confidence.
477#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
478#[serde(rename_all = "snake_case")]
479pub enum DetectionConfidence {
480 /// Low confidence
481 Low,
482 /// Medium confidence
483 #[default]
484 Medium,
485 /// High confidence
486 High,
487 /// Very high confidence
488 VeryHigh,
489}
490
491// =============================================================================
492// Actuator Enums
493// =============================================================================
494
495/// Motor status.
496#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
497#[serde(rename_all = "snake_case")]
498pub enum MotorStatus {
499 /// Motor OK
500 #[default]
501 Ok,
502 /// Motor overheating
503 Overheating,
504 /// Motor overcurrent
505 Overcurrent,
506 /// Motor error
507 Error,
508 /// Motor disabled
509 Disabled,
510}
511
512/// Gripper state.
513#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
514#[serde(rename_all = "snake_case")]
515pub enum GripperState {
516 /// Gripper fully open
517 #[default]
518 Open,
519 /// Gripper fully closed
520 Closed,
521 /// Gripper partially closed / holding
522 Holding,
523 /// Gripper moving
524 Moving,
525 /// Gripper error
526 Error,
527}
528
529/// Lift position state.
530#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
531#[serde(rename_all = "snake_case")]
532pub enum LiftState {
533 /// Lift at bottom
534 #[default]
535 Lowered,
536 /// Lift at top
537 Raised,
538 /// Lift moving
539 Moving,
540 /// Lift at custom position
541 Intermediate,
542 /// Lift error
543 Error,
544}
545
546// =============================================================================
547// Communication Enums
548// =============================================================================
549
550/// Network connection type.
551#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
552#[serde(rename_all = "snake_case")]
553pub enum NetworkType {
554 /// WiFi connection
555 #[default]
556 Wifi,
557 /// Ethernet connection
558 Ethernet,
559 /// Cellular connection
560 Cellular,
561 /// LoRa connection
562 Lora,
563 /// Bluetooth
564 Bluetooth,
565 /// Mesh network
566 Mesh,
567}
568
569/// Connection status.
570#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
571#[serde(rename_all = "snake_case")]
572pub enum ConnectionStatus {
573 /// Connected
574 #[default]
575 Connected,
576 /// Disconnected
577 Disconnected,
578 /// Connecting
579 Connecting,
580 /// Connection error
581 Error,
582}
583
584/// Cellular generation.
585#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
586#[serde(rename_all = "snake_case")]
587pub enum CellularGeneration {
588 /// 3G
589 #[serde(rename = "3g")]
590 Gen3,
591 /// 4G LTE
592 #[default]
593 #[serde(rename = "4g")]
594 Gen4,
595 /// 5G
596 #[serde(rename = "5g")]
597 Gen5,
598}
599
600// =============================================================================
601// Payload Enums
602// =============================================================================
603
604/// Load status.
605#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
606#[serde(rename_all = "snake_case")]
607pub enum LoadStatus {
608 /// No load
609 #[default]
610 Empty,
611 /// Partially loaded
612 PartialLoad,
613 /// Fully loaded
614 FullLoad,
615 /// Overloaded (warning)
616 Overloaded,
617}
618
619// =============================================================================
620// Manipulation Enums
621// =============================================================================
622
623/// Arm state.
624#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
625#[serde(rename_all = "snake_case")]
626pub enum ArmState {
627 /// Arm at home position
628 #[default]
629 Home,
630 /// Arm moving
631 Moving,
632 /// Arm at target position
633 AtTarget,
634 /// Arm performing grasp
635 Grasping,
636 /// Arm placing object
637 Placing,
638 /// Arm in collision avoidance
639 Avoiding,
640 /// Arm error
641 Error,
642}
643
644/// Grasp phase.
645#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
646#[serde(rename_all = "snake_case")]
647pub enum GraspPhase {
648 /// Not grasping
649 #[default]
650 Idle,
651 /// Approaching target
652 Approaching,
653 /// Pre-grasp positioning
654 PreGrasp,
655 /// Closing gripper
656 Closing,
657 /// Grasp secured
658 Secured,
659 /// Lifting object
660 Lifting,
661 /// Grasp failed
662 Failed,
663}
664
665/// Control mode for manipulation.
666#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
667#[serde(rename_all = "snake_case")]
668pub enum ManipulationControlMode {
669 /// Position control
670 #[default]
671 Position,
672 /// Velocity control
673 Velocity,
674 /// Force/torque control
675 Force,
676 /// Impedance control
677 Impedance,
678 /// Hybrid control
679 Hybrid,
680}
681
682// =============================================================================
683// HRI (Human-Robot Interaction) Enums
684// =============================================================================
685
686/// Human-robot interaction state.
687#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
688#[serde(rename_all = "snake_case")]
689pub enum InteractionState {
690 /// No interaction
691 #[default]
692 None,
693 /// Human detected nearby
694 HumanDetected,
695 /// Awaiting human input
696 AwaitingInput,
697 /// Active interaction
698 Interacting,
699 /// Handover in progress
700 Handover,
701 /// Following human
702 Following,
703}
704
705/// Handover state.
706#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
707#[serde(rename_all = "snake_case")]
708pub enum HandoverState {
709 /// No handover
710 #[default]
711 None,
712 /// Offering object to human
713 Offering,
714 /// Receiving object from human
715 Receiving,
716 /// Handover complete
717 Complete,
718 /// Handover failed/aborted
719 Aborted,
720}
721
722/// Human activity classification.
723#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
724#[serde(rename_all = "snake_case")]
725pub enum HumanActivity {
726 /// Unknown activity
727 #[default]
728 Unknown,
729 /// Standing still
730 Standing,
731 /// Walking
732 Walking,
733 /// Running
734 Running,
735 /// Sitting
736 Sitting,
737 /// Working (e.g., at a station)
738 Working,
739 /// Gesturing
740 Gesturing,
741}
742
743// =============================================================================
744// Coordination Enums
745// =============================================================================
746
747/// Fleet coordination role.
748#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
749#[serde(rename_all = "snake_case")]
750pub enum FleetRole {
751 /// Independent operation
752 #[default]
753 Independent,
754 /// Fleet leader
755 Leader,
756 /// Fleet follower
757 Follower,
758 /// Swarm member
759 SwarmMember,
760 /// Coordinator node
761 Coordinator,
762}
763
764/// Formation type.
765#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
766#[serde(rename_all = "snake_case")]
767pub enum FormationType {
768 /// No formation
769 #[default]
770 None,
771 /// Line formation
772 Line,
773 /// Column formation
774 Column,
775 /// V formation
776 Vee,
777 /// Diamond formation
778 Diamond,
779 /// Circular formation
780 Circle,
781 /// Custom formation
782 Custom,
783}
784
785/// Traffic management priority.
786#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
787#[serde(rename_all = "snake_case")]
788pub enum TrafficPriority {
789 /// Low priority
790 Low,
791 /// Normal priority
792 #[default]
793 Normal,
794 /// High priority
795 High,
796 /// Emergency priority
797 Emergency,
798}
799
800// =============================================================================
801// Simulation Enums
802// =============================================================================
803
804/// Simulator type.
805#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
806#[serde(rename_all = "snake_case")]
807pub enum SimulatorType {
808 /// Gazebo simulator
809 #[default]
810 Gazebo,
811 /// NVIDIA Isaac Sim
812 IsaacSim,
813 /// Unity-based simulator
814 Unity,
815 /// Unreal Engine simulator
816 Unreal,
817 /// Webots simulator
818 Webots,
819 /// Custom Python simulator
820 CustomPython,
821 /// Other simulator
822 Other,
823}
824
825/// Simulation fidelity level.
826#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
827#[serde(rename_all = "snake_case")]
828pub enum SimulationFidelity {
829 /// Low fidelity (fast, less accurate)
830 Low,
831 /// Medium fidelity
832 #[default]
833 Medium,
834 /// High fidelity (slow, more accurate)
835 High,
836 /// Physics-accurate simulation
837 PhysicsAccurate,
838}
839
840// =============================================================================
841// Thermal Enums
842// =============================================================================
843
844/// Overall thermal state.
845#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
846#[serde(rename_all = "snake_case")]
847pub enum ThermalState {
848 /// Normal temperature
849 #[default]
850 Normal,
851 /// Elevated temperature (warning)
852 Elevated,
853 /// High temperature (throttling)
854 High,
855 /// Critical temperature (shutdown imminent)
856 Critical,
857 /// Cold (below optimal)
858 Cold,
859}
860
861/// Cooling system mode.
862#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
863#[serde(rename_all = "snake_case")]
864pub enum CoolingMode {
865 /// Passive cooling
866 #[default]
867 Passive,
868 /// Active cooling (fans)
869 Active,
870 /// Liquid cooling
871 Liquid,
872 /// Maximum cooling
873 Maximum,
874}
875
876// =============================================================================
877// Audio Enums
878// =============================================================================
879
880/// Sound detection classification.
881#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
882#[serde(rename_all = "snake_case")]
883pub enum SoundType {
884 /// Unknown sound
885 #[default]
886 Unknown,
887 /// Speech detected
888 Speech,
889 /// Alarm/siren
890 Alarm,
891 /// Impact/collision sound
892 Impact,
893 /// Machine noise
894 Machine,
895 /// Emergency sound
896 Emergency,
897}
898
899// =============================================================================
900// Environment Interaction Enums
901// =============================================================================
902
903/// Door state.
904#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
905#[serde(rename_all = "snake_case")]
906pub enum DoorState {
907 /// Door open
908 Open,
909 /// Door closed
910 #[default]
911 Closed,
912 /// Door opening
913 Opening,
914 /// Door closing
915 Closing,
916 /// Door locked
917 Locked,
918 /// Door error
919 Error,
920}
921
922/// Elevator state.
923#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
924#[serde(rename_all = "snake_case")]
925pub enum ElevatorState {
926 /// Elevator idle
927 #[default]
928 Idle,
929 /// Elevator called
930 Called,
931 /// Elevator arriving
932 Arriving,
933 /// Doors open, ready to board
934 DoorsOpen,
935 /// Robot boarding
936 Boarding,
937 /// In transit
938 InTransit,
939 /// Arrived at floor
940 Arrived,
941}
942
943/// Charging station state.
944#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
945#[serde(rename_all = "snake_case")]
946pub enum ChargingStationState {
947 /// Station available
948 #[default]
949 Available,
950 /// Station occupied
951 Occupied,
952 /// Station out of service
953 OutOfService,
954 /// Station reserved
955 Reserved,
956}
957
958// =============================================================================
959// Compliance Enums
960// =============================================================================
961
962/// Certification status.
963#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
964#[serde(rename_all = "snake_case")]
965pub enum CertificationStatus {
966 /// Not certified
967 #[default]
968 NotCertified,
969 /// Certification pending
970 Pending,
971 /// Certified
972 Certified,
973 /// Certification expired
974 Expired,
975}
976
977/// Functional safety level (ISO 13849 / IEC 62443).
978#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
979#[serde(rename_all = "snake_case")]
980pub enum SafetyIntegrityLevel {
981 /// No safety requirement
982 #[default]
983 None,
984 /// Performance Level a / SIL 1
985 PlA,
986 /// Performance Level b
987 PlB,
988 /// Performance Level c / SIL 2
989 PlC,
990 /// Performance Level d / SIL 3
991 PlD,
992 /// Performance Level e / SIL 4
993 PlE,
994}
995
996// =============================================================================
997// AI / ML Enums
998// =============================================================================
999
1000/// AI model type.
1001#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
1002#[serde(rename_all = "snake_case")]
1003pub enum ModelType {
1004 /// Object detection model
1005 #[default]
1006 ObjectDetection,
1007 /// Semantic segmentation
1008 SemanticSegmentation,
1009 /// Instance segmentation
1010 InstanceSegmentation,
1011 /// Pose estimation
1012 PoseEstimation,
1013 /// Depth estimation
1014 DepthEstimation,
1015 /// Navigation/planning
1016 Navigation,
1017 /// Anomaly detection
1018 AnomalyDetection,
1019 /// Speech recognition
1020 SpeechRecognition,
1021 /// Natural language understanding
1022 Nlu,
1023 /// Custom model
1024 Custom,
1025}
1026
1027/// AI inference device.
1028#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
1029#[serde(rename_all = "snake_case")]
1030pub enum InferenceDevice {
1031 /// CPU inference
1032 #[default]
1033 Cpu,
1034 /// GPU inference
1035 Gpu,
1036 /// NPU/TPU inference
1037 Npu,
1038 /// Edge TPU
1039 EdgeTpu,
1040 /// FPGA
1041 Fpga,
1042}
1043
1044/// Anomaly severity.
1045#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
1046#[serde(rename_all = "snake_case")]
1047pub enum AnomalySeverity {
1048 /// Low severity anomaly
1049 #[default]
1050 Low,
1051 /// Medium severity
1052 Medium,
1053 /// High severity
1054 High,
1055 /// Critical anomaly
1056 Critical,
1057}
1058
1059// =============================================================================
1060// Maintenance Enums
1061// =============================================================================
1062
1063/// Component health status.
1064#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
1065#[serde(rename_all = "snake_case")]
1066pub enum ComponentHealth {
1067 /// Component healthy
1068 #[default]
1069 Healthy,
1070 /// Component degraded
1071 Degraded,
1072 /// Component needs attention
1073 NeedsAttention,
1074 /// Component failed
1075 Failed,
1076 /// Component status unknown
1077 Unknown,
1078}
1079
1080/// Maintenance urgency.
1081#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)]
1082#[serde(rename_all = "snake_case")]
1083pub enum MaintenanceUrgency {
1084 /// No maintenance needed
1085 #[default]
1086 None,
1087 /// Routine maintenance
1088 Routine,
1089 /// Soon - schedule maintenance
1090 Soon,
1091 /// Urgent - immediate attention
1092 Urgent,
1093 /// Critical - stop operation
1094 Critical,
1095}
1096
1097#[cfg(test)]
1098mod tests {
1099 use super::*;
1100
1101 #[test]
1102 fn test_event_type_serialization() {
1103 let event_type = EventType::TelemetryPeriodic;
1104 let json = serde_json::to_string(&event_type).unwrap();
1105 assert_eq!(json, "\"telemetry_periodic\"");
1106
1107 let deserialized: EventType = serde_json::from_str(&json).unwrap();
1108 assert_eq!(deserialized, event_type);
1109 }
1110
1111 #[test]
1112 fn test_source_type_serialization() {
1113 let source_type = SourceType::Amr;
1114 let json = serde_json::to_string(&source_type).unwrap();
1115 assert_eq!(json, "\"amr\"");
1116 }
1117
1118 #[test]
1119 fn test_default_values() {
1120 assert_eq!(EventType::default(), EventType::TelemetryPeriodic);
1121 assert_eq!(SourceType::default(), SourceType::Amr);
1122 assert_eq!(OperationalMode::default(), OperationalMode::Autonomous);
1123 assert_eq!(SafetyState::default(), SafetyState::Normal);
1124 }
1125}