![]() |
RaidZeroLib
Coroutine robot framework for VEX V5
|
A V5 controller (the handheld joystick). More...
#include <Controller.hpp>
Classes | |
| struct | State |
| Everything read from the controller in one tick. More... | |
Public Types | |
| enum class | Stick : std::uint8_t { LeftX , LeftY , RightX , RightY } |
| enum class | Button : std::uint8_t { L1 , L2 , R1 , R2 , Up , Down , Left , Right , X , B , Y , A } |
Public Member Functions | |
| double | stick (Stick stick) const |
| How far the stick is pushed, from -1 to 1. Right and up are positive. | |
| bool | held (Button button) const |
| Whether the button is down. | |
| bool | pressed (Button button) const |
| Whether the button went down this tick. | |
| bool | connected () const |
| Task | nextPress (Button button) |
| Waits for the next press of button, in a later tick than this one. Checked at estimatorsUpdated. | |
| Public Member Functions inherited from rz::Component | |
| Component (const Component &)=delete | |
| Component & | operator= (const Component &)=delete |
| Component (Component &&)=delete | |
| Component & | operator= (Component &&)=delete |
| virtual | ~Component () |
| std::string_view | name () const noexcept |
| Used in log and error messages. | |
Static Public Attributes | |
| static constexpr std::size_t | STICK_COUNT = 4 |
| static constexpr std::size_t | BUTTON_COUNT = 12 |
Protected Member Functions | |
| Controller (std::string_view name) | |
| virtual State | read ()=0 |
| Reads the controller now. Sticks from -1 to 1. | |
| Protected Member Functions inherited from rz::Component | |
| Component (std::string_view name) | |
Additional Inherited Members | |
| Static Public Member Functions inherited from rz::Component | |
| static Task | runAll () |
| Runs the loop of every component constructed so far, in construction order, until cancelled. rz::robot runs it; tests without rz::robot run it alongside their script. | |
A V5 controller (the handheld joystick).
A component that reads the controller at tickStarted(), so every reading in a tick is the same. While it is disconnected, sticks read 0 and buttons read released, so a controller that drops out stops the robot instead of repeating its last input.
|
strong |
|
strong |
|
inlineexplicitprotected |
|
inlinenodiscard |
|
inlinenodiscard |
Whether the button is down.
Waits for the next press of button, in a later tick than this one. Checked at estimatorsUpdated.
|
inlinenodiscard |
Whether the button went down this tick.
|
nodiscardprotectedpure virtual |
Reads the controller now. Sticks from -1 to 1.
|
inlinenodiscard |
How far the stick is pushed, from -1 to 1. Right and up are positive.
|
staticconstexpr |
|
staticconstexpr |