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_dynamics_control.hpp
1/****************************************************************************
2 *
3 * Copyright 2023 Auterion AG. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this
9 * list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its contributors
16 * may be used to endorse or promote products derived from this software without
17 * specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 ****************************************************************************/
32
33#pragma once
34
35#include <eigen3/Eigen/Eigen>
36#include <functional>
37#include <memory>
38#include <variant>
39
40#include "../../auterion.hpp"
41
42namespace auterion {
43namespace multicopter {
55 private:
56 Eigen::Vector3f _velocity_body_flu_m_s = {NAN, NAN, NAN};
57 Eigen::Vector3f _acceleration_body_flu_m_s2 = {NAN, NAN, NAN};
58 float _heading_rad = NAN;
59 float _heading_rate_rad_s = NAN;
60
61 public:
65 class Config {};
66
67 BodyFrameDynamicsSetpoint() = default;
68
69 inline Eigen::Vector3f getVelocity() const { return _velocity_body_flu_m_s; }
70
71 inline Eigen::Vector3f getAcceleration() const { return _acceleration_body_flu_m_s2; }
72
73 inline float getHeading() const { return _heading_rad; }
74
75 inline float getHeadingRate() const { return _heading_rate_rad_s; }
76
77 inline BodyFrameDynamicsSetpoint& withAcceleration(
78 const Eigen::Vector3f& acceleration_body_flu_m_s2) {
79 _acceleration_body_flu_m_s2 = acceleration_body_flu_m_s2;
80 return *this;
81 }
82
83 inline BodyFrameDynamicsSetpoint& withHorizontalAcceleration(
84 const Eigen::Vector2f& acceleration_body_flu_m_s2) {
85 _acceleration_body_flu_m_s2.x() = acceleration_body_flu_m_s2.x();
86 _acceleration_body_flu_m_s2.y() = acceleration_body_flu_m_s2.y();
87 return *this;
88 }
89
90 inline BodyFrameDynamicsSetpoint& withVerticalAcceleration(float acceleration_body_flu_m_s2) {
91 _acceleration_body_flu_m_s2.z() = acceleration_body_flu_m_s2;
92 return *this;
93 }
94
95 inline BodyFrameDynamicsSetpoint& withVelocity(const Eigen::Vector3f& velocity_body_flu_m_s) {
96 _velocity_body_flu_m_s = velocity_body_flu_m_s;
97 return *this;
98 }
99
100 inline BodyFrameDynamicsSetpoint& withHorizontalVelocity(
101 const Eigen::Vector2f& velocity_body_flu_m_s) {
102 _velocity_body_flu_m_s.x() = velocity_body_flu_m_s.x();
103 _velocity_body_flu_m_s.y() = velocity_body_flu_m_s.y();
104 return *this;
105 }
106
107 inline BodyFrameDynamicsSetpoint& withVerticalVelocity(float velocity_body_flu_m_s) {
108 _velocity_body_flu_m_s.z() = velocity_body_flu_m_s;
109 return *this;
110 }
111
112 inline BodyFrameDynamicsSetpoint& withHeading(float heading_rad) {
113 _heading_rad = heading_rad;
114 return *this;
115 }
116
117 inline BodyFrameDynamicsSetpoint& withHeadingRate(float heading_rate_rad_s) {
118 _heading_rate_rad_s = heading_rate_rad_s;
119 return *this;
120 }
121};
122
124} // namespace multicopter
125} // namespace auterion
Placeholder config.
Definition body_frame_dynamics_control.hpp:65
Represents a setpoint to control velocity, accleration, heading and angular rate in body frame.
Definition body_frame_dynamics_control.hpp:54