Class PurePursuitCommand
java.lang.Object
org.wpilib.command2.Command
xbot.common.command.BaseCommand
xbot.common.subsystems.drive.PurePursuitCommand
- All Implemented Interfaces:
AutoCloseable, org.wpilib.telemetry.TelemetryLoggable, org.wpilib.tunable.ComplexTunable, TunablePrefixProvider
- Direct Known Subclasses:
ConfigurablePurePursuitCommand
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumclassNested classes/interfaces inherited from class org.wpilib.command2.Command
org.wpilib.command2.Command.InterruptionBehavior -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected PurePursuitCommand.RabbitChaseInfoprotected final BaseDriveSubsystemprotected HeadingModuleprotected final org.wpilib.tunable.TunableDoubleprotected intprotected final BasePoseSubsystemprotected PIDManagerprotected final org.wpilib.tunable.TunableDoubleFields inherited from class BaseCommand
aKitLog, log, monitor, runningAlert -
Constructor Summary
ConstructorsConstructorDescriptionPurePursuitCommand(HeadingModule.HeadingModuleFactory headingModuleFactory, BasePoseSubsystem pose, BaseDriveSubsystem drive, TunableFactory tunableFactory) An implementation of Pure Pursuit for FRC. -
Method Summary
Modifier and TypeMethodDescriptionvoidend(boolean interrupted) This is the core method that looks at the point list, figures out which point to be heading towards, and doing the math on how to get there.evaluateCurrentPoint(FieldPose robotPose) voidexecute()doubleprotected abstract List<RabbitPoint> If you want to see where this command is heading in the future (for visualization purposes, perhaps) you can get that information here.protected abstract PurePursuitCommand.PointLoadingModevoidbooleanvoidsetDotProductDrivingEnabled(boolean enabled) voidsetPIDs(HeadingModule headingModule, PIDManager positionalPid) By default, the PurePursuitCommand uses the HeadingModule and PositionalPid from the DriveSubsystem.voidMethods inherited from class BaseCommand
close, getPrefix, publishToTunables, publishToTunables, runsWhenDisabled, setRunsWhenDisabledMethods inherited from class org.wpilib.command2.Command
addRequirements, addRequirements, alongWith, andThen, andThen, asProxy, beforeStarting, beforeStarting, cancel, deadlineFor, finallyDo, finallyDo, getInterruptionBehavior, getName, getRequirements, getTelemetryType, getTunableType, handleInterrupt, hasRequirement, ignoringDisable, isScheduled, logTo, onlyIf, onlyWhile, publishTunable, raceWith, repeatedly, setName, unless, until, withDeadline, withInterruptBehavior, withName, withTimeout, withTimeoutMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.wpilib.tunable.ComplexTunable
publishChildTunable, publishChildTunable, removeChildTunable, setChildTunableChanged, updateTunable
-
Field Details
-
poseSystem
-
drive
-
rabbitLookAhead
protected final org.wpilib.tunable.TunableDouble rabbitLookAhead -
perpindicularRatioTunable
protected final org.wpilib.tunable.TunableDouble perpindicularRatioTunable -
headingModule
-
positionalPid
-
pointIndex
protected int pointIndex -
chaseData
-
-
Constructor Details
-
PurePursuitCommand
public PurePursuitCommand(HeadingModule.HeadingModuleFactory headingModuleFactory, BasePoseSubsystem pose, BaseDriveSubsystem drive, TunableFactory tunableFactory) An implementation of Pure Pursuit for FRC. We got the basic idea from here: http://www8.cs.umu.se/kurser/TDBD17/VT06/utdelat/Assignment%20Papers/Path%20Tracking%20for%20a%20Miniature%20Robot.pdf Fundamentally, you can add field points to this command (x,y, and rotation) and the robot will attempt to reach all those points with a smooth path. This works for any drive base, but presumably, holonomic robots can solve this problem more effectively. You will see references to rabbits, or "chasing the rabbit". This is alluding to how greyhoud races use mechanical rabbits, which is designed to always stay ahead of them, regardless of their speed. This is similiar to how, as the robot uses pure pursuit, it is always chasing a point it can never reach.- Parameters:
headingModuleFactory- HeadingModuleFactorypose- BasePoseSubsystemdrive- BaseDriveSubsystemtunableFactory- TunableFactory
-
-
Method Details
-
setPIDs
By default, the PurePursuitCommand uses the HeadingModule and PositionalPid from the DriveSubsystem. However, if you want to change the PIDs used on the fly, you can here.- Parameters:
headingModule- Used for rotationpositionalPid- Used for translation
-
setPIDsToDefault
public void setPIDsToDefault() -
setDotProductDrivingEnabled
public void setDotProductDrivingEnabled(boolean enabled) -
getOriginalPoints
-
getPursuitMode
-
getPlannedPointsToVisit
If you want to see where this command is heading in the future (for visualization purposes, perhaps) you can get that information here.- Returns:
- List of points to visit
-
initialize
public void initialize()- Overrides:
initializein classBaseCommand
-
execute
public void execute()- Overrides:
executein classorg.wpilib.command2.Command
-
evaluateCurrentPoint
-
evaluateCurrentPoint
This is the core method that looks at the point list, figures out which point to be heading towards, and doing the math on how to get there.- Returns:
- Information about what the robot would like to do in order to reach its points.
-
end
public void end(boolean interrupted) - Overrides:
endin classBaseCommand
-
isFinished
public boolean isFinished()- Overrides:
isFinishedin classorg.wpilib.command2.Command
-
getMotionBudget
public double getMotionBudget()
-