Remote control message containing the remote controller state. More...
#include <creos/messages/controller_state.hpp>
Public Types | |
enum | ButtonState { kLeft = -1 , kDown = -1 , kMiddle = 0 , kReleased = 0 , kRight = 1 , kPressed = 1 , kUp = 1 , kLongPress = 2 } |
Public Member Functions | |
auto | operator<=> (const ControllerState &other) const =default |
Compare two ControllerState messages. | |
Public Attributes | |
creos::RobotClock::time_point | timestamp |
Timestamp of the remote controller state. | |
std::vector< float > | axes |
Axes data of the remote controller. | |
std::vector< ButtonState > | buttons |
Buttons data of the remote controller. | |
Remote control message containing the remote controller state.
std::vector<float> creos_messages::ControllerState::axes |
Axes data of the remote controller.
The axes are represented by floating point numbers. If the axis doesn't self center, the value will be between 0 and 1. If the axis self centers, the value will be between -1 and 1, where -1 is the left or down position and 1 is the right or up position; 0 should be the resting position. If we have a strange axis where the centering position is not in the middle, we will normalize the value so that the most extreme positions are -1 or 1, and the resting position will still be 0. Analog buttons are represented by floating point numbers between 0 and 1. Triggers that have a switch at the end of travel are an axis with an additional button.
For the Origin, the order is:
For drones the order is:
std::vector<ButtonState> creos_messages::ControllerState::buttons |
Buttons data of the remote controller.
The buttons are represented by integers, as some buttons can have multiple states. Tactile buttons are 1 for pressed, 0 for released, 2 for long press. Switches are 1 for on and 0 for off. 3-way switches are -1 for left/down, 0 for middle, and 1 for right/up.
For the Origin, the order of the buttons is: