Skip to content

Example Implementations of Controls Tutorials#8758

Open
gerth2 wants to merge 15 commits intowpilibsuite:2027from
gerth2:add_ctrls_programming_examples
Open

Example Implementations of Controls Tutorials#8758
gerth2 wants to merge 15 commits intowpilibsuite:2027from
gerth2:add_ctrls_programming_examples

Conversation

@gerth2
Copy link
Copy Markdown
Contributor

@gerth2 gerth2 commented Apr 11, 2026

Attempting to get a robot example project code snippet set that shows all mechanisms and control strategies shown in the controls programming tutorials

image image

@sciencewhiz
Copy link
Copy Markdown
Contributor

This is probably better suited for the snippets directory rather then examples directory, since the intended use is for frc-docs, and you likely wouldn't have a full robot that uses both a flywheel with bang bang and another one with pidf.

@gerth2 gerth2 changed the title WIP Example Implementations of Controls Tutorials Apr 11, 2026
@gerth2 gerth2 marked this pull request as ready for review April 14, 2026 02:03
@gerth2 gerth2 requested review from a team as code owners April 14, 2026 02:03

// Suppression is intentional - this file shows a "simple-as-possible" implementation
// that a beginner might reference. It is not intended to show "best" coding practices.
@SuppressWarnings("all")
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.

How many different things need to be suppressed? Normally we prefer individual suppressions.

Copy link
Copy Markdown
Contributor Author

@gerth2 gerth2 Apr 15, 2026

Choose a reason for hiding this comment

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

Three things right now:

  1. Incorrect naming patterns - I think I should probably just fix these.
  2. Variables that I put at class scope, but could be private (like the gains)
  3. Variables that could be marked as static and final but weren't.

(2) I think is just gonna be essential for good,concise docs.

(3) was preference based on pedagogy - if a student is learning PID before they've seen static/final/public/private qualifiers, I'd prefer not to have to introduce the topic in parallel, as well as minimize the chance they get confused as to why some variables are declared like that, but others aren't.

I'm open to thoughts though - a minimal way to address (3) is to just teach it in place ("Since these values aren't designed to change at runtime, we mark them as constant using the keywords static final".... something to that nature).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Quick update - ended up continuing to trim down the qualifiers and name prefixes on variables, got to the point where we just needed to suppress the naming pattern checks.

Again still open for feedback or thoughts. I'm starting with a minima/opinionated stance on how to express the code ideas for docs purposes but there's other ways to slice the problem too.

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.

2 participants