-
Notifications
You must be signed in to change notification settings - Fork 18
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
Ported the ProfiledPIDSubsystem from the wpilib java source to Python #49
Ported the ProfiledPIDSubsystem from the wpilib java source to Python #49
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly good, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I fixed all of the issues.
I see that some of the checks are failing. I think I understand the cause of the issue. I will work on fixing it tomorrow. |
I fixed the bug causing the Python 3.8 and 3.9 tests to fail. |
Thanks, everything looks good. There are multiple ProfiledPIDControllers (one for dimensionless, and one for radians), and even though they're effectively the same thing there are some C++ classes that require one or the other. If you have any experience with python's typing generics, any ideas you have to make this work with both types of ProfiledPIDControllers would be welcomed. I posted some thoughts on a related issue at #40, but I'm still mulling it over. If you don't have any ideas or expertise in this, that's fine. I'll contemplate and merge/adjust this once #46 is finished, which hopefully will be soon. |
I am working on a modification to the ProfiledPIDSubsystem that is also compatible with ProfiledPIDControllerRadians objects. Since there are (currently) only two different kinds of ProfiledPIDControllers, I am just using a Union (from the typing module) to include both types of controller object. While working on the changes, mypy indicated that ProfiledPIDController.setGoal() and ProfiledPIDControllerRadians.setGoal() take different argument types. The later only accepts a float argument, where the former accepts either a TrapezoidProfile.State or a float. I think I have a fix for that, but I want to create some test code before I push up a new commit. |
I'm going to merge this without typing for now. I don't really like the union approach, and I'm too tired to think through the generic/typevar approach. We can add types back at a later date. |
Co-authored-by: Dustin Spicuzza <[email protected]>
f6ec750
to
3a9e0bc
Compare
Used ChatGPT to get 80% of the job done. This is the ProfiledPIDSubsystem only. No new tests were added. I verified functionality using a separate robot simulation project.