dji_log_parser/frame/
osd.rs

1use serde::Serialize;
2#[cfg(target_arch = "wasm32")]
3use tsify_next::Tsify;
4
5use crate::record::osd::{
6    AppCommand, BatteryType, DroneType, FlightAction, FlightMode, GoHomeStatus, ImuInitFailReason,
7    MotorStartFailedCause, NonGPSCause,
8};
9
10#[derive(Serialize, Debug, Default, Clone)]
11#[serde(rename_all = "camelCase")]
12#[cfg_attr(target_arch = "wasm32", derive(Tsify))]
13pub struct FrameOSD {
14    /// Flight time in seconds
15    pub fly_time: f32,
16    /// Latitude in degrees
17    pub latitude: f64,
18    /// Longitude in degrees
19    pub longitude: f64,
20    /// Height above ground level in meters
21    pub height: f32,
22    /// Maximum height reached in meters
23    pub height_max: f32,
24    /// Visual Positioning System height in meters
25    pub vps_height: f32,
26    /// Altitude above sea level in meters
27    pub altitude: f32,
28    /// Speed along the X-axis in meters per second
29    pub x_speed: f32,
30    /// Maximum speed reached along the X-axis in meters per second
31    pub x_speed_max: f32,
32    /// Speed along the Y-axis in meters per second
33    pub y_speed: f32,
34    /// Maximum speed reached along the Y-axis in meters per second
35    pub y_speed_max: f32,
36    /// Vertical speed in meters per second
37    pub z_speed: f32,
38    /// Maximum vertical speed reached in meters per second
39    pub z_speed_max: f32,
40    /// Pitch angle in degrees
41    pub pitch: f32,
42    /// Roll angle in degrees
43    pub roll: f32,
44    /// Yaw angle in degrees
45    pub yaw: f32,
46    /// Current flight mode
47    #[cfg_attr(target_arch = "wasm32", tsify(optional))]
48    pub flyc_state: Option<FlightMode>,
49    /// Current app command
50    #[cfg_attr(target_arch = "wasm32", tsify(optional))]
51    pub flyc_command: Option<AppCommand>,
52    /// Current flight action
53    #[cfg_attr(target_arch = "wasm32", tsify(optional))]
54    pub flight_action: Option<FlightAction>,
55    /// Indicates if GPS is being used
56    pub is_gpd_used: bool,
57    /// Reason for not using GPS
58    #[cfg_attr(target_arch = "wasm32", tsify(optional))]
59    pub non_gps_cause: Option<NonGPSCause>,
60    /// Number of GPS satellites detected
61    pub gps_num: u8,
62    /// GPS signal level
63    pub gps_level: u8,
64    /// Type of drone
65    #[cfg_attr(target_arch = "wasm32", tsify(optional))]
66    pub drone_type: Option<DroneType>,
67    /// Indicates if obstacle avoidance is active
68    pub is_swave_work: bool,
69    /// Indicates if there's an error with obstacle avoidance
70    pub wave_error: bool,
71    /// Current status of the return-to-home function
72    #[cfg_attr(target_arch = "wasm32", tsify(optional))]
73    pub go_home_status: Option<GoHomeStatus>,
74    /// Type of battery
75    #[cfg_attr(target_arch = "wasm32", tsify(optional))]
76    pub battery_type: Option<BatteryType>,
77    /// Indicates if the drone is on the ground
78    pub is_on_ground: bool,
79    /// Indicates if the motor is running
80    pub is_motor_on: bool,
81    /// Indicates if the motor is blocked
82    pub is_motor_blocked: bool,
83    /// Reason for motor start failure
84    #[cfg_attr(target_arch = "wasm32", tsify(optional))]
85    pub motor_start_failed_cause: Option<MotorStartFailedCause>,
86    /// Indicates if the IMU is preheated
87    pub is_imu_preheated: bool,
88    /// Reason for IMU initialization failure
89    #[cfg_attr(target_arch = "wasm32", tsify(optional))]
90    pub imu_init_fail_reason: Option<ImuInitFailReason>,
91    /// Indicates if the accelerometer is over range
92    pub is_acceletor_over_range: bool,
93    /// Indicates if the barometer is malfunctioning in air
94    pub is_barometer_dead_in_air: bool,
95    /// Indicates if there's a compass error
96    pub is_compass_error: bool,
97    /// Indicates if the return-to-home height has been modified
98    pub is_go_home_height_modified: bool,
99    /// Indicates if Intelligent Orientation Control can work
100    pub can_ioc_work: bool,
101    /// Indicates if there's not enough force (e.g., low battery)
102    pub is_not_enough_force: bool,
103    /// Indicates if the drone is out of its flight limit
104    pub is_out_of_limit: bool,
105    /// Indicates if propeller catapult protection is active
106    pub is_propeller_catapult: bool,
107    /// Indicates if the drone is experiencing vibrations
108    pub is_vibrating: bool,
109    /// Indicates if vision positioning system is being used
110    pub is_vision_used: bool,
111    /// Battery voltage warning level
112    pub voltage_warning: u8,
113}