RaidZeroLib
Coroutine robot framework for VEX V5
Toggle main menu visibility
Loading...
Searching...
No Matches
DriveController.hpp
1
#pragma once
2
#include "RaidZeroLib/api/Chassis/SkidSteerChassis.hpp"
3
#include "RaidZeroLib/api/Control/Pid.hpp"
4
#include "RaidZeroLib/api/Control/Settled.hpp"
5
#include "RaidZeroLib/api/Geometry/Rotation.hpp"
6
#include "RaidZeroLib/api/Hardware/Sensor.hpp"
7
#include "RaidZeroLib/api/Runtime/Task.hpp"
8
#include "RaidZeroLib/api/Units/Units.hpp"
9
10
namespace
rz
{
11
22
class
DriveController
{
23
public
:
24
struct
Config
{
25
Pid<Length, Voltage>::Config
distancePid
;
27
Settled<Length>::Config
settle
;
29
Pid<Angle, Voltage>::Config
headingPid
{};
31
Voltage
maxVoltage
= au::volts(12.0);
32
};
33
36
DriveController
(
Sensor<Length>
& travelled,
Sensor<Rotation>
& heading,
Config
config)
37
: travelled(travelled), heading(heading), config(config) {}
38
41
[[nodiscard]]
Task<>
distance
(
SkidSteerChassis
& chassis,
Length
distance
);
42
43
private
:
44
Sensor<Length>
& travelled;
45
Sensor<Rotation>
& heading;
46
Config
config;
47
};
48
49
}
// namespace rz
rz::DriveController::DriveController
DriveController(Sensor< Length > &travelled, Sensor< Rotation > &heading, Config config)
Definition
DriveController.hpp:36
rz::DriveController::distance
Task distance(SkidSteerChassis &chassis, Length distance)
Drives distance straight ahead (backward if negative) from where the robot is. Finishes once settled.
rz::Sensor
A reading from hardware, or computed from other sensors.
Definition
Sensor.hpp:25
rz::SkidSteerChassis
A drivetrain with a left and a right side, each driven as one motor (usually a MotorGroup).
Definition
SkidSteerChassis.hpp:22
rz::Task
corral::Task< T > Task
Lazy: nothing runs until it is co_awaited.
Definition
Task.hpp:17
rz::Voltage
au::QuantityD< au::Volts > Voltage
Definition
Units.hpp:15
rz::Length
au::QuantityD< au::Meters > Length
Definition
Units.hpp:9
rz
Definition
DriverControl.hpp:11
rz::DriveController::Config
Definition
DriveController.hpp:24
rz::DriveController::Config::headingPid
Pid< Angle, Voltage >::Config headingPid
Keeps the robot pointing the way it started. Zero gains drive without correcting the heading.
Definition
DriveController.hpp:29
rz::DriveController::Config::settle
Settled< Length >::Config settle
When the drive is done, e.g. within 1 cm for 100 ms.
Definition
DriveController.hpp:27
rz::DriveController::Config::maxVoltage
Voltage maxVoltage
The most voltage used for driving forward; the heading correction comes on top.
Definition
DriveController.hpp:31
rz::DriveController::Config::distancePid
Pid< Length, Voltage >::Config distancePid
Definition
DriveController.hpp:25
rz::Pid::Config
Definition
Pid.hpp:29
rz::Settled::Config
Definition
Settled.hpp:16
RaidZeroLib
api
Motion
DriveController.hpp
Generated by
1.18.0