Auterion App SDK
Auterion SDK is a library that can be used by AuterionOS apps to communicate with the system.
Loading...
Searching...
No Matches
global_navigation.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 <memory>
36#include <optional>
37#include <rclcpp/rclcpp.hpp>
38
39namespace auterion {
49 private:
50 rclcpp::Time timestamp;
52 std::optional<double> latitude_deg{std::nullopt};
53 std::optional<double> longitude_deg{std::nullopt};
54 std::optional<float> horizontal_variance_m2{
55 std::nullopt};
57 std::optional<float> altitude_amsl_m{
58 std::nullopt};
59 std::optional<float> vertical_variance_m2{
60 std::nullopt};
62 friend class GlobalNavigationInterfaceImpl;
63
64 public:
66 static constexpr float DEFAULT_POSITION_VARIANCE = 0.81;
67
68 GlobalPositionMeasurement(const rclcpp::Time& measurement_time);
69
71
73
82 const double latitude, const double longitude,
83 const float horizontal_variance = DEFAULT_POSITION_VARIANCE);
84
92 const float altitude_amsl, const float vertical_variance = DEFAULT_POSITION_VARIANCE);
93};
94
95class SDK;
96
97class GlobalNavigationInterfaceImpl;
98
104 public:
106
107 ~GlobalNavigationInterface() = default;
108
113 void update(const GlobalPositionMeasurement& measurement);
114
123
124 private:
125 std::shared_ptr<GlobalNavigationInterfaceImpl> _impl;
126};
127
129} // namespace auterion
Interface to inject global position measurements to the flight controller's state estimator.
Definition global_navigation.hpp:103
void reset_horizontal_position()
Notify the FMU that the global position estimate for horizontal position (latitude and longitude) has...
void update(const GlobalPositionMeasurement &measurement)
Send a global position update to the state estimator.
Global position measurement class with a horizontal position (latitude and longitude),...
Definition global_navigation.hpp:48
static constexpr float DEFAULT_POSITION_VARIANCE
Definition global_navigation.hpp:66
GlobalPositionMeasurement & withAltitude(const float altitude_amsl, const float vertical_variance=DEFAULT_POSITION_VARIANCE)
Set the measured altitude.
GlobalPositionMeasurement & withPosition(const double latitude, const double longitude, const float horizontal_variance=DEFAULT_POSITION_VARIANCE)
Set the measured horizontal position.
SDK execution class. All callbacks are called on the same thread.
Definition auterion.hpp:97