RaidZeroLib
Coroutine robot framework for VEX V5
Loading...
Searching...
No Matches
rz::DriveController Class Reference

Drives a skid-steer robot straight for a distance, with a PID on the distance and another holding the heading it started at. More...

#include <DriveController.hpp>

Classes

struct  Config

Public Member Functions

 DriveController (Sensor< Length > &travelled, Sensor< Rotation > &heading, Config config)
Task distance (SkidSteerChassis &chassis, Length distance)
 Drives distance straight ahead (backward if negative) from where the robot is. Finishes once settled.

Detailed Description

Drives a skid-steer robot straight for a distance, with a PID on the distance and another holding the heading it started at.

Construct one per robot with its tuning, and pass the chassis to each drive:

DriveController drive{odometry.distance(), odometry.heading(), {...}};
co_await drive.distance(chassis, au::inches(24.0));
co_await anyOf(drive.distance(chassis, au::inches(-12.0)), sleepFor(au::seconds(1.0)));  // with a timeout

Constructor & Destructor Documentation

◆ DriveController()

rz::DriveController::DriveController ( Sensor< Length > & travelled,
Sensor< Rotation > & heading,
Config config )
inline
Parameters
travelledHow far the robot has driven forward, e.g. odometry.distance() or a TrackingWheel.
headingCounterclockwise positive, e.g. odometry.heading() or an InertialSensor.

Member Function Documentation

◆ distance()

Task rz::DriveController::distance ( SkidSteerChassis & chassis,
Length distance )
nodiscard

Drives distance straight ahead (backward if negative) from where the robot is. Finishes once settled.


The documentation for this class was generated from the following file: