RaidZeroLib
Coroutine robot framework for VEX V5
Loading...
Searching...
No Matches
SimulationController.hpp
1#pragma once
2#include <cstddef>
3
4#include "RaidZeroLib/api/Hardware/Controller.hpp"
5
6namespace rz {
7
9class SimulationController final : public Controller {
10 public:
11 SimulationController() : Controller("SimulationController") { state.connected = true; }
12
13 void setStick(Stick stick, double value) { state.sticks[static_cast<std::size_t>(stick)] = value; }
14 void setButton(Button button, bool down) { state.buttons[static_cast<std::size_t>(button)] = down; }
15 void setConnected(bool connected) { state.connected = connected; }
16
17 private:
18 [[nodiscard]] State read() override { return state; }
19
20 State state;
21};
22
23} // namespace rz
double stick(Stick stick) const
How far the stick is pushed, from -1 to 1. Right and up are positive.
Definition Controller.hpp:28
virtual State read()=0
Reads the controller now. Sticks from -1 to 1.
Button
Definition Controller.hpp:22
Stick
Definition Controller.hpp:21
bool connected() const
Definition Controller.hpp:39
Controller(std::string_view name)
Definition Controller.hpp:52
void setConnected(bool connected)
Definition SimulationController.hpp:15
SimulationController()
Definition SimulationController.hpp:11
void setStick(Stick stick, double value)
Definition SimulationController.hpp:13
void setButton(Button button, bool down)
Definition SimulationController.hpp:14
Definition DriverControl.hpp:11