Auterion App SDK
Auterion SDK is a library that can be used by AuterionOS apps to communicate with the system.
Loading...
Searching...
No Matches
local_position_assessor.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 <Eigen/Eigen>
36#include <auterion_sdk/system_state/system_state.hpp>
38#include <optional>
39
40namespace auterion {
58 float heading_error_threshold_rad{7.F * M_PI / 180.F};
66 const float position_error_threshold_m) {
67 this->position_error_threshold_m = position_error_threshold_m;
68 return *this;
69 }
70
78 this->absolute_velocity_threshold_m_s = absolute_velocity_threshold_m_s;
79 return *this;
80 }
81
90 this->absolute_acceleration_threshold_m_s2 = absolute_acceleration_threshold_m_s2;
91 return *this;
92 }
93
100 const float heading_error_threshold_rad) {
101 this->heading_error_threshold_rad = heading_error_threshold_rad;
102 return *this;
103 }
104};
105
114 public:
122 const SystemState& system_state,
124
129
137 const Eigen::Vector3f& target_local_position_m,
138 const std::optional<float> position_error_threshold_m = std::nullopt) const;
139
146 const std::optional<float> absolute_velocity_threshold_m_s = std::nullopt) const;
147
155 const std::optional<float> absolute_acceleration_threshold_m_s2 = std::nullopt) const;
156
164 const float target_heading_enu_rad,
165 const std::optional<float> heading_error_threshold_rad = std::nullopt) const;
166
167 private:
168 std::shared_ptr<SystemState> _system_state;
170};
171
173} // namespace auterion
Class for assessing various properties of LocalPosition objects.
Definition local_position_assessor.hpp:113
~LocalPositionAssessor()=default
Destructor for LocalPositionAssessor.
LocalPositionAssessor(const SystemState &system_state, const LocalPositionAssessorConfig &config=LocalPositionAssessorConfig{})
Constructor for LocalPositionAssessor.
bool isHeadingWithinThreshold(const float target_heading_enu_rad, const std::optional< float > heading_error_threshold_rad=std::nullopt) const
Check if the current heading is within specified thresholds of the target heading.
bool isPositionWithinThreshold(const Eigen::Vector3f &target_local_position_m, const std::optional< float > position_error_threshold_m=std::nullopt) const
Check if the current position is within specified thresholds of the target location.
bool isAccelerationUnderThreshold(const std::optional< float > absolute_acceleration_threshold_m_s2=std::nullopt) const
Check if the current acceleration is under the specified threshold.
bool isVelocityUnderThreshold(const std::optional< float > absolute_velocity_threshold_m_s=std::nullopt) const
Check if the current velocity is under the specified threshold.
Provides access to the system's state, including flight controller telemetry.
Definition system_state.hpp:324
Configuration structure for LocalPositionAssessor, defines default acceptance criteria for local posi...
Definition local_position_assessor.hpp:53
LocalPositionAssessorConfig & withPositionErrorThreshold(const float position_error_threshold_m)
Set the position error threshold.
Definition local_position_assessor.hpp:65
float absolute_acceleration_threshold_m_s2
Definition local_position_assessor.hpp:56
LocalPositionAssessorConfig & withHeadingErrorThreshold(const float heading_error_threshold_rad)
Set the heading error threshold.
Definition local_position_assessor.hpp:99
float absolute_velocity_threshold_m_s
Definition local_position_assessor.hpp:55
LocalPositionAssessorConfig & withAccelerationThreshold(const float absolute_acceleration_threshold_m_s2)
Set the absolute acceleration threshold.
Definition local_position_assessor.hpp:88
float heading_error_threshold_rad
Definition local_position_assessor.hpp:58
LocalPositionAssessorConfig & withVelocityThreshold(const float absolute_velocity_threshold_m_s)
Set the absolute velocity threshold.
Definition local_position_assessor.hpp:76
float position_error_threshold_m
Definition local_position_assessor.hpp:54