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
31 public:
32 struct Parameters {
34 double roll_gain{0.0};
36 double max_roll_angle{45.0};
38 double sf_roll_i_gain{0.0};
39
41 double sf_z_gain_p{0.0};
43 double sf_z_gain_i{0.0};
44
46 double sf_y_gain_p{0.0};
48 double sf_y_gain_i{0.0};
49
51 double max_side_acc_trim{0.0};
53 double trim_airspeed{20.0};
54
56 double approach_airspeed{20.0};
57
66 double camera_tilt{0.0};
67 };
68
69 struct State {
71 Eigen::Vector3d sf_sp_enu{Eigen::Vector3d::Zero()};
73 Eigen::Vector3d sf_sp_body{Eigen::Vector3d::Zero()};
75 double validated_airspeed{0.0};
77 double sf_sp_y_bank{0.0};
79 double sf_sp_y_skid{0.0};
83 double roll_error{0.0};
85 double sp_p_unlim{0.0};
88 double sp_y_unlim{0.0};
90 double sf_y_error{0.0};
92 double sf_y_i{0.0};
94 double sf_z_i{0.0};
96 double sf_roll_i{0.0};
98 Eigen::Vector3d body_rates_sp{Eigen::Vector3d::Zero()};
99 };
100
105 explicit BodyFrameSpecificForceController(const Parameters& parameters);
106
111 void setParameters(const Parameters& parameters);
112
127 void update(double dt, const Eigen::Vector3d& acc_sp_enu,
128 const Eigen::Quaterniond& attitude_enu, const Eigen::Vector3d& specific_force_flu,
129 std::optional<double> true_airspeed,
130 std::optional<Eigen::Vector3d> los = std::nullopt);
131
135 const State& state() const;
136
137 private:
138 std::shared_ptr<BodyFrameSpecificForceControllerImpl> _impl;
139};
140
141} // 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:30
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:32
double yaw_lim_camera_horizontal_fov
Definition body_frame_specific_force_controller.hpp:64
double sf_y_gain_i
Yaw body-acceleration PI: integral gain.
Definition body_frame_specific_force_controller.hpp:48
double sf_roll_i_gain
Integral gain for specific-force-based roll error compensation.
Definition body_frame_specific_force_controller.hpp:38
double sf_z_gain_i
Pitch body-acceleration PI: integral gain.
Definition body_frame_specific_force_controller.hpp:43
double camera_tilt
Camera pitch angle relative to the drone body frame, positive upward [deg].
Definition body_frame_specific_force_controller.hpp:66
double sf_y_gain_p
Yaw body-acceleration PI: proportional gain.
Definition body_frame_specific_force_controller.hpp:46
double max_side_acc_trim
Maximum side-slip acceleration at trim airspeed [m/s²].
Definition body_frame_specific_force_controller.hpp:51
double pitch_lim_camera_vertical_fov
Definition body_frame_specific_force_controller.hpp:60
double roll_gain
Roll P gain [rad/s per rad of roll error].
Definition body_frame_specific_force_controller.hpp:34
double trim_airspeed
Trim airspeed used for BTT/STT scaling and PI gain normalization [m/s].
Definition body_frame_specific_force_controller.hpp:53
double sf_z_gain_p
Pitch body-acceleration PI: proportional gain.
Definition body_frame_specific_force_controller.hpp:41
double max_roll_angle
Maximum roll angle [deg].
Definition body_frame_specific_force_controller.hpp:36
double approach_airspeed
Approach airspeed: used as fallback when no airspeed measurement is available [m/s].
Definition body_frame_specific_force_controller.hpp:56
Definition body_frame_specific_force_controller.hpp:69
double validated_airspeed
Airspeed used for control: measured value, or approach_airspeed fallback [m/s].
Definition body_frame_specific_force_controller.hpp:75
Eigen::Vector3d body_rates_sp
Body-rate setpoint [rad/s] in FLU convention (roll, pitch, yaw).
Definition body_frame_specific_force_controller.hpp:98
double max_side_acceleration
Airspeed-scaled maximum side acceleration [m/s²].
Definition body_frame_specific_force_controller.hpp:81
double roll_error
Roll error input to the roll rate channel [rad].
Definition body_frame_specific_force_controller.hpp:83
double sf_sp_y_bank
Lateral specific force allocated to banking (roll) [m/s²].
Definition body_frame_specific_force_controller.hpp:77
double sf_y_error
Current lateral body acceleration error [m/s²].
Definition body_frame_specific_force_controller.hpp:90
double sf_y_i
Yaw PI integrator state: integral contribution to the skid yaw-rate setpoint [rad/s].
Definition body_frame_specific_force_controller.hpp:92
double sf_sp_y_skid
Lateral specific force allocated to skidding (yaw) [m/s²].
Definition body_frame_specific_force_controller.hpp:79
double sf_roll_i
Roll integrator state: roll-angle trim from the specific-force roll error [rad].
Definition body_frame_specific_force_controller.hpp:96
double sp_y_unlim
Definition body_frame_specific_force_controller.hpp:88
double sf_z_i
Pitch PI integrator state: integral contribution to the pitch-rate setpoint [rad/s].
Definition body_frame_specific_force_controller.hpp:94
Eigen::Vector3d sf_sp_enu
Specific force setpoint in ENU frame [m/s²].
Definition body_frame_specific_force_controller.hpp:71
Eigen::Vector3d sf_sp_body
Specific force setpoint in body FLU frame [m/s²].
Definition body_frame_specific_force_controller.hpp:73
double sp_p_unlim
Pitch rate setpoint before the camera VFOV limiter is applied [rad/s].
Definition body_frame_specific_force_controller.hpp:85