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

Represents a joystick device. More...

#include <joystick.hpp>

Public Member Functions

bool isFound ()
 Returns true if the joystick was found and may be used, otherwise false. More...
 
 Joystick ()
 Initialises an instance for the first joystick: /dev/input/js0. More...
 
 Joystick (int joystickNumber)
 Initialises an instance for the joystick with the specified, zero-indexed number. More...
 
 Joystick (Joystick &&)=default
 Joystick objects can be moved. More...
 
 Joystick (Joystick const &)=delete
 Joystick objects cannot be copied. More...
 
 Joystick (std::string devicePath)
 Initialises an instance for the joystick device specified. More...
 
 Joystick (std::string devicePath, bool blocking)
 Initialises an instance for the joystick device specified and provide the option of blocking I/O. More...
 
bool sample (JoystickEvent *event)
 Attempts to populate the provided JoystickEvent instance with data from the joystick. More...
 
 ~Joystick ()
 

Private Member Functions

void openPath (std::string devicePath, bool blocking=false)
 

Private Attributes

int _fd
 

Detailed Description

Represents a joystick device.

Allows data to be sampled from it.

Constructor & Destructor Documentation

◆ ~Joystick()

~Joystick ( )

◆ Joystick() [1/6]

Joystick ( )

Initialises an instance for the first joystick: /dev/input/js0.

◆ Joystick() [2/6]

Joystick ( int  joystickNumber)

Initialises an instance for the joystick with the specified, zero-indexed number.

◆ Joystick() [3/6]

Joystick ( std::string  devicePath)

Initialises an instance for the joystick device specified.

◆ Joystick() [4/6]

Joystick ( Joystick const &  )
delete

Joystick objects cannot be copied.

◆ Joystick() [5/6]

Joystick ( Joystick &&  )
default

Joystick objects can be moved.

◆ Joystick() [6/6]

Joystick ( std::string  devicePath,
bool  blocking 
)

Initialises an instance for the joystick device specified and provide the option of blocking I/O.

Member Function Documentation

◆ isFound()

bool isFound ( )

Returns true if the joystick was found and may be used, otherwise false.

◆ openPath()

void openPath ( std::string  devicePath,
bool  blocking = false 
)
private

◆ sample()

bool sample ( JoystickEvent event)

Attempts to populate the provided JoystickEvent instance with data from the joystick.

Returns true if data is available, otherwise false.

Member Data Documentation

◆ _fd

int _fd
private

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