Skip to content

Stage 2 CTRE Solution Code - #175

Draft
roboteer5291 wants to merge 2 commits into
frcsoftware:mainfrom
roboteer5291:stage2-ctre-solution
Draft

Stage 2 CTRE Solution Code#175
roboteer5291 wants to merge 2 commits into
frcsoftware:mainfrom
roboteer5291:stage2-ctre-solution

Conversation

@roboteer5291

Copy link
Copy Markdown
Collaborator

Creates stage 2 CTRE Solution Code. Still very much a WIP

Todo:

  • Add AdvantageScope model and rig
  • Create intake and indexer mechanisms
  • Add sensor simulation (indexer and claw)
  • Add coral on reef visualization for AdvantageScope
  • Create a fully-featured coral-only teleop utilizing a state machine
  • Validate and clean up AutoAlignCommand code
  • Create a basic auto mode (no vision, assume coral is at same position on ground)
  • Evaluate whether the initial teleops (BasicScoringTeleop and FullScoringTeleop) are at the correct level or if they should be simpler
  • Lint and format
  • Setup copybara and repo
  • Final pass through all code for cleanliness, appropriate commenting, and any bad habits

@roboteer5291 roboteer5291 added CTRE Anything starter code or curriculum material touching CTRE libraries Starter Code Code for students to build on - Java, WPILib, etc Stage 2 labels Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

🌐 Preview URL: https://pr-175.frcsoftware.pages.dev

@Daniel1464 Daniel1464 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I know this is still a draft, but left some preliminary comments since i have time

"enableCppIntellisense": false,
"currentLanguage": "java",
"projectYear": "2027_alpha5",
"teamNumber": 9999

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Small nitpick, but you can set this to null instead.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Set what?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry, the team number

static final double kI = 0;
static final double kD = 7;

static final double POSITION_TOLERANCE = 3.0/360.0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would this be better served using the units API? Degrees.of(3) would be a lot more clear here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Changed to use Units.degreesToRotations instead. Since we aren't using the units API anywhere else really, I don't think it'd make sense to have it for this.

Comment thread examples/stage2/templates/ctre/src/main/java/first/robot/mechanisms/Arm.java Outdated
motor.getConfigurator().apply(leaderConfiguration);

// Set up periodic method to run every code loop
Scheduler.getDefault().addPeriodic(this::periodic);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In the previous exercises, mechanism.periodic() is called manually in robotPeriodic(). Personally I think it's slightly better because it gives you control as to when the periodic() method is run


private final FlywheelSim sim;

private final double GEAR_RATIO = (18.0 / 12.0) * (54.0 / 18.0) * (22.0 / 18.0) * (22.0 / 18.0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would be better to make the gear ratio a parameter of ClawSim so that users can play around with different gear ratios

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

What value does this get in terms of teaching frc programming?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CTRE Anything starter code or curriculum material touching CTRE libraries examples Stage 2 Starter Code Code for students to build on - Java, WPILib, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants