Skip to content
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

Fix step walker and move to fort issues #5407

Closed
wants to merge 1 commit into from
Closed

Fix step walker and move to fort issues #5407

wants to merge 1 commit into from

Conversation

julienlavergne
Copy link
Contributor

@julienlavergne julienlavergne commented Sep 12, 2016

  • Fix step walker timing issue. This solve some problems where we were moving more than the configured speed from time to time.
  • Fix move to fort task infinite loop with Polyline. Because MoveToFort was always taking the nearest fort, and because we do not always choose the straight line to move (Polyline), you might end up in a scenario where you infinitely switch between 2 forts.
  • Improve a bit the computation speed of step_walker get_next_step
  • pep8 fixes

Will fix #5384 but potentially other weird behavior as well

@mention-bot
Copy link

@anakin5, thanks for your PR! By analyzing the annotation information on this pull request, we identified @douglascamata, @TheSavior and @Gobberwart to be potential reviewers

@julienlavergne julienlavergne changed the title Fix step walke and move to fort issues Fix step walker and move to fort issues Sep 12, 2016
return WorkerResult.SUCCESS
if self.destination is not None:
self.walker = walker_factory(self.config_walker, self.bot, self.destination['latitude'], self.destination['longitude'])
self.walker.is_arrived = self.walker_is_arrived
Copy link
Contributor

@th3w4y th3w4y Sep 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are monkeypatching walker is_arrived method? fine by me if documented 👍
But I wonder how clear is this for everybody...
Could you please at least add a comment in the code...!
(Raise you hands whoever does not know what monkey patching is! :) )
http://cosent.nl/en/blog/monkey-patching-good-bad-ugly

@th3w4y
Copy link
Contributor

th3w4y commented Sep 12, 2016

We would be probably be better off by adding a parameter to the StepWalker __init__with the arrival_range to be handled by its is_arrived() method if you want to modify the StepWalker behaviour... not the monkey patching you proposed!

With a usage something like:
StepWalker(bot, dlat, dlng, arrival_range=Constants.MAX_DISTANCE_FORT_IS_REACHABLE)

That could benefit to other tasks also.. not monkeypatch them all one by one...!

@th3w4y
Copy link
Contributor

th3w4y commented Sep 30, 2016

@anakin5 is this still a change you want to do? I see it now detached from your repo/branch

@julienlavergne
Copy link
Contributor Author

it got detached when this repo has been deleted. I still plan to do the changes and create another pr

@davidakachaos
Copy link
Contributor

@anakin5 ping?

@MerlionRock
Copy link
Contributor

MerlionRock commented Jan 17, 2017

@davidakachaos Do you mind merging this to your changes? So that when both yours and this are committed, I can move on to investigate what causes walker not moving after a session slate.

As this PR prevent polyline from moving between 2 forts continuously.

@davidakachaos
Copy link
Contributor

@MerlionRock I don't mind, but my two PRs were merged already. And I didn't modify these files, so could you please tell me where I should merge?

@MerlionRock
Copy link
Contributor

@davidachaos then maybe I'll try to raise a PR myself base on what has already being merged.

Just not sure how to correct that Monkey patching....

@davidakachaos
Copy link
Contributor

@MerlionRock Okay, well, if I can help you out in some way, let me know 😄

@MerlionRock
Copy link
Contributor

@davidakachaos Step walker has no conflict, I'll do a PR for it.

I've changed move_to_fort with a little simple logic to prevent it from infinitely switching between 2 forts instead. Will merge it instead of using Anakin5's.

But I'll wait for the 0.53 API to be ready first before doing these PR.

@davidakachaos
Copy link
Contributor

davidakachaos commented Jan 21, 2017 via email

solderzzc pushed a commit that referenced this pull request Jan 30, 2017
* Proto requirements fix (#5888)

* Added Total Stardust to UpdateLiveStats task (#5874)

* added Total Stardust to UpdateLiveStats task

* fixes to tests, thanks to @nelsyeung

* enabled option to log to file (#5881)

* Fixes #5883 (#5884)

This fixes an issue when you have a brand new account (no stardust yet)
and run the bot. This makes sure the key is there before we do something
with it.

* removing proto and protobuf and changing pogoapi to dev

* removing proto and protobuf, changing pogoapi to dev branch, fixing docs and install scripts

* Prevent bouncing between 2 forts

Added simple logic to prevent bouncing between 2 forts when using Polyline walker

* Original fixes by Anakin5

Original PR by Anakin5 which fixes the following:
#5407
Fix step walker timing issue. This solve some problems where we were moving more than the configured speed from time to time.
Improve a bit the computation speed of step_walker get_next_step
pep8 fixes

* Prevent bouncing between 2 forts

Added simple logic to prevent bouncing between 2 forts when using Polyline walker
@davidakachaos
Copy link
Contributor

@MerlionRock I think this PR can be closed now? cc @solderzzc

@MerlionRock
Copy link
Contributor

@davidakachaos I guess so. If @anakin5 ever return, he can reopen it. cc @solderzzc

@solderzzc
Copy link
Contributor

Yes, Let me close it by now. @davidakachaos @MerlionRock

@solderzzc solderzzc closed this Jan 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants