LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
skidSteerModel.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
11
12namespace okapi {
14 public:
24 SkidSteerModel(std::shared_ptr<AbstractMotor> ileftSideMotor,
25 std::shared_ptr<AbstractMotor> irightSideMotor,
26 std::shared_ptr<ContinuousRotarySensor> ileftEnc,
27 std::shared_ptr<ContinuousRotarySensor> irightEnc,
28 double imaxVelocity,
29 double imaxVoltage);
30
36 void forward(double ispeed) override;
37
47 void driveVector(double iySpeed, double izRotation) override;
48
58 void driveVectorVoltage(double iforwardSpeed, double iyaw) override;
59
65 void rotate(double ispeed) override;
66
70 void stop() override;
71
79 void tank(double ileftSpeed, double irightSpeed, double ithreshold = 0) override;
80
88 void arcade(double iforwardSpeed, double iyaw, double ithreshold = 0) override;
89
100 void curvature(double iforwardSpeed, double icurvature, double ithreshold = 0) override;
101
107 void left(double ispeed) override;
108
114 void right(double ispeed) override;
115
121 std::valarray<std::int32_t> getSensorVals() const override;
122
126 void resetSensors() override;
127
134
141
147 void setGearing(AbstractMotor::gearset gearset) override;
148
157 void setMaxVelocity(double imaxVelocity) override;
158
162 double getMaxVelocity() const override;
163
169 void setMaxVoltage(double imaxVoltage) override;
170
174 double getMaxVoltage() const override;
175
181 std::shared_ptr<AbstractMotor> getLeftSideMotor() const;
182
188 std::shared_ptr<AbstractMotor> getRightSideMotor() const;
189
190 protected:
193 std::shared_ptr<AbstractMotor> leftSideMotor;
194 std::shared_ptr<AbstractMotor> rightSideMotor;
195 std::shared_ptr<ContinuousRotarySensor> leftSensor;
196 std::shared_ptr<ContinuousRotarySensor> rightSensor;
197};
198} // 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.
std::shared_ptr< AbstractMotor > leftSideMotor
std::shared_ptr< AbstractMotor > getRightSideMotor() const
Returns the left side motor.
void arcade(double iforwardSpeed, double iyaw, double ithreshold=0) override
Drive the robot with an arcade drive layout.
std::shared_ptr< ContinuousRotarySensor > rightSensor
std::shared_ptr< AbstractMotor > getLeftSideMotor() const
Returns the left side motor.
void setMaxVelocity(double imaxVelocity) override
Sets a new maximum velocity in RPM.
void driveVector(double iySpeed, double izRotation) override
Drive the robot in an arc (using open-loop control).
void forward(double ispeed) override
Drive the robot forwards (using open-loop control).
double getMaxVelocity() const override
void setBrakeMode(AbstractMotor::brakeMode mode) override
Set the brake mode for each motor.
std::valarray< std::int32_t > getSensorVals() const override
Read the sensors.
std::shared_ptr< AbstractMotor > rightSideMotor
void setEncoderUnits(AbstractMotor::encoderUnits units) override
Set the encoder units for each motor.
void stop() override
Stop the robot (set all the motors to 0).
void curvature(double iforwardSpeed, double icurvature, double ithreshold=0) override
Drive the robot with a curvature drive layout.
void tank(double ileftSpeed, double irightSpeed, double ithreshold=0) override
Drive the robot with a tank drive layout.
void driveVectorVoltage(double iforwardSpeed, double iyaw) override
Drive the robot in an arc.
SkidSteerModel(std::shared_ptr< AbstractMotor > ileftSideMotor, std::shared_ptr< AbstractMotor > irightSideMotor, std::shared_ptr< ContinuousRotarySensor > ileftEnc, std::shared_ptr< ContinuousRotarySensor > irightEnc, double imaxVelocity, double imaxVoltage)
Model for a skid steer drive (wheels parallel with robot's direction of motion).
double getMaxVoltage() const override
void setMaxVoltage(double imaxVoltage) override
Sets a new maximum voltage in mV in the range [0-12000].
void setGearing(AbstractMotor::gearset gearset) override
Set the gearset for each motor.
void right(double ispeed) override
Power the right side motors.
std::shared_ptr< ContinuousRotarySensor > leftSensor
void rotate(double ispeed) override
Turn the robot clockwise (using open-loop control).
void left(double ispeed) override
Power the left side motors.
void resetSensors() override
Reset the sensors to their zero point.