10#include <px4_msgs/msg/fixed_wing_lateral_setpoint.hpp>
11#include <px4_msgs/msg/fixed_wing_longitudinal_setpoint.hpp>
12#include <px4_msgs/msg/lateral_control_configuration.hpp>
13#include <px4_msgs/msg/longitudinal_control_configuration.hpp>
14#include <px4_ros2/common/exception.hpp>
15#include <px4_ros2/common/setpoint_base.hpp>
22struct FwLateralLongitudinalSetpoint;
23struct FwControlConfiguration;
42 return px4_msgs::msg::SetpointConfig::TYPE_FIXEDWING_LATERAL_LONGITUDINAL;
46 px4_msgs::msg::SetpointConfigReply& setpoint_config_reply)
override;
94 std::optional<float> equivalent_airspeed_sp = {},
95 std::optional<float> lateral_acceleration_sp = {});
106 std::optional<float> equivalent_airspeed_sp = {},
107 std::optional<float> lateral_acceleration_sp = {});
109 float desiredUpdateRateHz()
override {
return 30.f; }
112 void publishConfigurationIfNeeded();
115 bool _local_position_is_optional;
116 rclcpp::Publisher<px4_msgs::msg::FixedWingLateralSetpoint>::SharedPtr _fw_lateral_sp_pub;
117 rclcpp::Publisher<px4_msgs::msg::FixedWingLongitudinalSetpoint>::SharedPtr
118 _fw_longitudinal_sp_pub;
120 rclcpp::Publisher<px4_msgs::msg::LateralControlConfiguration>::SharedPtr
121 _lateral_control_configuration_pub;
122 rclcpp::Publisher<px4_msgs::msg::LongitudinalControlConfiguration>::SharedPtr
123 _longitudinal_control_configuration_pub;
125 rclcpp::Time _last_config_published_time{};
126 std::optional<px4_msgs::msg::LateralControlConfiguration> _current_lateral_configuration;
127 std::optional<px4_msgs::msg::LongitudinalControlConfiguration>
128 _current_longitudinal_configuration;
132 std::optional<float> course;
133 std::optional<float> airspeed_direction;
134 std::optional<float> lateral_acceleration;
135 std::optional<float> altitude_msl;
136 std::optional<float> height_rate;
137 std::optional<float> equivalent_airspeed;
138 std::optional<float> throttle_direct;
148 airspeed_direction = airspeed_direction_sp;
154 lateral_acceleration = lateral_acceleration_sp;
160 altitude_msl = altitude_sp;
166 height_rate = height_rate_sp;
172 equivalent_airspeed = equivalent_airspeed_sp;
178 throttle_direct = throttle_direct_sp;
184 std::optional<float> min_pitch;
185 std::optional<float> max_pitch;
186 std::optional<float> min_throttle;
187 std::optional<float> max_throttle;
188 std::optional<float> max_lateral_acceleration;
189 std::optional<float> target_climb_rate;
190 std::optional<float> target_sink_rate;
191 std::optional<float> speed_weight;
195 min_pitch = min_pitch_sp;
196 max_pitch = max_pitch_sp;
203 min_throttle = min_throttle_sp;
204 max_throttle = max_throttle_sp;
211 max_lateral_acceleration = max_lateral_acceleration_sp;
217 target_sink_rate = target_sink_rate_sp;
223 target_climb_rate = target_climb_rate_sp;
237 if (speed_weight_sp < 0.0 || speed_weight_sp > 2.0) {
238 throw Exception(
"Speed weight must be between 0 and 2.");
240 speed_weight = speed_weight_sp;
Definition context.hpp:18
Definition exception.hpp:14
Setpoint type for fixedwing control.
Definition lateral_longitudinal.hpp:28
FwLateralLongitudinalSetpointType(Context &context, bool is_position_optional=false)
void updateWithAltitude(float altitude_amsl_sp, float course_sp, std::optional< float > equivalent_airspeed_sp={}, std::optional< float > lateral_acceleration_sp={})
Update the setpoint with simplest set of inputs: Altitude and Course. Lateral acceleration setpoints ...
SetpointType getSetpointType() override
Definition lateral_longitudinal.hpp:40
void update(const FwLateralLongitudinalSetpoint &setpoint)
Update the setpoint with full flexibility by passing a FwLateralLongitudinalSetpoint.
void update(const FwLateralLongitudinalSetpoint &setpoint, const FwControlConfiguration &config)
Update the setpoint with full flexibility by passing a FwLateralLongitudinalSetpoint and FwControlCon...
void clearOptionalRequirements(px4_msgs::msg::SetpointConfigReply &setpoint_config_reply) override
void updateWithHeightRate(float height_rate_sp, float course_sp, std::optional< float > equivalent_airspeed_sp={}, std::optional< float > lateral_acceleration_sp={})
Update the setpoint with simplest set of inputs: Height rate and Course. Lateral acceleration setpoin...
Definition setpoint_base.hpp:20
Definition lateral_longitudinal.hpp:183
FwControlConfiguration & withSpeedWeight(float speed_weight_sp)
Configure the speed weight for TECS (Total Energy Control System). For more information on TECS,...
Definition lateral_longitudinal.hpp:235
Definition lateral_longitudinal.hpp:131