18#include <creos/robot_clock.hpp>
19#include <nlohmann/json.hpp>
52NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(
GnssCoordinate, latitude, longitude, altitude)
59 kInvalidCovariance = -1,
68 CovarianceType position_covariance_type = kInvalidCovariance;
76NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(
GnssPosition, coordinate, covariance, position_covariance_type)
84 double heading_covariance = 0.0;
92NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(
GnssHeading, heading, heading_covariance)
113 kNoAugmentationFix = -1,
115 kSatelliteBasedAugmentation = 1,
116 kGroundBasedAugmentation = 2
165 int satellites_visible = 0;
170 int satellites_used = 0;
179enum class GnssServiceFlags : uint32_t {
187inline constexpr bool isSet(uint32_t flags, GnssServiceFlags flag) {
188 return (
static_cast<uint32_t
>(flag) & flags) != 0;
191inline constexpr void addFlag(uint32_t& flags, GnssServiceFlags flag,
bool value) {
193 flags |=
static_cast<uint32_t
>(flag);
199inline void to_json(nlohmann::json& j,
const Gnss::Service& service) {
200 using namespace detail;
203 addFlag(flags, GnssServiceFlags::kGps, service.gps);
204 addFlag(flags, GnssServiceFlags::kGlonass, service.glonass);
205 addFlag(flags, GnssServiceFlags::kBeidou, service.beidou);
206 addFlag(flags, GnssServiceFlags::kGalileo, service.galileo);
211inline void from_json(
const nlohmann::json& j, Gnss::Service& service) {
212 using namespace detail;
214 uint32_t flags = j.get<uint32_t>();
216 service.gps = isSet(flags, GnssServiceFlags::kGps);
217 service.glonass = isSet(flags, GnssServiceFlags::kGlonass);
218 service.beidou = isSet(flags, GnssServiceFlags::kBeidou);
219 service.galileo = isSet(flags, GnssServiceFlags::kGalileo);
222NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Gnss, timestamp, frame_id, augmentation, service, position, heading, fix_status,
223 satellites_visible, satellites_used)
Matrix template for a 2D array of type T.
Definition generic.hpp:115
The messages that are used in the communication between the agent and the client.
Definition accel.hpp:22
auto operator<=>(const Service &other) const =default
Compare two Service messages.
bool glonass
The GNSS sensor is connected to GLONASS satellites.
Definition gnss.hpp:101
bool beidou
The GNSS sensor is connected to Beidou satellites.
Definition gnss.hpp:102
bool gps
The GNSS sensor is connected to GPS satellites.
Definition gnss.hpp:100
bool galileo
The GNSS sensor is connected to Galileo satellites.
Definition gnss.hpp:103
A coordinate in the GNSS system.
Definition gnss.hpp:29
double altitude
altitude [m] NaN if no altitude is available
Definition gnss.hpp:44
double longitude
longitude [degrees] Positive values are east of the prime meridian, negative values are west of the p...
Definition gnss.hpp:39
double latitude
latitude [degrees] Positive values are north of the equator, negative values are south of the equator
Definition gnss.hpp:34
auto operator<=>(const GnssCoordinate &other) const =default
Compare two GnssCoordinate messages.
The heading of the GNSS sensor.
Definition gnss.hpp:81
auto operator<=>(const GnssHeading &other) const =default
Compare two GnssHeading messages.
The GNSS message contains the GNSS data of the robot.
Definition gnss.hpp:97
auto operator<=>(const Gnss &other) const =default
Compare two Gnss messages.
creos::RobotClock::time_point timestamp
Timestamp of when sensor data was created / measured.
Definition gnss.hpp:130
Augmentation
Definition gnss.hpp:111
Service service
The service of the GNSS sensor.
Definition gnss.hpp:145
FixStatus
Definition gnss.hpp:119
std::string frame_id
Frame id of the GNSS sensor.
Definition gnss.hpp:135
GnssHeading heading
The heading of the GNSS sensor.
Definition gnss.hpp:155
GnssPosition position
The position of the GNSS sensor.
Definition gnss.hpp:150
The GNSS message contains the GNSS data of the robot.
Definition gnss.hpp:57
auto operator<=>(const GnssPosition &other) const =default
Compare two GnssPosition messages.
CovarianceType
Definition gnss.hpp:58