-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Refactor Polyline to support speed variance. #5157
Conversation
@th3w4y, thanks for your PR! By analyzing the annotation information on this pull request, we identified @mjmadsen, @solderzzc and @kanemasa1987 to be potential reviewers |
@BreezeRo @sohje @solderzzc @mjmadsen as discussed in #5147 Please peer review and add the Review and Help tags to this PR Thanks... |
It seems there is still an issue :s. When the google api quota is reached, the MoveToFort task configured with PolylineWalker makes us jump from fort to fort. |
@anakin5 will try to see where it can go wrong... |
The Polyline only contains starting point and destination. Before, StepWalker was taking care of doing small steps. But now we directly set the destination. |
@anakin5 it cannot be... we have the speed involved in the calculation... |
@anakin5 I will add a test case for that see were it breaks.. I have managed to reproduce an object with API limit reached for directions..
|
I am sorry but i cannot reproduce... all .get_pos() returned the next calculated distance on the bearing between origin and destination
|
@anakin5 i am not able to simulate the Elevation API limit reach but i doubt that would be cause of the problem...
|
@anakin5 how many tasks do you have, which one are those, and.... any 2 tasks use PolylineWalker in the same time? |
It is daily limitation of the direction API. When it happen, there is only 2 steps: the origin and the destination. |
@anakin5 this not able to reproduce... do you have origin and destination? in my above example you can see i also had API limit reached and .get_pos() was returning correct:
|
@anakin5 and btw... first .get_pos() should not return the origin... should return the position after self.speed seconds.. are you sure it returns the origin? |
I was trying to print more logs to give you some info, but I found the issue. There is no sleep(1) in the whole bot loop when using PolylineWalker. It gives the impression we teleported while in fact we were setting the position very quickly. |
the Sleep is in StepWalker.. StepWalker sets the position then sleeps one second |
In my cast, I see the steps of the MoveToFort task with Polyline walker are around 2.25 meters, which is below my speed (2.5). So we teleport there because of the first condition in StepWalker.step. |
And there is no sleep there. |
@anakin5 you mean this ?:
|
yes |
Should we call heartbeat in that |
@mjmadsen yes that would be fine.. but we also have to sleep |
I am testing removing that branch completely, I do no see why we need it now. |
for now we have this PR #5169 |
@anakin5 i also believe is not needed but if we take it out it will scare people of course that is the only part that actually returns True... keep that in mind... |
It scares me to have it. Seems it is fine without that piece of code. However need to pay attention to the last step. Does the new calculation always return the exact destination point ? |
@anakin5 strictly from Polyline yes... |
So let's remove that branch then. |
@anakin5 not comfortable with that yet.. is the only branch that returns True.. |
@anakin5 and once again thanks for testing the PolylineWalker... you are usually first to report any bugs related to it. Thanks Thanks |
just worth mentioning not only the Polyline walker would have been affected by this... but all tasks.. at the last step.... (polyline was affected on each step...when random speed fetch by StepWalker from 2.16 to 4.15 would have been smaller then the calculated next pos on the poyline) |
@anakin5 i still think there might be an issue... not sure of the PolylineObjectHandler is doing it's job or at least i cannot mock it properly |
Update: It was the Mock()... was returning an mock object not None or API key.. All good! |
Short Description:
Description will be updated soon
Fixes