Auterion App SDK
Auterion SDK is a library that can be used by AuterionOS apps to communicate with the system.
Loading...
Searching...
No Matches
body_frame_specific_force_controller.hpp
1/****************************************************************************
2 *
3 * Copyright 2026 Auterion AG. All rights reserved.
4 *
5 ****************************************************************************/
6
7#pragma once
8
9#include <Eigen/Eigen>
10#include <memory>
11#include <optional>
12
13namespace auterion {
14
20
30 public:
31 struct Parameters {
33 double roll_gain{0.0};
35 double max_roll_angle{45.0};
37 double sf_roll_i_gain{0.0};
38
40 double sf_z_gain_p{0.0};
42 double sf_z_gain_i{0.0};
43
45 double sf_y_gain_p{0.0};
47 double sf_y_gain_i{0.0};
48
50 double max_side_acc_trim{0.0};
52 double trim_airspeed{20.0};
53
56 double approach_airspeed{20.0};
58 double airspeed_gain_p{0.0};
60 double airspeed_gain_i{0.0};
63
68 double camera_tilt{0.0};
69 };
70
71 struct State {
73 Eigen::Vector3d sf_sp_enu{Eigen::Vector3d::Zero()};
75 Eigen::Vector3d sf_sp_body{Eigen::Vector3d::Zero()};
77 double validated_airspeed{0.0};
79 double sf_sp_y_bank{0.0};
81 double sf_sp_y_skid{0.0};
85 double roll_error{0.0};
87 double sp_p_unlim{0.0};
89 double sf_y_error{0.0};
99 Eigen::Vector3d body_rates_sp{Eigen::Vector3d::Zero()};
101 double thrust_sp{0.5};
102 };
103
108 explicit BodyFrameSpecificForceController(const Parameters& parameters);
109
114 void setParameters(const Parameters& parameters);
115
129 void update(double dt, const Eigen::Vector3d& acc_sp_enu,
130 const Eigen::Quaterniond& attitude_enu, const Eigen::Vector3d& specific_force_flu,
131 std::optional<double> true_airspeed,
132 std::optional<Eigen::Vector3d> los = std::nullopt);
133
137 const State& state() const;
138
139 private:
140 std::shared_ptr<BodyFrameSpecificForceControllerImpl> _impl;
141};
142
143} // namespace auterion
Implementation details for the BodyFrameSpecificForceController class.
Specific-force to body-rate controller for fixed-wing aircraft.
Definition body_frame_specific_force_controller.hpp:29
BodyFrameSpecificForceController(const Parameters &parameters)
Constructs a BodyFrameSpecificForceController with the given parameters.
void update(double dt, const Eigen::Vector3d &acc_sp_enu, const Eigen::Quaterniond &attitude_enu, const Eigen::Vector3d &specific_force_flu, std::optional< double > true_airspeed, std::optional< Eigen::Vector3d > los=std::nullopt)
Runs one update step of the body-rate controller.
void setParameters(const Parameters &parameters)
Updates controller parameters.
const State & state() const
Returns a const reference to the current controller state.
Definition body_frame_specific_force_controller.hpp:31
double airspeed_gain_p
Airspeed PI: proportional gain.
Definition body_frame_specific_force_controller.hpp:58
double sf_y_gain_i
Yaw body-acceleration PI: integral gain.
Definition body_frame_specific_force_controller.hpp:47
double airspeed_ramp_slope
Maximum slope of the airspeed command ramp [m/s per s].
Definition body_frame_specific_force_controller.hpp:62
double sf_roll_i_gain
Integral gain for specific-force-based roll error compensation.
Definition body_frame_specific_force_controller.hpp:37
double sf_z_gain_i
Pitch body-acceleration PI: integral gain.
Definition body_frame_specific_force_controller.hpp:42
double camera_tilt
Camera pitch angle relative to the drone body frame, positive upward [deg].
Definition body_frame_specific_force_controller.hpp:68
double sf_y_gain_p
Yaw body-acceleration PI: proportional gain.
Definition body_frame_specific_force_controller.hpp:45
double max_side_acc_trim
Maximum side-slip acceleration at trim airspeed [m/s²].
Definition body_frame_specific_force_controller.hpp:50
double pitch_lim_camera_vertical_fov
Definition body_frame_specific_force_controller.hpp:66
double roll_gain
Roll P gain [rad/s per rad of roll error].
Definition body_frame_specific_force_controller.hpp:33
double trim_airspeed
Trim airspeed used for BTT/STT scaling and PI gain normalization [m/s].
Definition body_frame_specific_force_controller.hpp:52
double sf_z_gain_p
Pitch body-acceleration PI: proportional gain.
Definition body_frame_specific_force_controller.hpp:40
double max_roll_angle
Maximum roll angle [deg].
Definition body_frame_specific_force_controller.hpp:35
double approach_airspeed
Definition body_frame_specific_force_controller.hpp:56
double airspeed_gain_i
Airspeed PI: integral gain.
Definition body_frame_specific_force_controller.hpp:60
Definition body_frame_specific_force_controller.hpp:71
double validated_airspeed
Airspeed used for control: measured value, or approach_airspeed fallback [m/s].
Definition body_frame_specific_force_controller.hpp:77
Eigen::Vector3d body_rates_sp
Body-rate setpoint [rad/s] in FLU convention (roll, pitch, yaw).
Definition body_frame_specific_force_controller.hpp:99
double sf_z_error_integral
Pitch PI integrator state.
Definition body_frame_specific_force_controller.hpp:93
double max_side_acceleration
Airspeed-scaled maximum side acceleration [m/s²].
Definition body_frame_specific_force_controller.hpp:83
double roll_error
Roll error input to the roll rate channel [rad].
Definition body_frame_specific_force_controller.hpp:85
double sf_sp_y_bank
Lateral specific force allocated to banking (roll) [m/s²].
Definition body_frame_specific_force_controller.hpp:79
double sf_y_error
Current lateral body acceleration error [m/s²].
Definition body_frame_specific_force_controller.hpp:89
double airspeed_error_integral
Airspeed PI integrator state [m/s].
Definition body_frame_specific_force_controller.hpp:97
double sf_sp_y_skid
Lateral specific force allocated to skidding (yaw) [m/s²].
Definition body_frame_specific_force_controller.hpp:81
double thrust_sp
Normalized thrust setpoint in [0, 1].
Definition body_frame_specific_force_controller.hpp:101
double sf_y_error_integral
Yaw PI integrator state.
Definition body_frame_specific_force_controller.hpp:91
Eigen::Vector3d sf_sp_enu
Specific force setpoint in ENU frame [m/s²].
Definition body_frame_specific_force_controller.hpp:73
Eigen::Vector3d sf_sp_body
Specific force setpoint in body FLU frame [m/s²].
Definition body_frame_specific_force_controller.hpp:75
double sf_roll_error_integral
Roll specific-force error integrator state [rad].
Definition body_frame_specific_force_controller.hpp:95
double sp_p_unlim
Pitch rate setpoint before the camera VFOV limiter is applied [rad/s].
Definition body_frame_specific_force_controller.hpp:87