-
Notifications
You must be signed in to change notification settings - Fork 77
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
✨[FEATURE REQUEST] Momentary Motor Disconnect Resilience #641
Comments
I would rather this be a template than built into the kernel. |
why would it need to be a template? this fix doesnt look too hard to implement |
This feels like something which should ideally be fixed on the vexOS end; it knows when the motor has disconnected and should mark the saved motor command as "not saved" in that event. That would be the proper solution. I agree that this shouldn't go in the kernel, or at least shouldn't be the default behaviour. The main issue I have with it is that it is a heuristic-based approach, rather than an actual fix to the logic, and it operates by modifying the command sent to the motor away from what user code requested. This adds a significant layer of complication to the motor behaviour, with lots of opportunity for bugs and unintended effects on performance. The fact that a fix to the logic cannot be done from the PROS or user code side is besides the point. |
Should this be closed as not planned? |
Yeah, although, I would like to point out that something similar is being worked on using timestamps instead to detect micro-disconnects: LemLib/hardware#5 And it doesn't address the problem of this not belonging in the kernel, since it would still greatly complicate the motor handling code for what is mostly an edge case. |
The problem that led me here
Several times in practice and comp, our catapult would just refuse to work because the cable was finicky and would sometimes disconnect momentarily while the catapult was retracting. Now, we have several safeguards for this including a good cable and a software safeguard. I was wondering if this software solution, or something similar to it, could be built in to PROS.
Generalized Problem
Observed Behavior
Motor does not resume spinning after being momentarily disconnected (meaning the motor disconnects then reconnects)
Expected Behavior
Motor resumes spinning after being reconnected
Steps to Reproduce
Hypothesis
The brain optimizes the number of messages sent to the motor by only notifying the motor about voltage changes. The requested voltage is stored in some form of volatile memory on the motor, such that when the motor loses power, the requested voltage is erased.
So in our example, only the first iteration of our while loop sends the message to the motor to spin at 127 power, because the voltage changed from 0 to 127. Every iteration after that does nothing. When the motor disconnects, the motor forgets that it should be spinning at 127 power, and thus it will not spin until the brain tells it to again. And the brain will never tell the motor to spin again, because we never change the voltage except for the first iteration of the while loop.
Note
This is just my hypothesis that explains the behavior that I observed. There is a good chance its not correct or not the full story.
Attempted Solutions:
What is the behavior that isn't addressed by the existing API?
Currently, PROS doesn't provide any safeguards for this momentary motor disconnect edge case.
Is this a problem that needs to be addressed by PROS? Probably not, as it is a small edge case, but it would be pretty cool.
Additional context
I believe this also occurs when radio disconnects and reconnects while field control is connected, but I have only heard this and have not tested it.
I'd be willing to submit a pr implementing this if I were given guidance on where and how, assuming its feasible for this to be built in to PROS.
The text was updated successfully, but these errors were encountered: