LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
controller.hpp
Go to the documentation of this file.
1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 */
6#pragma once
7
8#include "api.h"
11#include <array>
12
13namespace okapi {
15 public:
17
18 virtual ~Controller();
19
25 virtual bool isConnected();
26
34 virtual float getAnalog(ControllerAnalog ichannel);
35
43 virtual bool getDigital(ControllerDigital ibutton);
44
52
61 virtual std::int32_t setText(std::uint8_t iline, std::uint8_t icol, std::string itext);
62
69 virtual std::int32_t clear();
70
77 virtual std::int32_t clearLine(std::uint8_t iline);
78
91 virtual std::int32_t rumble(std::string irumblePattern);
92
101 virtual std::int32_t getBatteryCapacity();
102
111 virtual std::int32_t getBatteryLevel();
112
113 protected:
115 pros::controller_id_e_t prosId;
116 std::array<ControllerButton *, 12> buttonArray{};
117};
118} // namespace okapi
PROS API header provides high-level user functionality.
virtual std::int32_t rumble(std::string irumblePattern)
Rumble the controller.
virtual ControllerButton & operator[](ControllerDigital ibtn)
Returns a ControllerButton for the given button on this controller.
virtual std::int32_t setText(std::uint8_t iline, std::uint8_t icol, std::string itext)
Sets text to the controller LCD screen.
pros::controller_id_e_t prosId
virtual float getAnalog(ControllerAnalog ichannel)
Returns the current analog reading for the channel in the range [-1, 1].
virtual std::int32_t clear()
Clears all of the lines of the controller screen.
virtual bool getDigital(ControllerDigital ibutton)
Returns whether the digital button is currently pressed.
std::array< ControllerButton *, 12 > buttonArray
virtual std::int32_t clearLine(std::uint8_t iline)
Clears an individual line of the controller screen.
virtual std::int32_t getBatteryCapacity()
Gets the battery capacity of the given controller.
Controller(ControllerId iid=ControllerId::master)
ControllerId okapiId
virtual bool isConnected()
Returns whether the controller is connected.
virtual ~Controller()
virtual std::int32_t getBatteryLevel()
Gets the battery level of the given controller.
ControllerId
Which controller role this has.
ControllerDigital
Various buttons.
ControllerAnalog
The analog sticks.