CreOS SDK
The CreOS SDK allows you to interact with Avular robots
 
Loading...
Searching...
No Matches
creos_messages::ControllerState Struct Reference

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.
 

Detailed Description

Remote control message containing the remote controller state.

Member Data Documentation

◆ axes

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:

  • Left stick x
  • Left stick y
  • Right stick x
  • Right stick y
  • Left trigger
  • Right trigger

For drones the order is:

  • Roll
  • Pitch
  • Throttle
  • Yaw
  • Wheels
  • Analog buttons The selected mode for the drone does not impact the order of the axes.

◆ buttons

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:

  • L1
  • R1
  • L2
  • R2
  • Share
  • Options
  • PS
  • L3
  • R3
  • D-pad left
  • D-pad up
  • D-pad right
  • D-pad down

The documentation for this struct was generated from the following file: