WPID Library 5
|
A pure virtual class to define the behavior and attributes of a chassis. Classes that extend this class will default to the behavior defined here, which for all methods is to do nothing. More...
#include <Chassis.h>
Public Member Functions | |
virtual void | setStraightPID (PID pid)=0 |
Sets the straight PID object. | |
virtual void | setTurnPID (PID pid)=0 |
Sets the turning PID object. | |
virtual void | straight (float distance, int max_speed)=0 |
Move the chassis forward a specific distance with PID. Chassis will always stay at or below the maximum speed. | |
virtual void | straightAsync (float distance, int max_speed)=0 |
Move the chassis forward asynchronously a specific distance with PID. Chassis will always stay at or below the maximum speed. | |
virtual void | turn (int target_angle, int max_speed)=0 |
Turn the chassis on the spot with PID. Chassis will always stay at or below the maximum speed. | |
virtual void | turnAsync (float target_angle, int max_speed)=0 |
Turn the chassis on the spot asynchronously with PID. Chassis will always stay at or below the maximum speed. | |
virtual void | stop ()=0 |
Stops the chassis using the default brake mode. | |
virtual void | waitUntilSettled ()=0 |
Waits for the robot to finish a motion. | |
virtual float | getLeftPosition (vex::rotationUnits units)=0 |
Gets the current position of the left side of the chassis. | |
virtual float | getRightPosition (vex::rotationUnits units)=0 |
Gets the current position of the right side of the chassis. | |
virtual void | resetPosition ()=0 |
Reset all encoders to 0. | |
virtual void | setBrakeType (vex::brakeType type)=0 |
Sets the brake type of the chassis. | |
virtual void | setMeasurementUnits (Conversion::measurement preferred_units)=0 |
Set the measurement units for chassis values. | |
Protected Attributes | |
float | track_width |
float | wheel_circumference |
Mechanism * | left |
Mechanism * | right |
PID | pidStraight |
PID | pidTurn |
float | straight_offset = 0 |
float | turn_offset = 0 |
Conversion::measurement | measure_units = Conversion::measurement::in |
A pure virtual class to define the behavior and attributes of a chassis. Classes that extend this class will default to the behavior defined here, which for all methods is to do nothing.
|
pure virtual |
Gets the current position of the left side of the chassis.
unit | the rotation units you want to return |
Implemented in wpid::HDrive, and wpid::Tank.
|
pure virtual |
Gets the current position of the right side of the chassis.
unit | the rotation units you want to return |
Implemented in wpid::HDrive, and wpid::Tank.
|
pure virtual |
Reset all encoders to 0.
Implemented in wpid::HDrive, and wpid::Tank.
|
pure virtual |
Sets the brake type of the chassis.
type | The brake type can be set to coast, brake, or hold. |
Implemented in wpid::HDrive, and wpid::Tank.
|
pure virtual |
Set the measurement units for chassis values.
preferred_units | the user's measurement system |
Implemented in wpid::HDrive, and wpid::Tank.
|
pure virtual |
Sets the straight PID object.
pid | a PID object holding the constants for driving straight |
Implemented in wpid::HDrive, and wpid::Tank.
|
pure virtual |
Sets the turning PID object.
pid | a PID object holding the constants for turning on the spot |
Implemented in wpid::HDrive, and wpid::Tank.
|
pure virtual |
Stops the chassis using the default brake mode.
Implemented in wpid::HDrive, and wpid::Tank.
|
pure virtual |
Move the chassis forward a specific distance with PID. Chassis will always stay at or below the maximum speed.
distance | the distance in inches |
max_speed | the maximum speed the robot will travel |
Implemented in wpid::HDrive, and wpid::Tank.
|
pure virtual |
Move the chassis forward asynchronously a specific distance with PID. Chassis will always stay at or below the maximum speed.
distance | the distance in inches |
max_speed | the maximum speed the robot will travel |
Implemented in wpid::HDrive, and wpid::Tank.
|
pure virtual |
Turn the chassis on the spot with PID. Chassis will always stay at or below the maximum speed.
target_angle | the target angle in degrees |
max_speed | the maximum speed in percent units |
Implemented in wpid::HDrive, and wpid::Tank.
|
pure virtual |
Turn the chassis on the spot asynchronously with PID. Chassis will always stay at or below the maximum speed.
target_angle | the target angle in degrees |
max_speed | the maximum speed in percent units |
Implemented in wpid::HDrive, and wpid::Tank.
|
pure virtual |
Waits for the robot to finish a motion.
Implemented in wpid::HDrive, and wpid::Tank.
|
protected |
Left and Right mechanisms
|
protected |
The units used for distances
|
protected |
Offsets to fix consistent error
|
protected |
Chassis wheel circumference