TRC Library for FRC (2011) 2011
TRC Library Code Project

TrcPIDDrive Class Reference

#include <TrcPIDDrive.h>

List of all members.

Public Member Functions

void TrcPIDDrive (__in RobotDrive *drive, __in TrcPIDCtrl *pidCtrlDrive, __in TrcPIDCtrl *pidCtrlTurn, __in PIDDriveNotify *notify=NULL)
 ~TrcPIDDrive (void)
void Reset (void)
void SetTarget (__in float distSetPoint, __in float distTolerance, __in float angleSetPoint, __in float angleTolerance, __in bool fStopOnTarget)
void PIDDriveTask (void)

Detailed Description

This class defines and implements the TrcPIDDrive object. It supports the capability of PID controlled drive by distance and/or PID controlled turn by angle. After the operation is completed, it has an option of calling the notification object. Therefore, it can work with the state machine to do autonomous drive.

Definition at line 64 of file TrcPIDDrive.h.

Constructor & Destructor Documentation

void TrcPIDDrive::TrcPIDDrive ( __in RobotDrive *  drive,
__in TrcPIDCtrl pidCtrlDrive,
__in TrcPIDCtrl pidCtrlTurn,
__in PIDDriveNotify notify = NULL 
) [inline]

Constructor: Create an instance of the TrcPIDDrive object that consists of a RobotDrive object, a TrcPIDCtrl object for drive, a TrcPIDCtrl object for turn and optionally a notification object for the callback.

drivePoints to the RobotDrive object.
pidCtrlDrivePoints to the TrcPIDCtrl object for drive straight.
pidCtrlTurnPoints to the TrcPIDCtrl object for turning.
notifySpecifies the optional notification object.

Definition at line 85 of file TrcPIDDrive.h.

TrcPIDDrive::~TrcPIDDrive ( void  ) [inline]

Destructor: Destroy an instance of the TrcPIDDrive object.

Definition at line 108 of file TrcPIDDrive.h.

Member Function Documentation

void TrcPIDDrive::PIDDriveTask ( void  ) [inline]

This function is called by the robot loop periodically to update the PIDDrive state and check for completion.

Definition at line 188 of file TrcPIDDrive.h.

void TrcPIDDrive::Reset ( void  ) [inline]

This function resets the PID Drive object.

Definition at line 121 of file TrcPIDDrive.h.

void TrcPIDDrive::SetTarget ( __in float  distSetPoint,
__in float  distTolerance,
__in float  angleSetPoint,
__in float  angleTolerance,
__in bool  fStopOnTarget 
) [inline]

This function sets PID drive target with the given drive distance and turn angle setpoints.

distSetPointSpecifies the target distance to travel in inches.
distToleranceSpecifies the distance toleracne when determining OnTarget.
angleSetPointSpecifies the target angle to turn in degrees.
angleToleranceSpecifies the angle tolerance when determining OnTarget.
fStopOnTargetIf true, stop PIDDrive when target is reached. Otherwise, continue to monitor the target and readjust if necessary.

Definition at line 153 of file TrcPIDDrive.h.

The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Defines