Skip to content

Add SwerveBot example #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Dec 29, 2023
Merged

Add SwerveBot example #98

merged 8 commits into from
Dec 29, 2023

Conversation

megarubber
Copy link
Contributor

Issue #49

Add the SwerveBot example. I added a constants.py file to remove redundant imports, since the original Java example doesn't have a Constants.java.

@auscompgeek
Copy link
Member

I added a constants.py file to remove redundant imports

I'm not sure I understand, what would be redundant?

@megarubber
Copy link
Contributor Author

megarubber commented Dec 27, 2023

I added a constants.py file to remove redundant imports

I'm not sure I understand, what would be redundant?

They are mutual top-level imports, because drivetrain.py imports swervemodule.py, and vice versa. I created this file to avoid errors like this:
AttributeError: module 'drivetrain' has no attribute 'kModuleMaxAngularVelocity'

But now, I guess that can be fixed with:
from drivetrain import kModuleMaxAngularVelocity

@auscompgeek
Copy link
Member

auscompgeek commented Dec 28, 2023

Oh, you're trying to break an import cycle. Hmm. It seems odd to me that those constants would depend on each other in the example, since that doesn't seem like a physical constraint of real robots.

It looks like in the C++ example they're simply separate constants. Let's do that instead of introducing a constants module.

@virtuald virtuald merged commit d7df94c into robotpy:main Dec 29, 2023
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.

3 participants