![]() |
RaidZeroLib
Coroutine robot framework for VEX V5
|
Turns a skid-steer robot in place to face a heading, with a PID on the heading error. More...
#include <TurnController.hpp>
Classes | |
| struct | Config |
Public Member Functions | |
| TurnController (Sensor< Rotation > &heading, Config config) | |
| Task | to (SkidSteerChassis &chassis, Rotation target) |
| Turns in place to face target, the short way round. Finishes once settled. | |
Turns a skid-steer robot in place to face a heading, with a PID on the heading error.
Construct one per robot with its tuning, and pass the chassis to each turn:
TurnController turn{odometry.heading(), {.pid = {...}, .settle = {.tolerance = au::degrees(1.0), ...}}};
co_await turn.to(chassis, Rotation{au::degrees(90.0)});
co_await anyOf(turn.to(chassis, Rotation{}), sleepFor(au::seconds(1.0))); // with a timeout
| heading | Counterclockwise positive, e.g. odometry.heading() or an InertialSensor. |
|
nodiscard |
Turns in place to face target, the short way round. Finishes once settled.