Closed pstephen43 closed 10 years ago
This is a good opportunity to implement an Observer Pattern in our software (http://en.wikipedia.org/wiki/Observer_pattern), and we should describe it as such in our software book. This will provide another point of distinction to highlight between our software and many others who are not even aware of the concept of software design patterns.
Were you and PJ working on the robot yesterday?
Michael McKellar c: 847-302-1052
From: pstephen43 notifications@github.com To: pstephen43/FTC5037GR FTC5037GR@noreply.github.com Sent: Monday, February 17, 2014 7:55 AM Subject: Re: [FTC5037GR] High priority stop condition detection & execution (#172)
This is a good opportunity to implement an Observer Pattern in our software (http://en.wikipedia.org/wiki/Observer_pattern), and we should describe it as such in our software book. This will provide another point of distinction to highlight between our software and many others who are not even aware of the concept of software design patterns. — Reply to this email directly or view it on GitHub.
Yes
we seem to have some latency between when a condition (for example, light threshold) is detected vs. when the stop command is actually issued. Additionally, there is likely some latency between when the condition is detected by our sensors and when we read the corresponding variable to know that we have detected it. Based on our log files, we are seeing as much as 10 BPU difference in position between when we detect a condition and when we actually come to rest. The goal is to minimize that latency by removing as much as the non-inertial component of that latency as possible. The latter factor is not detectable in the log file but, if its magnitude is significant, it is surely impacting our accuracy also.
Suggested Implementation:
1.) create a global variable to hold a function pointer of the function that will be called, from the high priority thread, when the condition is detected. 2.) create a function that looks for a specified sensor condition...the function should execute in its own thread and the thread should execute at a higher priority than the other threads
NOTE: The robot should be in motion already when the high priority thread is started. NOTE: We might have to recalibrate our distances to the end ramp once this is complete as the latency will be less than it was before (but hopefully more predictable)