WPID Library 5
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
wpid::Chassis Class Referenceabstract

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>

Inheritance diagram for wpid::Chassis:
wpid::Tank wpid::HDrive

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
 
Mechanismleft
 
Mechanismright
 
PID pidStraight
 
PID pidTurn
 
float straight_offset = 0
 
float turn_offset = 0
 
Conversion::measurement measure_units = Conversion::measurement::in
 

Detailed Description

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.

Member Function Documentation

◆ getLeftPosition()

virtual float wpid::Chassis::getLeftPosition ( vex::rotationUnits  units)
pure virtual

Gets the current position of the left side of the chassis.

Parameters
unitthe rotation units you want to return
Returns
the position in the specified units

Implemented in wpid::HDrive, and wpid::Tank.

◆ getRightPosition()

virtual float wpid::Chassis::getRightPosition ( vex::rotationUnits  units)
pure virtual

Gets the current position of the right side of the chassis.

Parameters
unitthe rotation units you want to return
Returns
the position in the specified units

Implemented in wpid::HDrive, and wpid::Tank.

◆ resetPosition()

virtual void wpid::Chassis::resetPosition ( )
pure virtual

Reset all encoders to 0.

Implemented in wpid::HDrive, and wpid::Tank.

◆ setBrakeType()

virtual void wpid::Chassis::setBrakeType ( vex::brakeType  type)
pure virtual

Sets the brake type of the chassis.

Parameters
typeThe brake type can be set to coast, brake, or hold.

Implemented in wpid::HDrive, and wpid::Tank.

◆ setMeasurementUnits()

virtual void wpid::Chassis::setMeasurementUnits ( Conversion::measurement  preferred_units)
pure virtual

Set the measurement units for chassis values.

Parameters
preferred_unitsthe user's measurement system

Implemented in wpid::HDrive, and wpid::Tank.

◆ setStraightPID()

virtual void wpid::Chassis::setStraightPID ( PID  pid)
pure virtual

Sets the straight PID object.

Parameters
pida PID object holding the constants for driving straight

Implemented in wpid::HDrive, and wpid::Tank.

◆ setTurnPID()

virtual void wpid::Chassis::setTurnPID ( PID  pid)
pure virtual

Sets the turning PID object.

Parameters
pida PID object holding the constants for turning on the spot

Implemented in wpid::HDrive, and wpid::Tank.

◆ stop()

virtual void wpid::Chassis::stop ( )
pure virtual

Stops the chassis using the default brake mode.

Implemented in wpid::HDrive, and wpid::Tank.

◆ straight()

virtual void wpid::Chassis::straight ( float  distance,
int  max_speed 
)
pure virtual

Move the chassis forward a specific distance with PID. Chassis will always stay at or below the maximum speed.

Parameters
distancethe distance in inches
max_speedthe maximum speed the robot will travel

Implemented in wpid::HDrive, and wpid::Tank.

◆ straightAsync()

virtual void wpid::Chassis::straightAsync ( float  distance,
int  max_speed 
)
pure virtual

Move the chassis forward asynchronously a specific distance with PID. Chassis will always stay at or below the maximum speed.

Parameters
distancethe distance in inches
max_speedthe maximum speed the robot will travel

Implemented in wpid::HDrive, and wpid::Tank.

◆ turn()

virtual void wpid::Chassis::turn ( int  target_angle,
int  max_speed 
)
pure virtual

Turn the chassis on the spot with PID. Chassis will always stay at or below the maximum speed.

Parameters
target_anglethe target angle in degrees
max_speedthe maximum speed in percent units

Implemented in wpid::HDrive, and wpid::Tank.

◆ turnAsync()

virtual void wpid::Chassis::turnAsync ( float  target_angle,
int  max_speed 
)
pure virtual

Turn the chassis on the spot asynchronously with PID. Chassis will always stay at or below the maximum speed.

Parameters
target_anglethe target angle in degrees
max_speedthe maximum speed in percent units

Implemented in wpid::HDrive, and wpid::Tank.

◆ waitUntilSettled()

virtual void wpid::Chassis::waitUntilSettled ( )
pure virtual

Waits for the robot to finish a motion.

Implemented in wpid::HDrive, and wpid::Tank.

Member Data Documentation

◆ left

Mechanism* wpid::Chassis::left
protected

Left and Right mechanisms

◆ measure_units

Conversion::measurement wpid::Chassis::measure_units = Conversion::measurement::in
protected

The units used for distances

◆ pidStraight

PID wpid::Chassis::pidStraight
protected

PID objects for straight and turning motion

◆ straight_offset

float wpid::Chassis::straight_offset = 0
protected

Offsets to fix consistent error

◆ track_width

float wpid::Chassis::track_width
protected

Chassis track width for Tank drive

◆ wheel_circumference

float wpid::Chassis::wheel_circumference
protected

Chassis wheel circumference


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