Skip to content

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

3 participants