Unit 7: Advanced FRC Coding
Welcome to the cutting edge of FRC autonomous programming. PathPlanner is a powerful tool that allows us to design, visualize, and execute complex, curved autonomous paths with incredible precision, and it's a standard for top teams like ours.
PathPlanner is a third-party tool with two key components:
Instead of simple "drive forward, then turn" routines, PathPlanner allows for:
Integrating PathPlanner into our command-based robot code involves a few key steps in `RobotContainer.java`.
// In RobotContainer.java
public class RobotContainer {
// ... subsystems and controllers ...
private final SendableChooser<Command> autoChooser;
public RobotContainer() {
// ... other setup ...
// 1. Link Command Names to Actual Command Objects
// In the PathPlanner GUI, we can create an event marker named "intake".
// This line tells our code that when it sees that marker, it should run an IntakeCommand.
NamedCommands.registerCommand("intake", new IntakeCommand(m_intake));
NamedCommands.registerCommand("shoot", new ShootCommand(m_shooter, m_leds));
// 2. Build the Autonomous Chooser Automatically
// This magical method finds all the autonomous routines you created in the
// PathPlanner app and automatically creates a SendableChooser for them.
autoChooser = AutoBuilder.buildAutoChooser();
SmartDashboard.putData("Auto Mode", autoChooser);
configureButtonBindings();
}
/**
* @return the command to run in autonomous
*/
public Command getAutonomousCommand() {
// 3. Return the selected command
// This returns the complex, pre-built command group from PathPlanner.
return autoChooser.getSelected();
}
}
Question: What is the most powerful feature of PathPlanner that allows us to run commands like an intake or a shooter while the robot is still driving along a path?