CreOS SDK
The CreOS SDK allows you to interact with Avular robots
 
Loading...
Searching...
No Matches
state.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 October 16
11 * Author: Niels Rood
12 *
13 * @file Messages representing the overall state of the robot
14 ****************************************************************************/
15#pragma once
16
17#include <nlohmann/json.hpp>
18#include <string>
19#include <variant>
20
21#include "generic.hpp"
22
23namespace creos_messages {
24
28struct State {
29 enum class Ready {
30 kUnknown = -1,
31 kNotReady,
32 kPreArm,
33 kActive,
34 kWaiting,
35 kFailsafe,
36 kError,
37 };
38
42 creos::RobotClock::time_point time;
43
48
52 std::string current_action;
53
57 auto operator<=>(const State& other) const = default;
58};
59
60NLOHMANN_JSON_SERIALIZE_ENUM(State::Ready, {
61 {State::Ready::kUnknown, "unknown"},
62 {State::Ready::kNotReady, "not_ready"},
63 {State::Ready::kPreArm, "pre_arm"},
64 {State::Ready::kActive, "active"},
65 {State::Ready::kWaiting, "waiting"},
66 {State::Ready::kFailsafe, "failsafe"},
67 {State::Ready::kError, "error"},
68 })
69
70NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(State, time, ready_state, current_action)
71
72} // namespace creos_messages
The messages that are used in the communication between the agent and the client.
Definition accel.hpp:22
The state of the robot.
Definition state.hpp:28
std::string current_action
A textual description of the current action the robot is performing.
Definition state.hpp:52
auto operator<=>(const State &other) const =default
Compare two messages.
creos::RobotClock::time_point time
The moment in time when the state was last updated.
Definition state.hpp:42
Ready ready_state
The ready state of the robot.
Definition state.hpp:47
Ready
Definition state.hpp:29
@ kUnknown
The ready state is unknown.
@ kFailsafe
A safety system has been triggered, and the robot is in a failsafe state.
@ kActive
The robot is ready to perform operations.
@ kNotReady
The robot is not ready to perform operations. e.g. when the robot is booting.
@ kError
The robot has a platform error and is not able to perform operations. This should not be used for sof...
@ kWaiting
The robot is operational, but waiting for user input.
@ kPreArm
The robot is in a safety state where checks are being performed. User interaction may be required.