From 8a5e5a411a476834f0c667dc1631feb5900efdc2 Mon Sep 17 00:00:00 2001 From: mahima-yoga Date: Wed, 16 Apr 2025 09:54:21 +0200 Subject: [PATCH] msgs: Clean up message definitions and descriptions - Add versioning to interfacing messages - Add header description - Add units, frame and range wherever possible - Add [norm] and @range indentifiers --- msg/CMakeLists.txt | 8 ++++---- msg/FixedWingLateralGuidanceStatus.msg | 19 +++++++++++-------- msg/FixedWingLateralSetpoint.msg | 7 ------- msg/FixedWingLateralStatus.msg | 9 ++++++--- msg/FixedWingLongitudinalSetpoint.msg | 9 --------- msg/FixedWingRunwayControl.msg | 2 +- msg/LateralControlConfiguration.msg | 3 --- msg/LongitudinalControlConfiguration.msg | 11 ----------- msg/versioned/FixedWingLateralSetpoint.msg | 11 +++++++++++ .../FixedWingLongitudinalSetpoint.msg | 14 ++++++++++++++ msg/versioned/LateralControlConfiguration.msg | 8 ++++++++ .../LongitudinalControlConfiguration.msg | 17 +++++++++++++++++ .../FwLateralLongitudinalControl.cpp | 2 +- 13 files changed, 73 insertions(+), 47 deletions(-) delete mode 100644 msg/FixedWingLateralSetpoint.msg delete mode 100644 msg/FixedWingLongitudinalSetpoint.msg delete mode 100644 msg/LateralControlConfiguration.msg delete mode 100644 msg/LongitudinalControlConfiguration.msg create mode 100644 msg/versioned/FixedWingLateralSetpoint.msg create mode 100644 msg/versioned/FixedWingLongitudinalSetpoint.msg create mode 100644 msg/versioned/LateralControlConfiguration.msg create mode 100644 msg/versioned/LongitudinalControlConfiguration.msg diff --git a/msg/CMakeLists.txt b/msg/CMakeLists.txt index 29af39b27f..a0cc5ab1ec 100644 --- a/msg/CMakeLists.txt +++ b/msg/CMakeLists.txt @@ -90,8 +90,6 @@ set(msg_files FollowTargetEstimator.msg FollowTargetStatus.msg FuelTankStatus.msg - FixedWingLateralSetpoint.msg - FixedWingLongitudinalSetpoint.msg FixedWingLateralGuidanceStatus.msg FixedWingLateralStatus.msg FixedWingRunwayControl.msg @@ -125,12 +123,10 @@ set(msg_files LandingGearWheel.msg LandingTargetInnovations.msg LandingTargetPose.msg - LateralControlConfiguration.msg LaunchDetectionStatus.msg LedControl.msg LoggerStatus.msg LogMessage.msg - LongitudinalControlConfiguration.msg MagnetometerBiasEstimate.msg MagWorkerData.msg ManualControlSwitches.msg @@ -247,8 +243,12 @@ set(msg_files versioned/ArmingCheckRequest.msg versioned/BatteryStatus.msg versioned/ConfigOverrides.msg + versioned/FixedWingLateralSetpoint.msg + versioned/FixedWingLongitudinalSetpoint.msg versioned/GotoSetpoint.msg versioned/HomePosition.msg + versioned/LateralControlConfiguration.msg + versioned/LongitudinalControlConfiguration.msg versioned/ManualControlSetpoint.msg versioned/ModeCompleted.msg versioned/RegisterExtComponentReply.msg diff --git a/msg/FixedWingLateralGuidanceStatus.msg b/msg/FixedWingLateralGuidanceStatus.msg index 6295f8948e..57a9df5136 100644 --- a/msg/FixedWingLateralGuidanceStatus.msg +++ b/msg/FixedWingLateralGuidanceStatus.msg @@ -1,10 +1,13 @@ +# Fixed Wing Lateral Guidance Status message +# Published by fw_pos_control module to report the resultant lateral setpoints and NPFG debug outputs + uint64 timestamp # time since system start (microseconds) -float32 course_setpoint # bearing angle (same as course) [rad] -float32 lateral_acceleration_ff # lateral acceleration demand only for maintaining curvature [m/s^2] -float32 bearing_feas # bearing feasibility [0,1] -float32 bearing_feas_on_track # on-track bearing feasibility [0,1] -float32 signed_track_error # signed track error [m] -float32 track_error_bound # track error bound [m] -float32 adapted_period # adapted period (if auto-tuning enabled) [s] -uint8 wind_est_valid # (boolean) true = wind estimate is valid and/or being used by controller (also indicates if wind est usage is disabled despite being valid) +float32 course_setpoint # [rad] [@range -pi, pi] Desired direction of travel over ground w.r.t (true) North. Set by guidance law +float32 lateral_acceleration_ff # [m/s^2] [FRD] lateral acceleration demand only for maintaining curvature +float32 bearing_feas # [@range 0,1] bearing feasibility +float32 bearing_feas_on_track # [@range 0,1] on-track bearing feasibility +float32 signed_track_error # [m] signed track error +float32 track_error_bound # [m] track error bound +float32 adapted_period # [s] adapted period (if auto-tuning enabled) +uint8 wind_est_valid # [boolean] true = wind estimate is valid and/or being used by controller (also indicates if wind estimate usage is disabled despite being valid) diff --git a/msg/FixedWingLateralSetpoint.msg b/msg/FixedWingLateralSetpoint.msg deleted file mode 100644 index d899993ad5..0000000000 --- a/msg/FixedWingLateralSetpoint.msg +++ /dev/null @@ -1,7 +0,0 @@ -uint64 timestamp - -# NOTE: At least one of course, airspeed_direction, or lateral_acceleration must be finite - -float32 course # [-pi, pi] Course over ground setpoint, w.r.t. North. NAN if not controlled directly. -float32 airspeed_direction # [-pi, pi] Angle projected to ground of desired airspeed vector, w.r.t. North. NAN if not controlled directly, used as feedforward if course setpoint is finite. -float32 lateral_acceleration # [m/s^2] Lateral acceleration setpoint in FRD frame. NAN if not controlled directly, used as feedforward if either course setpoint or airspeed_direction is finite. diff --git a/msg/FixedWingLateralStatus.msg b/msg/FixedWingLateralStatus.msg index b877948b24..4843937069 100644 --- a/msg/FixedWingLateralStatus.msg +++ b/msg/FixedWingLateralStatus.msg @@ -1,4 +1,7 @@ -uint64 timestamp # time since system start (microseconds) +# Fixed Wing Lateral Status message +# Published by the fw_lateral_longitudinal_control module to report the resultant lateral setpoint -float32 lateral_acceleration # resultant lateral acceleration reference [m/s^2] -float32 can_run_factor # estimate of certainty of the correct functionality of the npfg roll setpoint in [0, 1] +uint64 timestamp # time since system start (microseconds) + +float32 lateral_acceleration_setpoint # [m/s^2] [FRD] resultant lateral acceleration setpoint +float32 can_run_factor # [norm] [@range 0, 1] estimate of certainty of the correct functionality of the npfg roll setpoint diff --git a/msg/FixedWingLongitudinalSetpoint.msg b/msg/FixedWingLongitudinalSetpoint.msg deleted file mode 100644 index 25595f76c4..0000000000 --- a/msg/FixedWingLongitudinalSetpoint.msg +++ /dev/null @@ -1,9 +0,0 @@ -uint64 timestamp - -# Note: If not both pitch_direct and throttle_direct are finite, then either altitude or height_rate must be finite - -float32 altitude # [m] Altitude setpoint AMSL, NAN if not controlled -float32 height_rate # [m/s] NAN if not controlled directly, used as feedforward if altitude is finite -float32 equivalent_airspeed # [m/s] NAN if system default should be used -float32 pitch_direct # [rad] NAN if not controlled, overrides total energy controller -float32 throttle_direct # [0,1] NAN if not controlled, overrides total energy controller diff --git a/msg/FixedWingRunwayControl.msg b/msg/FixedWingRunwayControl.msg index a74d702c10..62d09a5ebf 100644 --- a/msg/FixedWingRunwayControl.msg +++ b/msg/FixedWingRunwayControl.msg @@ -5,4 +5,4 @@ uint64 timestamp # [us] time since system start bool wheel_steering_enabled # Flag that enables the wheel steering. -float32 wheel_steering_nudging_rate # [norm] [-1, 1] [FRD] Manual wheel nudging, added to controller output. NAN is interpreted as 0. +float32 wheel_steering_nudging_rate # [norm] [@range -1, 1] [FRD] Manual wheel nudging, added to controller output. NAN is interpreted as 0. diff --git a/msg/LateralControlConfiguration.msg b/msg/LateralControlConfiguration.msg deleted file mode 100644 index ee96028776..0000000000 --- a/msg/LateralControlConfiguration.msg +++ /dev/null @@ -1,3 +0,0 @@ -uint64 timestamp - -float32 lateral_accel_max # [m/s^2] maps 1:1 to a maximum roll angle, accel_max = tan(roll_max) * GRAVITY diff --git a/msg/LongitudinalControlConfiguration.msg b/msg/LongitudinalControlConfiguration.msg deleted file mode 100644 index 0f944cc9bf..0000000000 --- a/msg/LongitudinalControlConfiguration.msg +++ /dev/null @@ -1,11 +0,0 @@ -uint64 timestamp - -float32 pitch_min # [rad] -float32 pitch_max # [rad] -float32 throttle_min # [0,1] -float32 throttle_max # [0,1] -float32 climb_rate_target # [m/s] target climbrate used to change altitude -float32 sink_rate_target # [m/s] target sinkrate used to change altitude -float32 speed_weight # [0,2], 0=pitch controls altitude only, 2=pitch controls airspeed only -bool enforce_low_height_condition # if true, total energy controller will use lower altitude control time constant -bool disable_underspeed_protection # if true, underspeed handling is disabled in the total energy controller diff --git a/msg/versioned/FixedWingLateralSetpoint.msg b/msg/versioned/FixedWingLateralSetpoint.msg new file mode 100644 index 0000000000..ac7410878e --- /dev/null +++ b/msg/versioned/FixedWingLateralSetpoint.msg @@ -0,0 +1,11 @@ +# Fixed Wing Lateral Setpoint message +# Used by the fw_lateral_longitudinal_control module +# At least one of course, airspeed_direction, or lateral_acceleration must be finite. + +uint32 MESSAGE_VERSION = 0 + +uint64 timestamp # time since system start (microseconds) + +float32 course # [rad] [@range -pi, pi] Desired direction of travel over ground w.r.t (true) North. NAN if not controlled directly. +float32 airspeed_direction # [rad] [@range -pi, pi] Desired horizontal angle of airspeed vector w.r.t. (true) North. Same as vehicle heading if in the absence of sideslip. NAN if not controlled directly, takes precedence over course if finite. +float32 lateral_acceleration # [m/s^2] [FRD] Lateral acceleration setpoint. NAN if not controlled directly, used as feedforward if either course setpoint or airspeed_direction is finite. diff --git a/msg/versioned/FixedWingLongitudinalSetpoint.msg b/msg/versioned/FixedWingLongitudinalSetpoint.msg new file mode 100644 index 0000000000..06896df8b6 --- /dev/null +++ b/msg/versioned/FixedWingLongitudinalSetpoint.msg @@ -0,0 +1,14 @@ +# Fixed Wing Longitudinal Setpoint message +# Used by the fw_lateral_longitudinal_control module +# If pitch_direct and throttle_direct are not both finite, then the controller relies on altitude/height_rate and equivalent_airspeed to control vertical motion. +# If both altitude and height_rate are NAN, the controller maintains the current altitude. + +uint32 MESSAGE_VERSION = 0 + +uint64 timestamp # time since system start (microseconds) + +float32 altitude # [m] Altitude setpoint AMSL, not controlled directly if NAN or if height_rate is finite +float32 height_rate # [m/s] [ENU] Scalar height rate setpoint. NAN if not controlled directly +float32 equivalent_airspeed # [m/s] [@range 0, inf] Scalar equivalent airspeed setpoint. NAN if system default should be used +float32 pitch_direct # [rad] [@range -pi, pi] [FRD] NAN if not controlled, overrides total energy controller +float32 throttle_direct # [norm] [@range 0,1] NAN if not controlled, overrides total energy controller diff --git a/msg/versioned/LateralControlConfiguration.msg b/msg/versioned/LateralControlConfiguration.msg new file mode 100644 index 0000000000..783bd38465 --- /dev/null +++ b/msg/versioned/LateralControlConfiguration.msg @@ -0,0 +1,8 @@ +# Fixed Wing Lateral Control Configuration message +# Used by the fw_lateral_longitudinal_control module to constrain FixedWingLateralSetpoint messages. + +uint32 MESSAGE_VERSION = 0 + +uint64 timestamp # time since system start (microseconds) + +float32 lateral_accel_max # [m/s^2] currently maps to a maximum roll angle, accel_max = tan(roll_max) * GRAVITY diff --git a/msg/versioned/LongitudinalControlConfiguration.msg b/msg/versioned/LongitudinalControlConfiguration.msg new file mode 100644 index 0000000000..ac9c56df44 --- /dev/null +++ b/msg/versioned/LongitudinalControlConfiguration.msg @@ -0,0 +1,17 @@ +# Fixed Wing Longitudinal Control Configuration message +# Used by the fw_lateral_longitudinal_control module and TECS to constrain FixedWingLongitudinalSetpoint messages +# and configure the resultant setpoints. + +uint32 MESSAGE_VERSION = 0 + +uint64 timestamp # time since system start (microseconds) + +float32 pitch_min # [rad][@range -pi, pi] defaults to FW_P_LIM_MIN if NAN. +float32 pitch_max # [rad][@range -pi, pi] defaults to FW_P_LIM_MAX if NAN. +float32 throttle_min # [norm] [@range 0,1] deaults to FW_THR_MIN if NAN. +float32 throttle_max # [norm] [@range 0,1] defaults to FW_THR_MAX if NAN. +float32 climb_rate_target # [m/s] target climbrate to change altitude. Defaults to FW_T_CLIMB_MAX if NAN. Not used if height_rate is directly set in FixedWingLongitudinalSetpoint. +float32 sink_rate_target # [m/s] target sinkrate to change altitude. Defaults to FW_T_SINK_MAX if NAN. Not used if height_rate is directly set in FixedWingLongitudinalSetpoint. +float32 speed_weight # [@range 0,2], 0=pitch controls altitude only, 2=pitch controls airspeed only +bool enforce_low_height_condition # [boolean] if true, the altitude controller is configured with an alternative timeconstant for tighter altitude tracking +bool disable_underspeed_protection # [boolean] if true, underspeed handling is disabled in the altitude controller diff --git a/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp b/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp index 77e0ae5b23..1c42f5838c 100644 --- a/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp +++ b/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp @@ -285,7 +285,7 @@ void FwLateralLongitudinalControl::Run() fixed_wing_lateral_status_s fixed_wing_lateral_status{}; fixed_wing_lateral_status.timestamp = hrt_absolute_time(); - fixed_wing_lateral_status.lateral_acceleration = lateral_accel_sp; + fixed_wing_lateral_status.lateral_acceleration_setpoint = lateral_accel_sp; fixed_wing_lateral_status.can_run_factor = _can_run_factor; _fixed_wing_lateral_status_pub.publish(fixed_wing_lateral_status);