Skip to content

[choreolib] Add trajectory mirroring for x and y#1452

Open
RohanBhattacharyya wants to merge 19 commits intoSleipnirGroup:mainfrom
RohanBhattacharyya:main
Open

[choreolib] Add trajectory mirroring for x and y#1452
RohanBhattacharyya wants to merge 19 commits intoSleipnirGroup:mainfrom
RohanBhattacharyya:main

Conversation

@RohanBhattacharyya
Copy link

@RohanBhattacharyya RohanBhattacharyya commented Mar 23, 2026

Allows the user to create a mirrored trajectory over the length or width.

Example usage would be if an auto was made for one side of the trench, but the user wants to run it for the other side in 2026 REBUILT.

Example usage:

private AutoRoutine shootToAllianceLeft() {
    final AutoRoutine routine = autoFactory.newRoutine("Shoot to Alliance Left");
    final AutoTrajectory traj = ShootAlliance.asAutoTraj(routine);

    routine.active().onTrue(
        Commands.sequence(
            traj.resetOdometry(),
            traj.cmd()
        )
    );


    return routine;
}

private AutoRoutine shootToAllianceRight() {
    final AutoRoutine routine = autoFactory.newRoutine("Shoot to Alliance Right");
    final AutoTrajectory traj = routine.trajectory(ShootAlliance.asAutoTraj(routine).getRawTrajectory().mirrorY());

    routine.active().onTrue(
        Commands.sequence(
            traj.resetOdometry(),
            traj.cmd()
        )
    );
    return routine;
}

@Daniel1464
Copy link
Contributor

Looks good, but I would recommend adding mirrorX() and mirrorY() instance methods to AutoTrajectory, so you could just do

ShootAliance.asAutoTraj(routine).mirrorY()

@RohanBhattacharyya
Copy link
Author

Looks good, but I would recommend adding mirrorX() and mirrorY() instance methods to AutoTrajectory, so you could just do

ShootAliance.asAutoTraj(routine).mirrorY()

Alright, I added that.

return ChoreoAllianceFlipUtil.getFlipper().flip(this);
}

@Override
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added new public methods:

  • DifferentialSample::mirrorY and DifferentialSample::mirrorX
  • SwerveSample::mirrorY and SwerveSample::mirrorX

public class ChoreoAllianceFlipUtil {
/** The flipper to use for flipping coordinates. */
public static enum Flipper {
public abstract static class Flipper {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flipper is no longer an enum with MIRRORED and ROTATE_AROUND, it is an abstract class with factories and instance utility methods.

Copy link
Member

@calcmogul calcmogul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Copilot output wasn't great.

@calcmogul calcmogul removed help: needs C++ Needs a C++ port. help: needs Python Needs a Python port. labels Mar 23, 2026
@RohanBhattacharyya
Copy link
Author

I updated the port to C++ and Python with codex.

@calcmogul
Copy link
Member

calcmogul commented Mar 23, 2026

Please don't use an LLM to address review comments like this. It generated a lot of bad code, and I don't want to spend the time annotating everything it messed up.

@RohanBhattacharyya
Copy link
Author

Please don't use an LLM to address review comments like this. It generated a lot of bad code, and I don't want to spend the time annotating everything it messed up.

Alright, I undid the LLM-based commits. Please add the help: needs C++ and help: needs Python tags. This is reverted to before the Python and C++ ports.

@calcmogul calcmogul added help: needs C++ Needs a C++ port. help: needs Python Needs a Python port. labels Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants