TrcDrive Class Reference

#include <TrcDrive.h>

List of all members.

Public Member Functions

 TrcDrive (__in UINT32 leftMotor, __in UINT32 rightMotor, __in DriveNotify *notify=NULL, __in float sensitivity=0.5)
 TrcDrive (__in UINT32 frontLeftMotor, __in UINT32 rearLeftMotor, __in UINT32 frontRightMotor, __in UINT32 rearRightMotor, __in DriveNotify *notify=NULL, __in float sensitivity=0.5)
 TrcDrive (__in SpeedController *leftMotor, __in SpeedController *rightMotor, __in DriveNotify *notify=NULL, __in float sensitivity=0.5)
 TrcDrive (__in SpeedController *frontLeftMotor, __in SpeedController *rearLeftMotor, __in SpeedController *frontRightMotor, __in SpeedController *rearRightMotor, __in DriveNotify *notify=NULL, __in float sensitivity=0.5)
 ~TrcDrive (void)
void SetDriveStop (void)
void SetTankDrive (__in float powerLeft, __in float powerRight)
void SetArcadeDrive (__in float powerDrive, __in float powerTurn)
void SetMecanumDrive (__in float powerDrive, __in float direction, __in float powerTurn)
void SetPIDDrive (__in TrcPIDControl *pidDrive, __in TrcPIDControl *pidTurn, __in float distance, __in float direction, __in float turn, __in float toleranceDrive, __in float toleranceTurn, __in float settlingPeriod, __in float timeout)
void SetPIDDistance (__in TrcPIDControl *pidDrive, __in float distance, __in float direction, __in float tolerance, __in float settlingPeriod, __in float timeout)
void SetPIDAngle (__in TrcPIDControl *pidTurn, __in float angle, __in float tolerance, __in float settlingPeriod, __in float timeout)
float GetDirection (void)
void DriveTask (void)

Detailed Description

This class defines and implements the TrcDrive object. This object inherits the RobotDrive objects from the WPI library. It added the capability of supporting PID controlled drive by distance or PID controlled turn by angle. After the operation is completed, it will call the notification object. Therefore, it can work with the state machine to do autonomous drive.


Constructor & Destructor Documentation

TrcDrive::TrcDrive ( __in UINT32  leftMotor,
__in UINT32  rightMotor,
__in DriveNotify notify = NULL,
__in float  sensitivity = 0.5 
) [inline]

Constructor: Create an instance of the 2-wheel TrcDrive object given the left and right motor PWM channels.

Parameters:
leftMotor Specifies the left motor PWM channel.
rightMotor Specifies the right motor PWM channel.
notify Specifies the optional notification object.
sensitivity Specifies the turning sensitivity.
TrcDrive::TrcDrive ( __in UINT32  frontLeftMotor,
__in UINT32  rearLeftMotor,
__in UINT32  frontRightMotor,
__in UINT32  rearRightMotor,
__in DriveNotify notify = NULL,
__in float  sensitivity = 0.5 
) [inline]

Constructor: Create an instance of the 4-wheel TrcDrive object given the four PWM motor channels.

Parameters:
frontLeftMotor Specifies the front left motor PWM channel.
rearLeftMotor Specifies the rear left motor PWM channel.
frontRightMotor Specifies the front right motor PWM channel.
rearRightMotor Specifies the rear right motor PWM channel.
notify Specifies the optional notification object.
sensitivity Specifies the turning sensitivity.
TrcDrive::TrcDrive ( __in SpeedController *  leftMotor,
__in SpeedController *  rightMotor,
__in DriveNotify notify = NULL,
__in float  sensitivity = 0.5 
) [inline]

Constructor: Create an instance of the 2-wheel TrcDrive object given the left and right motor controllers. This is used when the motor controller is not the default Jaguar.

Parameters:
leftMotor Specifies the left motor controller object.
rightMotor Specifies the right motor controller object.
notify Specifies the optional notification object.
sensitivity Specifies the turning sensitivity.
TrcDrive::TrcDrive ( __in SpeedController *  frontLeftMotor,
__in SpeedController *  rearLeftMotor,
__in SpeedController *  frontRightMotor,
__in SpeedController *  rearRightMotor,
__in DriveNotify notify = NULL,
__in float  sensitivity = 0.5 
) [inline]

Constructor: Create an instance of the 4-wheel TrcDrive object given the motor controllers of the 4 wheels. This is used when the motor controller is not the default Jaguar.

Parameters:
frontLeftMotor Specifies the front left motor controller object.
rearLeftMotor Specifies the rear left motor controller object.
frontRightMotor Specifies the front right motor controller object.
rearRightMotor Specifies the rear right motor controller object.
notify Specifies the optional notification object.
sensitivity Specifies the turning sensitivity.
TrcDrive::~TrcDrive ( void   )  [inline]

Destructor: Destroy an instance of the TrcDrive object.


Member Function Documentation

void TrcDrive::DriveTask ( void   )  [inline]

This function is called by the robot loop periodically to update and program the motor controllers.

float TrcDrive::GetDirection ( void   )  [inline]

This function returns the heading of the robot, useful for Mecanum drive.

Returns:
Returns the current direction of the robot.
void TrcDrive::SetArcadeDrive ( __in float  powerDrive,
__in float  powerTurn 
) [inline]

This function sets drive mode to Arcade Drive.

Parameters:
powerDrive Specifies the drive power.
powerTurn Specifies the turn power.
void TrcDrive::SetDriveStop ( void   )  [inline]

This function stops the motors.

void TrcDrive::SetMecanumDrive ( __in float  powerDrive,
__in float  direction,
__in float  powerTurn 
) [inline]

This function sets drive mode to Mecanum Drive.

Parameters:
powerDrive Specifies the drive power.
direction Specifies the heading.
powerTurn Specifies the turn power.
void TrcDrive::SetPIDAngle ( __in TrcPIDControl pidTurn,
__in float  angle,
__in float  tolerance,
__in float  settlingPeriod,
__in float  timeout 
) [inline]

This function sets drive mode to PID angle drive.

Parameters:
pidTurn Points to the PID turn control object.
angle Specifies the angle to turn in degrees.
tolerance Specifies how close to the target we consider on-target.
settlingPeriod Specifies the settling period before declaring on target.
timeout Optionally specifies the maximum time allowed for the PID operation. If not zero, we will stop PID if timeout has expired even though we have not reached target.
void TrcDrive::SetPIDDistance ( __in TrcPIDControl pidDrive,
__in float  distance,
__in float  direction,
__in float  tolerance,
__in float  settlingPeriod,
__in float  timeout 
) [inline]

This function sets drive mode to PID distance drive.

Parameters:
pidDrive Points to the PID drive control object.
distance Specifies the distance to drive in feet.
direction Specifies the direction to travel. This is mainly for mecanum drive. On normal drive, this will be ignored and should be set this to zero.
tolerance Specifies how close to the target we consider on-target.
settlingPeriod Specifies the settling period before declaring on target.
timeout Optionally specifies the maximum time allowed for the PID operation. If not zero, we will stop PID if timeout has expired even though we have not reached target.
void TrcDrive::SetPIDDrive ( __in TrcPIDControl pidDrive,
__in TrcPIDControl pidTurn,
__in float  distance,
__in float  direction,
__in float  turn,
__in float  toleranceDrive,
__in float  toleranceTurn,
__in float  settlingPeriod,
__in float  timeout 
) [inline]

This function sets PID drive mode.

Parameters:
pidDrive Points to the PID drive control object.
pidTurn Points to the PID turn control object.
distance Specifies the distance to drive in feet.
direction Specifies the direction to travel. This is mainly for mecanum drive. On normal drive, this should be set to zero.
turn Specifies the heading to turn the robot.
toleranceDrive Specifies how close to the drive target we consider on-target.
toleranceTurn Specifies how close to the turn target we consider on-target.
settlingPeriod Specifies the settling period before declaring on target.
timeout Optionally specifies the maximum time allowed for the PID operation. If not zero, we will stop PID if timeout has expired even though we have not reached target.
void TrcDrive::SetTankDrive ( __in float  powerLeft,
__in float  powerRight 
) [inline]

This function sets drive mode to Tank Drive.

Parameters:
powerLeft Specifies the power value for the left motor.
powerRight Specifies the power value for the right motor.

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

Generated by  doxygen 1.6.2