TechTheTime-HighLevel 0.0.1
The high level robot's code using ros2-foxy for the robotics competition(Erobot-2022)
JoystickEvent Class Reference

Encapsulates all data relevant to a sampled joystick event. More...

#include <joystick.hpp>

Public Member Functions

bool isAxis ()
 Returns true if this event is the result of an axis movement. More...
 
bool isButton ()
 Returns true if this event is the result of a button press. More...
 
bool isInitialState ()
 Returns true if this event is part of the initial state obtained when the joystick is first connected to. More...
 

Public Attributes

unsigned char number
 The axis/button number. More...
 
unsigned int time
 The timestamp of the event, in milliseconds. More...
 
unsigned char type
 The event type. More...
 
short value
 The value associated with this joystick event. More...
 

Static Public Attributes

static const short MAX_AXES_VALUE = 32767
 Maximum value of axes range. More...
 
static const short MIN_AXES_VALUE = -32768
 Minimum value of axes range. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const JoystickEvent &e)
 The ostream inserter needs to be a friend so it can access the internal data structures. More...
 

Detailed Description

Encapsulates all data relevant to a sampled joystick event.

Member Function Documentation

◆ isAxis()

bool isAxis ( )

Returns true if this event is the result of an axis movement.

◆ isButton()

bool isButton ( )

Returns true if this event is the result of a button press.

◆ isInitialState()

bool isInitialState ( )

Returns true if this event is part of the initial state obtained when the joystick is first connected to.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const JoystickEvent e 
)
friend

The ostream inserter needs to be a friend so it can access the internal data structures.

Member Data Documentation

◆ MAX_AXES_VALUE

const short MAX_AXES_VALUE = 32767
static

Maximum value of axes range.

◆ MIN_AXES_VALUE

const short MIN_AXES_VALUE = -32768
static

Minimum value of axes range.

◆ number

unsigned char number

The axis/button number.

◆ time

unsigned int time

The timestamp of the event, in milliseconds.

◆ type

unsigned char type

The event type.

◆ value

short value

The value associated with this joystick event.

For buttons this will be either 1 (down) or 0 (up). For axes, this will range between MIN_AXES_VALUE and MAX_AXES_VALUE.


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