TechTheTime-HighLevel 0.0.1
The high level robot's code using ros2-foxy for the robotics competition(Erobot-2022)
|
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 |
Represents a joystick device.
Allows data to be sampled from it.
~Joystick | ( | ) |
Joystick | ( | ) |
Initialises an instance for the first joystick: /dev/input/js0.
Joystick | ( | int | joystickNumber | ) |
Initialises an instance for the joystick with the specified, zero-indexed number.
Joystick | ( | std::string | devicePath | ) |
Initialises an instance for the joystick device specified.
Joystick | ( | std::string | devicePath, |
bool | blocking | ||
) |
Initialises an instance for the joystick device specified and provide the option of blocking I/O.
bool isFound | ( | ) |
Returns true if the joystick was found and may be used, otherwise false.
|
private |
bool sample | ( | JoystickEvent * | event | ) |
Attempts to populate the provided JoystickEvent instance with data from the joystick.
Returns true if data is available, otherwise false.
|
private |