LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
chassisModel.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
10#include <array>
11#include <initializer_list>
12#include <memory>
13#include <vector>
14
15namespace okapi {
22 public:
23 explicit ChassisModel() = default;
24 ChassisModel(const ChassisModel &) = delete;
26
32 virtual void forward(double ispeed) = 0;
33
43 virtual void driveVector(double iforwardSpeed, double iyaw) = 0;
44
54 virtual void driveVectorVoltage(double iforwardSpeed, double iyaw) = 0;
55
61 virtual void rotate(double ispeed) = 0;
62
66 virtual void stop() = 0;
67
75 virtual void tank(double ileftSpeed, double irightSpeed, double ithreshold = 0) = 0;
76
84 virtual void arcade(double iforwardSpeed, double iyaw, double ithreshold = 0) = 0;
85
96 virtual void curvature(double iforwardSpeed, double icurvature, double ithreshold = 0) = 0;
97
103 virtual void left(double ispeed) = 0;
104
110 virtual void right(double ispeed) = 0;
111
115 virtual void resetSensors() = 0;
116
123
130
136 virtual void setGearing(AbstractMotor::gearset gearset) = 0;
137
146 virtual void setMaxVelocity(double imaxVelocity) = 0;
147
151 virtual double getMaxVelocity() const = 0;
152
158 virtual void setMaxVoltage(double imaxVoltage) = 0;
159
163 virtual double getMaxVoltage() const = 0;
164};
165} // namespace okapi
brakeMode
Indicates the 'brake mode' of a motor.
gearset
Indicates the internal gear ratio of a motor.
encoderUnits
Indicates the units used by the motor encoders.
A version of the ReadOnlyChassisModel that also supports write methods, such as setting motor speed.
virtual void tank(double ileftSpeed, double irightSpeed, double ithreshold=0)=0
Drive the robot with a tank drive layout.
virtual void setBrakeMode(AbstractMotor::brakeMode mode)=0
Set the brake mode for each motor.
virtual void curvature(double iforwardSpeed, double icurvature, double ithreshold=0)=0
Drive the robot with a curvature drive layout.
virtual void right(double ispeed)=0
Power the right side motors.
virtual void setMaxVoltage(double imaxVoltage)=0
Sets a new maximum voltage in mV in the range [0-12000].
virtual double getMaxVoltage() const =0
virtual void arcade(double iforwardSpeed, double iyaw, double ithreshold=0)=0
Drive the robot with an arcade drive layout.
virtual void driveVectorVoltage(double iforwardSpeed, double iyaw)=0
Drive the robot in an arc.
virtual void resetSensors()=0
Reset the sensors to their zero point.
ChassisModel(const ChassisModel &)=delete
virtual void setGearing(AbstractMotor::gearset gearset)=0
Set the gearset for each motor.
virtual void left(double ispeed)=0
Power the left side motors.
virtual void driveVector(double iforwardSpeed, double iyaw)=0
Drive the robot in an arc (using open-loop control).
virtual double getMaxVelocity() const =0
ChassisModel & operator=(const ChassisModel &)=delete
virtual void stop()=0
Stop the robot (set all the motors to 0).
ChassisModel()=default
virtual void forward(double ispeed)=0
Drive the robot forwards (using open-loop control).
virtual void setMaxVelocity(double imaxVelocity)=0
Sets a new maximum velocity in RPM.
virtual void setEncoderUnits(AbstractMotor::encoderUnits units)=0
Set the encoder units for each motor.
virtual void rotate(double ispeed)=0
Turn the robot clockwise (using open-loop control).
A version of the ChassisModel that only supports read methods, such as querying sensor values.