Skip to content

65 refactor drivecoordinator and add drive to climb state#70

Open
avidraccoon wants to merge 163 commits intomainfrom
65-refactor-drivecoordinator-and-add-drive-to-climb-state
Open

65 refactor drivecoordinator and add drive to climb state#70
avidraccoon wants to merge 163 commits intomainfrom
65-refactor-drivecoordinator-and-add-drive-to-climb-state

Conversation

@avidraccoon
Copy link
Contributor

@avidraccoon avidraccoon commented Feb 20, 2026

This pull request introduces a new TypeScript-based auto-generation system for robot autonomous routines, including infrastructure for compiling, registering, and serializing auto actions, as well as updates to field and drive constants. The most important changes are grouped below:

Auto Generator System Implementation

  • Added a new auto_generator directory with TypeScript configuration (tsconfig.json), build scripts (compile_autos.mjs, run_autos.mjs), and supporting files for compiling and running auto routines. This includes a sample auto routine (newTestAuto.ts) and utility modules (AutoLib.ts, Shorthands.ts). [1] [2] [3] [4] [5] [6] [7]
  • Introduced a comprehensive set of classes in AutoAction.ts to represent auto actions, targets, profiles, gains, and related types for serialization and execution.

Auto Serialization and Output

  • The system now generates a single Autos.json file in src/main/deploy containing serialized auto routines, such as the "Random Auto" sequence for testing.

Field and Drive Constants Updates

  • Updated DriveConstants.json files to include defaultAutoPilotHeadingGains, providing default PID gains for autopilot heading control in both competition and test drivebase configurations. [1] [2]
  • Added climb locations to BlueFieldLocations.json and RedFieldLocations.json, specifying translation and rotation for left and right climb positions. [1] [2]

Vision and Controller Configuration

  • Adjusted vision gain constants in VisionConstants.json for the test drivebase, increasing the standard deviation factors.
  • Added a sample vision configuration file (vision-sample.json) and updated controller bindings in controllers-xbox.json to include a new test command. [1] [2]

Miscellaneous

  • Added .gitignore entries for node_modules and dist to the auto_generator directory.

Theta Back and others added 30 commits February 11, 2026 21:34
Adds a Python script that validates JSON constant files against their
corresponding Java class fields, catching silently ignored keys at build time.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use javap -verbose to read RuntimeVisibleAnnotations from .class files,
so fields annotated with @JSONExclude are excluded from the missing-key check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds a new /vision page with gain constants editing, camera
add/remove with slider+text controls for translation and rotation,
and wire format conversion between flat camera keys and array model.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add synced inches input alongside meters for translation fields,
with local state to allow arbitrary precision typing. Add npm
dev:robot script to proxy API to robot at 10.4.1.2.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Relabel "Save" → "Save to Robot" and "Save & Activate" → "Save to Robot & Activate"
in both ShotMapsEditor and VisionEditor. Add a "Save to Local" button that writes
config JSON to the source tree via a new Vite dev server middleware endpoint.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Static fields are not serialized to/from JSON, so they should
not be checked for presence in constant JSON files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a GET /local-load endpoint to read config JSON from the source tree,
a loadLocal API function, and "Load from Local" buttons in both
ShotMapsEditor and VisionEditor. Also refactors the Vite plugin to share
validation logic between load and save routes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@avidraccoon
Copy link
Contributor Author

I am currently trying to see if putting a null check before it gets to that constructor fixes it

@godmar
Copy link
Contributor

godmar commented Mar 11, 2026

I am currently trying to see if putting a null check before it gets to that constructor fixes it

Is this the entryAngle in JSONAPTarget that's null?

@avidraccoon
Copy link
Contributor Author

I am currently trying to see if putting a null check before it gets to that constructor fixes it

Is this the entryAngle in JSONAPTarget that's null?

Probably

But I have a solution for this that works, and I am making an issue and branch on coppercore right now.

@godmar
Copy link
Contributor

godmar commented Mar 11, 2026

When I put a new Rotation2d() in there instead of a null, then it crashes on rotationRadius:

   this.rotationRadius = target.getRotationRadius().orElse(null);

@avidraccoon
Copy link
Contributor Author

@godmar Here is the pull request for the fix

@godmar godmar self-requested a review March 11, 2026 19:58
# Auto registration
# ---------------------------------------------------------------------------

_autos: Dict[str, Any] = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the difference between _autos and _routines?

# Internal pointer stack
# ---------------------------------------------------------------------------

_command_pointers: List[List[Any]] = []
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that ContextVars might be better to use here than a global variable.

def serialize_autos() -> str:
"""Serializes all registered autos to a JSON string."""
result = {name: _serialize_value(action) for name, action in _autos.items()}
return json.dumps(result, indent=4)
Copy link
Contributor

Choose a reason for hiding this comment

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

indent=2 would be better here IMO.

jerk=0.1,
)

left_climb_location = FieldConstants.Tower.left_upright().to_pose2d().transform_by(climb_offset)
Copy link
Contributor

Choose a reason for hiding this comment

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

verify that this works for either alliance.


climb_lineup_velocity = 100.0

climb_left_lineup_entry_angle = rotation2d(degrees=0)
Copy link
Contributor

Choose a reason for hiding this comment

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

same question: does this angle work for both alliances?

headingController.reset();
}

@Override
Copy link
Contributor

Choose a reason for hiding this comment

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

Comments are missing. What is the purpose of this function?

@@ -0,0 +1,25 @@
package frc.robot.util.ts;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is no longer .ts is it.

// properties
m(
"""
@property
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, why is there so much python code in Java string literals?

CopperCoreMetadata.printInfo();

jsonHandler = JsonConstants.loadConstants();
jsonHandler = JsonConstants.loadConstants(this);
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this is passing a half-initialized RobotContainer

def coppercoreVersion = "2026.2.15"
def coppercoreVersion = "2026.2.16"

implementation "com.google.code.gson:gson:2.11.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this necessary and how do we guarantee it matches coppercore's?

@aidnem
Copy link
Contributor

aidnem commented Mar 12, 2026

@godmar I verified that these climb changes are legitimate; we did some climb tuning during auto tuning.

@godmar
Copy link
Contributor

godmar commented Mar 12, 2026

@godmar I verified that these climb changes are legitimate; we did some climb tuning during auto tuning.

Thanks! Let's be careful, so close to the finish line.

@avidraccoon can you revise so that, perhaps, we can merge tomorrow before or during shop? At least the parts that aren't referring to specific autos.

godmar and others added 3 commits March 12, 2026 19:07
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@aidnem
Copy link
Contributor

aidnem commented Mar 13, 2026

How did everything go today? Can we get this merged tomorrow?

@godmar
Copy link
Contributor

godmar commented Mar 13, 2026

How did everything go today? Can we get this merged tomorrow?

We tried some autos, but had trouble with taking in enough fuel and it's not clear what the strategy is when it comes to deciding on where to shoot from.

I think this branch has now become the quasi integration branch. @avidraccoon made a number of changes, I hope all of them made it in here.

I would like @avidraccoon to prioritize getting this merged. Some of my comments we won't have time to address.

@avidraccoon
Copy link
Contributor Author

How did everything go today? Can we get this merged tomorrow?

We tried some autos, but had trouble with taking in enough fuel and it's not clear what the strategy is when it comes to deciding on where to shoot from.

I think this branch has now become the quasi integration branch. @avidraccoon made a number of changes, I hope all of them made it in here.

I would like @avidraccoon to prioritize getting this merged. Some of my comments we won't have time to address.

Still need to push the commits from last night I think

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

Labels

hardware access Needs access to the physical robot/parts of it to be accomplished integration These are PRs that are being integrated or are in the queue to be integrated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor DriveCoordinator and add drive to climb state

5 participants