Package trclib.drivebase
Class TrcMecanumDriveBase
java.lang.Object
trclib.drivebase.TrcDriveBase
trclib.drivebase.TrcSimpleDriveBase
trclib.drivebase.TrcMecanumDriveBase
- All Implemented Interfaces:
TrcExclusiveSubsystem
This class implements a platform independent mecanum drive base. A mecanum drive base consists of 4 motor driven
wheels. It extends the TrcSimpleDriveBase class so it inherits all the SimpleDriveBase methods and features.
-
Nested Class Summary
Nested classes/interfaces inherited from class trclib.drivebase.TrcSimpleDriveBase
TrcSimpleDriveBase.MotorType
Nested classes/interfaces inherited from class trclib.drivebase.TrcDriveBase
TrcDriveBase.DriveOrientation, TrcDriveBase.MotorPowerMapper, TrcDriveBase.MotorsState, TrcDriveBase.Odometry, TrcDriveBase.OdometryType
Nested classes/interfaces inherited from interface trclib.robotcore.TrcExclusiveSubsystem
TrcExclusiveSubsystem.OwnershipParams
-
Field Summary
FieldsFields inherited from class trclib.drivebase.TrcSimpleDriveBase
lbMotor, lcMotor, lfMotor, rbMotor, rcMotor, rfMotor
Fields inherited from class trclib.drivebase.TrcDriveBase
angleScale, motorPowerMapper, odometry, stallStartTime, stallVelThreshold, tracer, xScale, yScale
-
Constructor Summary
ConstructorsConstructorDescriptionTrcMecanumDriveBase
(TrcMotor lfMotor, TrcMotor lbMotor, TrcMotor rfMotor, TrcMotor rbMotor) Constructor: Create an instance of the 4-wheel mecanum drive base.TrcMecanumDriveBase
(TrcMotor lfMotor, TrcMotor lbMotor, TrcMotor rfMotor, TrcMotor rbMotor, TrcGyro gyro) Constructor: Create an instance of the 4-wheel mecanum drive base. -
Method Summary
Modifier and TypeMethodDescriptionprotected TrcDriveBase.Odometry
getOdometryDelta
(TrcOdometrySensor.Odometry[] prevOdometries, TrcOdometrySensor.Odometry[] currOdometries) This method is called periodically to calculate the delta between the previous and current motor odometries.void
holonomicDrive
(String owner, double x, double y, double rotation, boolean inverted, double gyroAngle, double driveTime, TrcEvent event) This method implements holonomic drive where x controls how fast the robot will go in the x direction, and y controls how fast the robot will go in the y direction.boolean
This method checks if it supports holonomic drive.Methods inherited from class trclib.drivebase.TrcSimpleDriveBase
setInvertedMotor, setWheelBaseWidth, tankDrive
Methods inherited from class trclib.drivebase.TrcDriveBase
arcadeDrive, arcadeDrive, arcadeDrive, arcadeDrive, arcadeDrive, clearReferenceOdometry, curveDrive, curveDrive, curveDrive, curveDrive, curveDrive, disableAntiTipping, enableAntiTipping, enableAntiTipping, getAntiTippingPower, getDriveGyroAngle, getDriveOrientation, getFieldPosition, getFieldVelocity, getGyroAssistPower, getHeading, getMotors, getNumMotors, getPositionRelativeTo, getPositionRelativeTo, getReferenceOdometry, getRelativePosition, getRelativeVelocity, getTurnRate, getVelocityRelativeTo, getXPosition, getXVelocity, getYPosition, getYVelocity, holonomicDrive, holonomicDrive, holonomicDrive, holonomicDrive, holonomicDrive, holonomicDrive, holonomicDrive, holonomicDrive, holonomicDrive, holonomicDrive, holonomicDrive, holonomicDrive, holonomicDrive_Polar, holonomicDrive_Polar, holonomicDrive_Polar, holonomicDrive_Polar, holonomicDrive_Polar, holonomicDrive_Polar, holonomicDrive_Polar, holonomicDrive_Polar, isAntiTippingEnabled, isGyroAssistEnabled, isStalled, isSynchronizeOdometriesEnabled, popReferenceOdometry, printMotorsState, pushReferenceOdometry, resetOdometry, resetOdometry, resetOdometry, setBrakeMode, setDriveBaseOdometry, setDriveBaseOdometry, setDriveBaseOdometry, setDriveOrientation, setDriveTime, setFieldPosition, setFieldPosition, setGyroAssistEnabled, setInvertedMotor, setMotorPowerMapper, setOdometryEnabled, setOdometryEnabled, setOdometryScales, setOdometryScales, setOdometryScales, setReferenceOdometry, setSensitivity, setStallVelocityThreshold, setSynchronizeOdometriesEnabled, stop, stop, tankDrive, tankDrive, tankDrive, tankDrive, tankDrive
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface trclib.robotcore.TrcExclusiveSubsystem
acquireExclusiveAccess, acquireOwnership, cancelExclusiveAccess, getCurrentOwner, hasOwnership, releaseExclusiveAccess, releaseOwnership, validateOwnership
-
Field Details
-
moduleName
-
-
Constructor Details
-
TrcMecanumDriveBase
public TrcMecanumDriveBase(TrcMotor lfMotor, TrcMotor lbMotor, TrcMotor rfMotor, TrcMotor rbMotor, TrcGyro gyro) Constructor: Create an instance of the 4-wheel mecanum drive base.- Parameters:
lfMotor
- specifies the left front motor of the drive base.lbMotor
- specifies the left back motor of the drive base.rfMotor
- specifies the right front motor of the drive base.rbMotor
- specifies the right back motor of the drive base.gyro
- specifies the gyro. If none, it can be set to null.
-
TrcMecanumDriveBase
Constructor: Create an instance of the 4-wheel mecanum drive base.- Parameters:
lfMotor
- specifies the left front motor of the drive base.lbMotor
- specifies the left back motor of the drive base.rfMotor
- specifies the right front motor of the drive base.rbMotor
- specifies the right back motor of the drive base.
-
-
Method Details
-
supportsHolonomicDrive
public boolean supportsHolonomicDrive()This method checks if it supports holonomic drive.- Overrides:
supportsHolonomicDrive
in classTrcDriveBase
- Returns:
- true if this drive base supports holonomic drive, false otherwise.
-
holonomicDrive
public void holonomicDrive(String owner, double x, double y, double rotation, boolean inverted, double gyroAngle, double driveTime, TrcEvent event) This method implements holonomic drive where x controls how fast the robot will go in the x direction, and y controls how fast the robot will go in the y direction. Rotation controls how fast the robot rotates and gyroAngle specifies the heading the robot should maintain.- Overrides:
holonomicDrive
in classTrcDriveBase
- Parameters:
owner
- specifies the ID string of the caller for checking ownership, can be null if caller is not ownership aware.x
- specifies the x power.y
- specifies the y power.rotation
- specifies the rotating power.inverted
- specifies true to invert control (i.e. robot front becomes robot back).gyroAngle
- specifies the gyro angle to maintain.driveTime
- specifies the amount of time in seconds after which the drive base will stop.event
- specifies the event to signal when driveTime has expired, can be null if not provided.
-
getOdometryDelta
protected TrcDriveBase.Odometry getOdometryDelta(TrcOdometrySensor.Odometry[] prevOdometries, TrcOdometrySensor.Odometry[] currOdometries) This method is called periodically to calculate the delta between the previous and current motor odometries.- Overrides:
getOdometryDelta
in classTrcSimpleDriveBase
- Parameters:
prevOdometries
- specifies the previous motor odometries.currOdometries
- specifies the current motor odometries.- Returns:
- an Odometry object describing the odometry changes since the last update.
-