CreOS SDK
The CreOS SDK allows you to interact with Avular robots
 
Loading...
Searching...
No Matches
controller_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 July 18
11 * Author: Robbert-Jan de Jager
12 *
13 * @file Remote control message containing the remote controller state
14 ****************************************************************************/
15#pragma once
16
17#include <compare>
18#include <creos/robot_clock.hpp>
19#include <nlohmann/json.hpp>
20#include <vector>
21
22#include "generic.hpp"
23
24namespace creos_messages {
25
30
31 enum ButtonState {
32 kLeft = -1,
33 kDown = -1, // Same as left
34 kMiddle = 0,
35 kReleased = 0, // Same as middle
36 kRight = 1,
37 kPressed = 1, // Same as right
38 kUp = 1, // Same as right
39 kLongPress = 2,
40 };
41
45 creos::RobotClock::time_point timestamp;
46
86 std::vector<float> axes;
87
123 std::vector<ButtonState> buttons;
124
128 auto operator<=>(const ControllerState& other) const = default;
129};
130
131NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ControllerState, timestamp, axes, buttons)
132
133} // namespace creos_messages
The messages that are used in the communication between the agent and the client.
Definition accel.hpp:22
Remote control message containing the remote controller state.
Definition controller_state.hpp:29
std::vector< ButtonState > buttons
Buttons data of the remote controller.
Definition controller_state.hpp:123
auto operator<=>(const ControllerState &other) const =default
Compare two ControllerState messages.
creos::RobotClock::time_point timestamp
Timestamp of the remote controller state.
Definition controller_state.hpp:45
std::vector< float > axes
Axes data of the remote controller.
Definition controller_state.hpp:86