Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
6f1a287
Example implementation of a choreo auto
michaelk036 Feb 1, 2026
be7330a
deleted duplicate example auto
michaelk036 Feb 1, 2026
07cbf4a
Merge branch 'main' into MK-path-five
michaelk036 Feb 1, 2026
c289625
PARALELLL COMAMND WHILE DOING THE PATH PLANNE RTHINGY MABOBBER
cloudygitalt Feb 5, 2026
558b102
Merge branch 'main' into MK-path-five
michaelk036 Feb 5, 2026
9199c03
added PrintPath trajectory to bind a print command to a marker. need …
cloudygitalt Feb 7, 2026
f175f43
some changes
michaelk036 Feb 7, 2026
6c83b36
the markers aren't working, roll back to parallel command group
michaelk036 Feb 8, 2026
0aa3954
not functional rn, still working on it
michaelk036 Feb 10, 2026
d0e6a29
Some clean up
Sahiltheram Feb 12, 2026
8febaa6
added an example auto with 2 paths, and a printCommand at the beggini…
michaelk036 Feb 13, 2026
e1a918a
Merge remote-tracking branch 'origin/main' into MK-path-five
michaelk036 Feb 13, 2026
c30c373
Test constraints, made printcommand work
Sahiltheram Feb 14, 2026
6aafe4c
Use of autoroutine- getting event markers to work
Sahiltheram Feb 14, 2026
e91ff1e
added comments/docs
cloudygitalt Feb 14, 2026
baaa045
rollback to how Loggable stuff was
michaelk036 Feb 14, 2026
f3dddc3
Merge remote-tracking branch 'refs/remotes/origin/MK-path-five' into …
michaelk036 Feb 14, 2026
ea68148
fixed it
michaelk036 Feb 14, 2026
1342a45
i think i fixed everything
michaelk036 Feb 14, 2026
f1f0592
added autoChooser.getCommand() back
michaelk036 Feb 14, 2026
c5e575e
Revert "Test constraints, made printcommand work"
michaelk036 Feb 15, 2026
20a1e9a
removing AutoRoutine
michaelk036 Feb 15, 2026
96adfaf
Moving auto segtup to container
Sahiltheram Feb 16, 2026
d6d5d50
removed auto routine, added my own print command - some other stuff i…
michaelk036 Feb 16, 2026
ff8c21e
removed the loggable stuff (again)
michaelk036 Feb 16, 2026
cbbe80d
remove sahil's stuff in unit tests
michaelk036 Feb 16, 2026
75d4a35
Merge remote-tracking branch 'origin/main' into MK-path-five
michaelk036 Feb 16, 2026
daffdc3
fixed PrintCommand
michaelk036 Feb 16, 2026
6f068fc
merged it wrong; fixed it i think
michaelk036 Feb 16, 2026
e0c00ed
fixed robot container
michaelk036 Feb 16, 2026
566c5c0
fixed
michaelk036 Feb 16, 2026
c5c9171
fixing
michaelk036 Feb 16, 2026
b37356f
more fix
michaelk036 Feb 16, 2026
a51ddba
i think fixed
michaelk036 Feb 16, 2026
85ab42c
more fix
michaelk036 Feb 16, 2026
15702a3
more
michaelk036 Feb 16, 2026
19d59c2
cleaning up robot
michaelk036 Feb 16, 2026
df637aa
more robot cleanup
michaelk036 Feb 16, 2026
fae951a
i think its done
michaelk036 Feb 16, 2026
6600ae3
its not done
michaelk036 Feb 16, 2026
d36d17e
done?
michaelk036 Feb 16, 2026
87a642a
omg it works
michaelk036 Feb 16, 2026
2d3668d
fix priny command
Sahiltheram Feb 16, 2026
691b6c3
push
michaelk036 Feb 17, 2026
db7c5f7
Change the pose manager to return the vision estimate rather than the…
armadilloz Feb 17, 2026
05045f2
omg it works im free
michaelk036 Feb 17, 2026
76be8c3
Merge branch 'main' into MK-path-five
michaelk036 Feb 17, 2026
5a8fc4d
added auto command thing for right -> tower
cloudygitalt Feb 17, 2026
01d0da8
removed sam's commit
michaelk036 Feb 18, 2026
2968562
Merge branch 'main' into MK-path-five
michaelk036 Feb 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
219 changes: 219 additions & 0 deletions src/main/deploy/choreo/ExamplePathOne.traj

Large diffs are not rendered by default.

215 changes: 215 additions & 0 deletions src/main/deploy/choreo/ExamplePathTwo.traj

Large diffs are not rendered by default.

84 changes: 84 additions & 0 deletions src/main/deploy/choreo/path.chor
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"name":"path",
"version":2,
"type":"Swerve",
"variables":{
"expressions":{},
"poses":{}
},
"config":{
"frontLeft":{
"x":{
"exp":"11 in",
"val":0.2794
},
"y":{
"exp":"11 in",
"val":0.2794
}
},
"backLeft":{
"x":{
"exp":"-11 in",
"val":-0.2794
},
"y":{
"exp":"11 in",
"val":0.2794
}
},
"mass":{
"exp":"150 lbs",
"val":68.0388555
},
"inertia":{
"exp":"6 kg m ^ 2",
"val":6.0
},
"gearing":{
"exp":"6.5",
"val":6.5
},
"radius":{
"exp":"2 in",
"val":0.0508
},
"vmax":{
"exp":"6000 RPM",
"val":628.3185307179587
},
"tmax":{
"exp":"1.2 N * m",
"val":1.2
},
"cof":{
"exp":"1.5",
"val":1.5
},
"bumper":{
"front":{
"exp":"16 in",
"val":0.4064
},
"side":{
"exp":"16 in",
"val":0.4064
},
"back":{
"exp":"16 in",
"val":0.4064
}
},
"differentialTrackWidth":{
"exp":"22 in",
"val":0.5588
}
},
"generationFeatures":[],
"codegen":{
"root":"Users/michael/Developer/FRC2026_Java/src/main/deploy/choreo",
"genVars":true,
"genTrajData":true,
"useChoreoLib":true
}
}
34 changes: 34 additions & 0 deletions src/main/java/frc/robot/Drive.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package frc.robot;

import choreo.trajectory.SwerveSample;
import edu.wpi.first.math.controller.PIDController;
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.kinematics.ChassisSpeeds;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.subsystems.swervedrive.SwerveSubsystem;


public class Drive extends SubsystemBase{
private final PIDController xController = new PIDController(.01, 0.0, 0.0);
private final PIDController yController = new PIDController(.01, 0.0, 0.0);
private final PIDController headingController = new PIDController(.01, 0.0, 0.0);
private SwerveSubsystem subsystem;

public Drive(SwerveSubsystem subsystem) {
headingController.enableContinuousInput(-Math.PI, Math.PI);
this.subsystem = subsystem;
}

public void followTrajectory(SwerveSample sample) {
Pose2d pose = subsystem.getPose();

ChassisSpeeds speeds = new ChassisSpeeds(
sample.vx + xController.calculate(pose.getX(), sample.x),
sample.vy + yController.calculate(pose.getX(), sample.y),
sample.omega + headingController.calculate(pose.getRotation().getRadians(), sample.heading)
);

subsystem.drive(speeds);

}
}
91 changes: 85 additions & 6 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import frc.robot.autochooser.AutoChooser;
import frc.robot.commands.angler.AimAngler;
import frc.robot.commands.angler.RunAnglerToReverseLimit;
import frc.robot.commands.auto.ExampleAuto;
import frc.robot.commands.shooter.SetShootingState;
import frc.robot.commands.turret.RunTurretToFwdLimit;
import frc.robot.commands.turret.RunTurretToRevLimit;
Expand Down Expand Up @@ -64,6 +65,14 @@

import java.io.File;

import choreo.auto.AutoFactory;
import choreo.auto.AutoRoutine;
import choreo.auto.AutoTrajectory;

import choreo.auto.AutoFactory;
import choreo.auto.AutoRoutine;
import choreo.auto.AutoTrajectory;

/**
* This class is where the bulk of the robot should be declared. Since
* Command-based is a
Expand All @@ -78,21 +87,25 @@ public class RobotContainer {
private final AutoChooser autoChooser = new AutoChooser();
// The robot's subsystems and commands are defined here...
// private final TiltSubsystem tiltSubsystem;
private final ClimberSubsystem climberSubsystem;
private final AnglerSubsystem anglerSubsystem;
private final IntakeSubsystem intakeSubsystem;
private final FeederSubsystem feederSubsystem;
private final ApriltagSubsystem apriltagSubsystem;
private final ShooterSubsystem shooterSubsystem;
private RobotVisualizer robotVisualizer = null;
private final HopperSubsystem hopperSubsystem;
private final ClimberSubsystem climberSubsystem;
private final TurretSubsystem turretSubsystem;
private final IntakeDeployerSubsystem intakeDeployer;
private SwerveSubsystem drivebase = null;
private GyroSubsystem gyroSubsystem = null;
private final CommandJoystick driveJoystick = new CommandJoystick(Constants.DRIVE_JOYSTICK_PORT);
private final CommandJoystick steerJoystick = new CommandJoystick(Constants.STEER_JOYSTICK_PORT);
private ShootingState shootState = new ShootingState(ShootState.STOPPED);
private Drive drive;
private AutoFactory autoFactory;
private static AutoRoutine straightRoutine;
private static AutoTrajectory straightTrajectory;

// Replace with CommandPS4Controller or CommandJoystick if needed
// new CommandXboxController(OperatorConstants.kDriverControllerPort);private
Expand Down Expand Up @@ -162,7 +175,8 @@ public RobotContainer() {
turretSubsystem = new TurretSubsystem(TurretSubsystem.createSimIo(robotVisualizer));
apriltagSubsystem = new ApriltagSubsystem(ApriltagSubsystem.createSimIo());
shooterSubsystem = new ShooterSubsystem(ShooterSubsystem.createSimIo(robotVisualizer));
intakeDeployer = new IntakeDeployerSubsystem(IntakeDeployerSubsystem.createSimIo(robotVisualizer));
intakeDeployer = new IntakeDeployerSubsystem(
IntakeDeployerSubsystem.createSimIo(robotVisualizer));

// No GyroSubsystem in REPLAY for now
// create the drive subsystem with null gyro (use default json)
Expand All @@ -177,6 +191,7 @@ public RobotContainer() {

configureBindings();
putShuffleboardCommands();
setUpAutoFactory();
}

/**
Expand All @@ -193,6 +208,68 @@ public RobotContainer() {
* {@link edu.wpi.first.wpilibj2.command.button.CommandJoystick Flight
* joysticks}.
*/
private void setUpAutoFactory() {

drive = new Drive(drivebase);

// Sets up Choreo with pose, odometry, drivebase, and a follow trajectory
// command
autoFactory = new AutoFactory(drivebase::getPose,
drivebase::resetOdometry,
drive::followTrajectory,
true,
drivebase);

// example implementation of autoRoutine
if (false) {
// Uses autofactory to create a new routine
straightRoutine = autoFactory.newRoutine("StraightRoutine");

/*
* Loads a trajectory created in Choreo given the name
* Can load multiple trajectories from the same routine
*
* i.e.
* AutoRoutine routine = autoFactory.newRoutine("grabAndScore");
* AutoTrajectory grabTraj = routine.trajectory("grabPiece");
* AutoTrajectory scoreTraj = routine.trajectory("scorePiece");
*/
straightTrajectory = straightRoutine.trajectory("StraightPath");

/*
* .active() is a trigger that becomes true when the routine is running
* .onTrue() starts a command when the trigger becomes true (i.e. when the
* routine starts)
*
* Use commands.sequence() to sequence multiple commands (i.e. reset odometry,
* then follow trajectory)
*/
straightRoutine.active().onTrue(
straightTrajectory.resetOdometry()
.andThen(straightTrajectory.cmd()));

/*
* -----------------------------------------------------------------------------
* -------------------
* Trajectory Triggers (read more on docs page
* https://choreo.autos/choreolib/auto-factory/):
* -----------------------------------------------------------------------------
* -------------------
*
* trajectory.atTime(String)
* trajectory.atTime(double time)
* trajectory.done()
* trajectory.active()
* trajectory.inactive()
* trajectory.atPose(String, double, double)
* trajectory.atPose(Pose2d, double, double)
* trajectory.doneDelayed(int)
* trajectory.doneFor(int)
* trajectory.recentlyDone()
*/
}
}

private void configureBindings() {
// Schedule `ExampleCommand` when `exampleCondition` changes to `true`
// new Trigger(m_exampleSubsystem::exampleCondition)
Expand Down Expand Up @@ -401,12 +478,14 @@ public void putShuffleboardCommands() {
* @return the command to run in autonomous
*/
public Command getAutonomousCommand() {
return autoChooser.getCommand();
// return autoChooser.getCommand();
// return straightRoutine.cmd(straightTrajectory.done());
return new ExampleAuto(drivebase, autoFactory);
}

public ClimberSubsystem getClimberSubsystem() {
return climberSubsystem;
}
public ClimberSubsystem getClimberSubsystem() {
return climberSubsystem;
}

public RobotVisualizer getRobotVisualizer() {
return robotVisualizer;
Expand Down
36 changes: 36 additions & 0 deletions src/main/java/frc/robot/commands/PrintCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package frc.robot.commands;

import frc.robot.utils.logging.commands.LoggableCommand;

/**
* A command that prints a string when initialized.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class PrintCommand extends LoggableCommand {
private final String message;

/**
* Creates a new a PrintCommand.
*
* @param message the message to print
*/
public PrintCommand(String message) {
this.message = message;
}

@Override
public void initialize() {
System.out.println(message);
}

@Override
public boolean isFinished() {
return true;
}

@Override
public boolean runsWhenDisabled() {
return true;
}
}
27 changes: 27 additions & 0 deletions src/main/java/frc/robot/commands/auto/ExampleAuto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package frc.robot.commands.auto;

import choreo.auto.AutoFactory;
import frc.robot.commands.PrintCommand;
import frc.robot.subsystems.swervedrive.SwerveSubsystem;
import frc.robot.utils.logging.commands.LoggableCommandWrapper;
import frc.robot.utils.logging.commands.LoggableParallelCommandGroup;
import frc.robot.utils.logging.commands.LoggableSequentialCommandGroup;

public class ExampleAuto extends LoggableSequentialCommandGroup{
public ExampleAuto(SwerveSubsystem subsystem, AutoFactory auto) {
super(
LoggableCommandWrapper.wrap(auto.resetOdometry("ExamplePathOne")),
new LoggableParallelCommandGroup(
LoggableCommandWrapper.wrap((auto.trajectoryCmd("ExamplePathOne"))),
new PrintCommand("Started ExamplePathOne")
),
new PrintCommand("Finished ExamplePathOne"),

new LoggableParallelCommandGroup(
LoggableCommandWrapper.wrap((auto.trajectoryCmd("ExamplePathTwo"))),
new PrintCommand("Started ExamplePathTwo")
),
new PrintCommand("Finished ExamplePathTwo")
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ public InterruptionBehavior getInterruptionBehavior() {
public boolean runsWhenDisabled() {
return wrap.runsWhenDisabled();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ public LoggableDeadlineCommandGroup withBasicName(String name) {
basicName = name;
return this;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ public LoggableParallelCommandGroup withBasicName(String name) {
this.basicName = name;
return this;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ public LoggableRaceCommandGroup withBasicName(String name) {
this.basicName = name;
return this;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ public LoggableSequentialCommandGroup withBasicName(String name) {
this.basicName = name;
return this;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(basicName, parent);
}
}
}
Loading