LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
okapi::ThreeEncoderXDriveModel Class Reference

#include <threeEncoderXDriveModel.hpp>

Inheritance diagram for okapi::ThreeEncoderXDriveModel:
okapi::XDriveModel okapi::ChassisModel okapi::ReadOnlyChassisModel

Public Member Functions

 ThreeEncoderXDriveModel (std::shared_ptr< AbstractMotor > itopLeftMotor, std::shared_ptr< AbstractMotor > itopRightMotor, std::shared_ptr< AbstractMotor > ibottomRightMotor, std::shared_ptr< AbstractMotor > ibottomLeftMotor, std::shared_ptr< ContinuousRotarySensor > ileftEnc, std::shared_ptr< ContinuousRotarySensor > irightEnc, std::shared_ptr< ContinuousRotarySensor > imiddleEnc, double imaxVelocity, double imaxVoltage)
 Model for an x drive (wheels at 45 deg from a skid steer drive).
 
std::valarray< std::int32_t > getSensorVals () const override
 Read the sensors.
 
void resetSensors () override
 Reset the sensors to their zero point.
 
- Public Member Functions inherited from okapi::XDriveModel
 XDriveModel (std::shared_ptr< AbstractMotor > itopLeftMotor, std::shared_ptr< AbstractMotor > itopRightMotor, std::shared_ptr< AbstractMotor > ibottomRightMotor, std::shared_ptr< AbstractMotor > ibottomLeftMotor, std::shared_ptr< ContinuousRotarySensor > ileftEnc, std::shared_ptr< ContinuousRotarySensor > irightEnc, double imaxVelocity, double imaxVoltage)
 Model for an x drive (wheels at 45 deg from a skid steer drive).
 
void forward (double ipower) override
 Drive the robot forwards (using open-loop control).
 
void driveVector (double iforwardSpeed, double iyaw) override
 Drive the robot in an arc (using open-loop control).
 
void driveVectorVoltage (double iforwardSpeed, double iyaw) override
 Drive the robot in an arc.
 
void rotate (double ipower) override
 Turn the robot clockwise (using open-loop control).
 
void strafe (double ipower)
 Drive the robot side-ways (using open-loop control) where positive ipower is to the right and negative ipower is to the left.
 
void strafeVector (double istrafeSpeed, double iyaw)
 Strafe the robot in an arc (using open-loop control) where positive istrafeSpeed is to the right and negative istrafeSpeed is to the left.
 
void stop () override
 Stop the robot (set all the motors to 0).
 
void tank (double ileftSpeed, double irightSpeed, double ithreshold=0) override
 Drive the robot with a tank drive layout.
 
void arcade (double iforwardSpeed, double iyaw, double ithreshold=0) override
 Drive the robot with an arcade drive layout.
 
void curvature (double iforwardSpeed, double icurvature, double ithreshold=0) override
 Drive the robot with a curvature drive layout.
 
virtual void xArcade (double irightSpeed, double iforwardSpeed, double iyaw, double ithreshold=0)
 Drive the robot with an arcade drive layout.
 
virtual void fieldOrientedXArcade (double ixSpeed, double iySpeed, double iyaw, QAngle iangle, double ithreshold=0)
 Drive the robot with a field-oriented arcade drive layout.
 
void left (double ispeed) override
 Power the left side motors.
 
void right (double ispeed) override
 Power the right side motors.
 
std::valarray< std::int32_t > getSensorVals () const override
 Read the sensors.
 
void resetSensors () override
 Reset the sensors to their zero point.
 
void setBrakeMode (AbstractMotor::brakeMode mode) override
 Set the brake mode for each motor.
 
void setEncoderUnits (AbstractMotor::encoderUnits units) override
 Set the encoder units for each motor.
 
void setGearing (AbstractMotor::gearset gearset) override
 Set the gearset for each motor.
 
void setMaxVelocity (double imaxVelocity) override
 Sets a new maximum velocity in RPM.
 
double getMaxVelocity () const override
 
void setMaxVoltage (double imaxVoltage) override
 Sets a new maximum voltage in mV in the range [0-12000].
 
double getMaxVoltage () const override
 
std::shared_ptr< AbstractMotorgetTopLeftMotor () const
 Returns the top left motor.
 
std::shared_ptr< AbstractMotorgetTopRightMotor () const
 Returns the top right motor.
 
std::shared_ptr< AbstractMotorgetBottomRightMotor () const
 Returns the bottom right motor.
 
std::shared_ptr< AbstractMotorgetBottomLeftMotor () const
 Returns the bottom left motor.
 
- Public Member Functions inherited from okapi::ChassisModel
 ChassisModel ()=default
 
 ChassisModel (const ChassisModel &)=delete
 
ChassisModeloperator= (const ChassisModel &)=delete
 
- Public Member Functions inherited from okapi::ReadOnlyChassisModel
virtual ~ReadOnlyChassisModel ()=default
 

Protected Attributes

std::shared_ptr< ContinuousRotarySensormiddleSensor
 
- Protected Attributes inherited from okapi::XDriveModel
double maxVelocity
 
double maxVoltage
 
std::shared_ptr< AbstractMotortopLeftMotor
 
std::shared_ptr< AbstractMotortopRightMotor
 
std::shared_ptr< AbstractMotorbottomRightMotor
 
std::shared_ptr< AbstractMotorbottomLeftMotor
 
std::shared_ptr< ContinuousRotarySensorleftSensor
 
std::shared_ptr< ContinuousRotarySensorrightSensor
 

Detailed Description

Definition at line 11 of file threeEncoderXDriveModel.hpp.

Constructor & Destructor Documentation

◆ ThreeEncoderXDriveModel()

okapi::ThreeEncoderXDriveModel::ThreeEncoderXDriveModel ( std::shared_ptr< AbstractMotor itopLeftMotor,
std::shared_ptr< AbstractMotor itopRightMotor,
std::shared_ptr< AbstractMotor ibottomRightMotor,
std::shared_ptr< AbstractMotor ibottomLeftMotor,
std::shared_ptr< ContinuousRotarySensor ileftEnc,
std::shared_ptr< ContinuousRotarySensor irightEnc,
std::shared_ptr< ContinuousRotarySensor imiddleEnc,
double  imaxVelocity,
double  imaxVoltage 
)

Model for an x drive (wheels at 45 deg from a skid steer drive).

When all motors are powered +100%, the robot should move forward in a straight line.

Parameters
itopLeftMotorThe top left motor.
itopRightMotorThe top right motor.
ibottomRightMotorThe bottom right motor.
ibottomLeftMotorThe bottom left motor.
ileftEncThe left side encoder.
irightEncThe right side encoder.
imiddleEncThe middle encoder.

Member Function Documentation

◆ getSensorVals()

std::valarray< std::int32_t > okapi::ThreeEncoderXDriveModel::getSensorVals ( ) const
overridevirtual

Read the sensors.

Returns
sensor readings in the format {left, right, middle}

Implements okapi::ReadOnlyChassisModel.

◆ resetSensors()

void okapi::ThreeEncoderXDriveModel::resetSensors ( )
overridevirtual

Reset the sensors to their zero point.

Implements okapi::ChassisModel.

Member Data Documentation

◆ middleSensor

std::shared_ptr<ContinuousRotarySensor> okapi::ThreeEncoderXDriveModel::middleSensor
protected

Definition at line 48 of file threeEncoderXDriveModel.hpp.


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