6995 NOMAD 2022 Code Release: CLAWDIA

Links

CLAWDIA Features:

  • 4-NEO differential drivetrain

  • Automatic Sequencer

  • Vision-aimed Turret with ~270 degrees of motion

  • Shooter using vision-based interpolated speeds

  • Manually driven climber with no falls across 40+ matches.

Why Two Codebases?

TLDR: The first one became unmaintainable. Too many quick fixes piled on other quick fixes, lots of automation strung together in RobotContainer, etc. There’s still remnants of an attempt at shoot-on-the-fly as well, which required compromises in code structure that made it difficult to develop. With several new students joining for the offseason, we decided to save Robot-2022 as an example of what not to do, copy over the subsystems and hardware definitions, and rethink how we handled commands and actions.

Autonomous

This year we benefitted from 3476’s practice field to develop a reliable 4-ball auto that won the Innovation in Control award at Las Vegas Regional.

Command Factories/Inline Commands

2022 in-season: Separate Command Factories

This season we tried using inline convenience commands and decorators to clean up our code. In the first iteration of the codebase, we constructed these inline commands in separate command factory classes for each subsystem (example). This was a bad idea in practice because it was effectively a more verbose constructor in RobotContainer and autonomous groups. and didn’t actually help organize the code.

2022 off-season: Command Factories in Subsystems

After significant feedback from WPILib developers, we switched to command factories in subsystems. Though initially we thought this blurred the separation between subsystems and commands, we found it helpful to think of it as the subsystem exposing only the actions it was capable of doing. Combined with the decorators, functional programming paradigms, and Trigger-based controller bindings, (and ignoring the climber controls, which were all manual), we ended up with a fairly clean RobotContainer bindings section.

For the most part, this worked really well. Auto routines were still a separate command factory class, and extended groups like that are still tricky to understand the flow. However, the code is in general very clear as to what each command does, because it’s wrapped behind the name of the factory method.

Swerve

In the offseason, along with rewriting our competition code, we also developed code for our NEO Mk4 swerve base. The local STEM foundation that gave us a grant for the modules required that we provide a demo for their K-12 STEM night. We started with team 401’s 2021 codebase. Besides getting it driving, doing the demo, and experimenting a bit with autonomous movement, we haven’t done much with the swerve base yet, so there’s not many details to share. However, if we end up using it this season we’ll probably have a few tricks to show off :slightly_smiling_face:.

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