CreOS SDK
The CreOS SDK allows you to interact with Avular robots
 
Loading...
Searching...
No Matches
range.hpp
1// Copyright (C) 2024 Avular Holding B.V. - All Rights Reserved
2// You may use this code under the terms of the Avular
3// Software End-User License Agreement.
4//
5// You should have received a copy of the Avular
6// Software End-User License Agreement license with
7// this file, or download it from: avular.com/eula
8//
9/*****************************************************************************
10 * Created on: 2024 July 22
11 * Author: Robbert-Jan de Jager
12 *
13 * Implementation of the range message.
14 ****************************************************************************/
15#pragma once
16
17#include <array>
18#include <creos/robot_clock.hpp>
19#include <nlohmann/json.hpp>
20
21#include "generic.hpp"
22
23namespace creos_messages {
24
28struct Range {
29
30 enum Type {
31 kUnknown = -1,
32 kUltrasonic = 0,
33 kInfrared,
34 };
35
39 creos::RobotClock::time_point timestamp;
40
44 std::string frame_id;
45
49 Type type = kUnknown;
50
54 float range = 0;
55
59 float field_of_view = 0;
60
64 float min_range = 0;
65
69 float max_range = INFINITY;
70
74 auto operator<=>(const Range& other) const = default;
75};
76
77NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Range, timestamp, type, range, field_of_view, min_range, max_range)
78
79
82enum class RangeSensorId {
83 kDownwardsLidar = 0,
84};
85
86} // namespace creos_messages
87
88DEFINE_ENUM_STRING_CONVERSIONS(creos_messages::RangeSensorId,
The messages that are used in the communication between the agent and the client.
Definition accel.hpp:22
RangeSensorId
Range sensor id.
Definition range.hpp:82
@ kDownwardsLidar
Downwards facing lidar.
Range message containing the range measurement of a sensor.
Definition range.hpp:28
auto operator<=>(const Range &other) const =default
Compare two messages.
float max_range
maximum range of the sensor [m]
Definition range.hpp:69
creos::RobotClock::time_point timestamp
Timestamp of the range measurement.
Definition range.hpp:39
std::string frame_id
Frame id of the sensor.
Definition range.hpp:44
float range
Range measurement [m].
Definition range.hpp:54
Type type
Type of the range sensor.
Definition range.hpp:49
float min_range
minimum range of the sensor [m]
Definition range.hpp:64
float field_of_view
Field of view of the sensor [rad].
Definition range.hpp:59