RaidZeroLib
Coroutine robot framework for VEX V5
Loading...
Searching...
No Matches
DriverControl.hpp
1#pragma once
2#include <functional>
3
4#include "RaidZeroLib/api/Chassis/SkidSteerChassis.hpp"
5#include "RaidZeroLib/api/Hardware/Controller.hpp"
6#include "RaidZeroLib/api/Runtime/Task.hpp"
7
8// Driver control schemes for a skid-steer drive. Each drives the chassis from the controller every tick and never
9// finishes: use `anyOf` for anything that should interrupt it, e.g.
10// `co_await anyOf(arcade(chassis, master), master.nextPress(Controller::Button::A))`.
11namespace rz {
12
15using StickCurve = std::function<double(double)>;
16
24
27[[nodiscard]] Task<> arcade(SkidSteerChassis& chassis, const Controller& controller, ArcadeConfig config = {});
28
29struct TankConfig {
31 double deadband = 0.05;
34};
35
37[[nodiscard]] Task<> tank(SkidSteerChassis& chassis, const Controller& controller, TankConfig config = {});
38
39} // namespace rz
A V5 controller (the handheld joystick).
Definition Controller.hpp:19
A drivetrain with a left and a right side, each driven as one motor (usually a MotorGroup).
Definition SkidSteerChassis.hpp:22
Task tank(SkidSteerChassis &chassis, const Controller &controller, TankConfig config={})
The left stick's vertical axis drives the left side; the right stick's vertical axis drives the right...
Task arcade(SkidSteerChassis &chassis, const Controller &controller, ArcadeConfig config={})
The left stick's vertical axis drives; the right stick's horizontal axis turns (pushing right turns c...
std::function< double(double)> StickCurve
Shapes a stick input. Takes and returns a value from -1 to 1, e.g. [](double x) { return x * x * x; }...
Definition DriverControl.hpp:15
corral::Task< T > Task
Lazy: nothing runs until it is co_awaited.
Definition Task.hpp:17
Definition DriverControl.hpp:11
Definition DriverControl.hpp:17
StickCurve throttleCurve
Applied after the deadband. Empty means linear.
Definition DriverControl.hpp:21
double deadband
Stick values closer to 0 than this read as 0, so a stick that does not quite center does not creep.
Definition DriverControl.hpp:19
StickCurve turnCurve
Definition DriverControl.hpp:22
Definition DriverControl.hpp:29
double deadband
Stick values closer to 0 than this read as 0, so a stick that does not quite center does not creep.
Definition DriverControl.hpp:31
StickCurve curve
Applied to both sticks after the deadband. Empty means linear.
Definition DriverControl.hpp:33