Status of a gamepad obtained from the Meshcat javascript client.
#include <drake/geometry/meshcat.h>
Public Member Functions | |
template<typename Archive > | |
void | Serialize (Archive *a) |
Passes this object to an Archive. More... | |
Public Attributes | |
std::optional< int > | index |
An an integer that is auto-incremented to be unique for each device currently connected to the system. More... | |
std::vector< double > | button_values |
An array of floating point values representing analog buttons, such as the triggers on many modern gamepads. More... | |
std::vector< double > | axes |
An array of floating point values representing e.g. More... | |
void Serialize | ( | Archive * | a | ) |
Passes this object to an Archive.
Refer to YAML Serialization for background.
std::vector<double> axes |
An array of floating point values representing e.g.
analog thumbsticks. Each entry in the array is a floating point value in the range -1.0 – 1.0, representing the axis position from the lowest value (-1.0) to the highest value (1.0).
In the standard gamepad mapping, we have:
Note that a stick that is left alone may not output all zeros. https://beej.us/blog/data/javascript-gamepad/ gives some useful advice for applying a deadzone to these values.
std::vector<double> button_values |
An array of floating point values representing analog buttons, such as the triggers on many modern gamepads.
The values are normalized to the range [0.0, 1.0], with 0.0 representing a button that is not pressed, and 1.0 representing a button that is fully pressed.
See https://w3c.github.io/gamepad/#dfn-standard-gamepad for the standard mapping of gamepad buttons to this vector.
std::optional<int> index |
An an integer that is auto-incremented to be unique for each device currently connected to the system.
If index.has_value() == false
, then we have not yet received any gamepad status from the Meshcat browser.