3630 Stampede 2022 Offseason Code Release

Another year older, and hopefully another year wiser. This school year we introduced big changes to our coding practices. We are switching from Timed Robot to Command-based. So as a mentor I’ve been trying to learn this new mentality myself so I can help shepherd our programming students thru the pitfalls when switching from an iterative programming mindset to a declarative/functional programming mindset. I believe if we adopt the command based mindset it will be easier to teach our incoming students and will also allow us to jump from brainstorming formats and state-diagrams to command-based coding. We will see!

Key Features

Simulation

We’re finally using WPILIB Simulation features to simulate our swerve drive and. I’m disappointed I didn’t advocate for simulation in the past. Maybe this is just our team, but we wasted so much precious “robot time” chasing null pointers, duplicate CAN IDs and illogical “logic” in our code. We could have just simulated the code instead of waiting for the robot.

This year we simulated our Falcon Swerve Chassis (thanks to some guidance from Team 4512), and are hoping for and wondering if Rev updates their simulation capabilities where things can be more or less drag and drop into our code (we think there a high probability we will switch to NEOs this year).

Inline Command Base

One of the benefits of being such a late adopter of command-based coding architecture is that we can use the latest and greatest features that WPILIB has created. So we took our old swerve code, converted it to inlined command base and tested it out on simulation. Having readable code is truly underrated, and I think switching to an Inline command-based mindset will take us to the next level of robot software development. In case ur not in the know, the below link will catch you up on some of the deets:

PathPlanner with a SysID characterized drive train

We benefited HUMONGOUS-ly from Path Planner and are so thankful to WPILIB and @mjansen4857 for making crisp and repeatable autos accessible to our team. We learned so much!

Alrite, here’s our code. Let me know if you have any questions! Good luck this season!

6 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.