Skip to content

34 constants switching depending on target chassis#36

Open
PillageDev wants to merge 2 commits intodevelopfrom
34-constants-switching-depending-on-target-chassis
Open

34 constants switching depending on target chassis#36
PillageDev wants to merge 2 commits intodevelopfrom
34-constants-switching-depending-on-target-chassis

Conversation

@PillageDev
Copy link
Member

Allows us to switch constants depending on the drive train we are running code on. This is useful so we can drive multiple robots with the same code. This will still work even if the mechanisms aren't on one of them.

Copy link
Contributor

@bjmcternan bjmcternan left a comment

Choose a reason for hiding this comment

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

This seems like a bit much for what we may need to do. I suspect both chassis should use the same motors and likely don't need all this abstraction. Let's discuss the intention before moving forward. We need to keep in mind maintainability and developers that are going to come after us.

Copy link

@afranchuk afranchuk left a comment

Choose a reason for hiding this comment

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

This works, but when I first heard discussion of this desired feature, I was hoping for build-system configuration rather than runtime configuration (e.g., configuration that would allow selecting the target chassis in the IDE). That could also avoid the runtime reflection needed with this approach, and allow proper type checking at compile time.


;

private static CommandSwerveDrivetrain instance;

Choose a reason for hiding this comment

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

This should not be static. Though, in practice, we won't be hot-swapping (only one call to createDrivetrain()), so it would work.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Constants switching depending on target chassis

3 participants