Skip to content

Comments

step_walker variance #3943

Merged
elicwhite merged 33 commits intoPokemonGoF:devfrom
mjmadsen:dev
Aug 15, 2016
Merged

step_walker variance #3943
elicwhite merged 33 commits intoPokemonGoF:devfrom
mjmadsen:dev

Conversation

@mjmadsen
Copy link
Contributor

@mjmadsen mjmadsen commented Aug 14, 2016

Switched walk in config to walk_max and walk_min to add variance to stepper.
Also added variance when close to stop/pokemon.
Removed redundant parameters.
Updated configs to reflect change.

Updated for conflicts (#3857).

@mention-bot
Copy link

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

@DiegoRBaquero
Copy link

@mjmadsen Maybe add a comment that the config is in meters/second? People having speed of 20+ is just a guaranteed ban.

@mjmadsen
Copy link
Contributor Author

mjmadsen commented Aug 14, 2016

From what I can tell, the previous code uses walk as km per hour. distance_unit is used purely for output (from what I can tell).

@DiegoRBaquero Added a brief note in the base config. We need a total overhaul on documentation anyway, but I'd prefer we reduce our bans in the meantime.

@DiegoRBaquero
Copy link

I just checked and this is with 10 as the walk setting:

2016-08-14 13:14:44,265 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Love Poem - 0.16km
2016-08-14 13:14:46,785 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Love Poem - 0.15km
2016-08-14 13:14:49,615 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Love Poem - 0.14km
2016-08-14 13:14:51,884 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Love Poem - 0.13km
2016-08-14 13:14:55,459 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Love Poem - 0.12km
2016-08-14 13:14:57,573 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Love Poem - 0.11km
2016-08-14 13:15:00,094 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Love Poem - 0.10km
2016-08-14 13:15:02,733 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Love Poem - 0.09km
2016-08-14 13:15:04,415 [IncubateEggs] [INFO] [next_egg_incubates] Next egg incubates in 0.80 km
2016-08-14 13:15:05,297 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Love Poem - 0.08km

and:

2016-08-14 13:17:07,501 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Instituto De Genética UN - 0.15km
2016-08-14 13:17:10,008 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Instituto De Genética UN - 0.14km
2016-08-14 13:17:13,232 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Instituto De Genética UN - 0.13km
2016-08-14 13:17:15,945 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Instituto De Genética UN - 0.12km
2016-08-14 13:17:18,298 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Instituto De Genética UN - 0.11km
2016-08-14 13:17:21,064 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Instituto De Genética UN - 0.10km
2016-08-14 13:17:23,553 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Instituto De Genética UN - 0.09km
2016-08-14 13:17:26,780 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Instituto De Genética UN - 0.08km
2016-08-14 13:17:29,272 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Instituto De Genética UN - 0.07km
2016-08-14 13:17:31,594 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Instituto De Genética UN - 0.05km
2016-08-14 13:17:34,121 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Instituto De Genética UN - 0.04km

and

2016-08-14 13:18:18,457 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Mural Abstracto - 0.13km
2016-08-14 13:18:20,780 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Mural Abstracto - 0.12km
2016-08-14 13:18:23,661 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Mural Abstracto - 0.11km
2016-08-14 13:18:26,380 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Mural Abstracto - 0.10km
2016-08-14 13:18:28,486 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Mural Abstracto - 0.08km
2016-08-14 13:18:31,086 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Mural Abstracto - 0.07km
2016-08-14 13:18:33,652 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Mural Abstracto - 0.06km
2016-08-14 13:18:36,887 [MoveToFort] [INFO] [moving_to_fort] Moving towards pokestop Mural Abstracto - 0.05km

Which gives us 13.68 km/h (3.8 m/s), 14.65 km/h (4.07 m/s) and 16 km/ (4.44m/s) respectively.

We should try and match km/h by diving the given speed in ~1.45 in that case, thoughts?

@mjmadsen
Copy link
Contributor Author

mjmadsen commented Aug 14, 2016

@DiegoRBaquero That's interesting. Certainly could explain why my walk = 14 accounts got softbans. I'm not sure why it would be such a difference. The long_lat random is supposed to add a variance of -/+ 9.1 ft, so I don't think that would account for an extra 3-6km/hr.

EDIT: Was that using a variance?

@DiegoRBaquero
Copy link

@mjmadsen No, that was using 10, no variance at all. The random delta in average shouldn't add extra km/h at all.

@mjmadsen
Copy link
Contributor Author

mjmadsen commented Aug 14, 2016

Wonder if we have a km to long/lat error somewhere.

`======================================================================

FAIL: test_normalized_distance (tests.step_walker_test.TestStepWalker)

Traceback (most recent call last):
File "/home/travis/build/PokemonGoF/PokemonGo-Bot/tests/step_walker_test.py", line 33, in test_normalized_distance
self.assertGreater(sw.dLat, 0)

AssertionError: 0 not greater than 0

FAIL: test_normalized_distance_times_2 (tests.step_walker_test.TestStepWalker)

Traceback (most recent call last):
File "/home/travis/build/PokemonGoF/PokemonGo-Bot/tests/step_walker_test.py", line 44, in test_normalized_distance_times_2
self.assertTrue(sw.dLat > 0)
AssertionError: False is not true`

Error from last test. I'm going to sleep. It appears that step_walker_test feeds different speeds values into the stepper. So the whole effort of reducing parameters is lost. Are these functions worth anything? If so, I can revert all parameter changes. Let me know.

@mjmadsen
Copy link
Contributor Author

@douglascamata The test file hack is less than ideal. But the core code is ultimately more readable because of the changes to parameters. Let me know what you think.

@DiegoRBaquero
Copy link

@douglascamata When the ONLY action that runs is walking, as in my comment: #3943 (comment), we can get really near to km/h dividing by 1.45

I can get a more exact average if we will implement the simple division.

@elicwhite
Copy link
Contributor

The unit is distance, but not velocity. The unit is how far we will move on each step, but we don't make any guarantees as to how many steps per time we make.

@smfbrooks
Copy link

Maybe this is done better with setting a boolean in the config and varying the existing speed attribute periodically by a random percentage if the bool was set to true. Doesn't break existing configs.

@Quantra
Copy link
Contributor

Quantra commented Aug 15, 2016

With regards to speed would it be possible to measure the time between steps and alter the step distance based on that? Then if we've spent ages recycling items or w/e it won't matter we'll just make a bigger step next time?

@DiegoRBaquero
Copy link

@TheSavior Then we should add in the doc that the distance is in meters and that a value of 4.16 (default) turns, approximately into 6 km/h.

@mjmadsen
Copy link
Contributor Author

mjmadsen commented Aug 15, 2016

@Quantra I don't think the app updates position when in menus, stops or catching pokemon. So we may not want to push our distance change if we've been caught up in those actions for a while.

@TheSavior I get that we can't guarantee total distance for an hour, but it would be nice if walking speed were directly related to some form of measure or as @DiegoRBaquero mentioned, we indicate an approx. relationship between walk values and km/hr. Basically so we're dictating the speed at which we walk when we ARE walking. However, these (imo) are not in the scope of this PR.

I'm at work right now, so I can't test much. However, I'll see about adding a comment on startup about walk in the config. I don't think anyone's config would break with the present code - we still pull default values when the config is loaded.


self.speed = speed
if self.bot.config.walk == 0:
self.speed = self.bot.config.walk_min - random() * (self.bot.config.walk_max - self.bot.config.walk_min)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be
self.speed = self.bot.config.walk_max - random() * (self.bot.config.walk_max - self.bot.config.walk_min)
?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep! Thank you.

Adding walk back in made the test files mess up again. Default values for walk_max, walk_min should be fine until folks update their configs.
Configs should work fine with default walk_max and walk_min values.
@mjmadsen mjmadsen mentioned this pull request Aug 15, 2016
@mjmadsen
Copy link
Contributor Author

mjmadsen commented Aug 15, 2016

I removed the switch to use walk instead of walk_min/walk_max and removed walk from the config. It will generate a warning on startup and will still have the default values for walk_max/walk_min.


old_flags = ['mode', 'catch_pokemon', 'spin_forts', 'forts_spin', 'hatch_eggs', 'release_pokemon', 'softban_fix',
'longer_eggs_first', 'evolve_speed', 'use_lucky_egg', 'item_filter', 'evolve_all', 'evolve_cp_min', 'max_steps']
'longer_eggs_first', 'evolve_speed', 'use_lucky_egg', 'item_filter', 'evolve_all', 'evolve_cp_min',
Copy link
Contributor

@elicwhite elicwhite Aug 15, 2016

Choose a reason for hiding this comment

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

We don't want to add it here because this will exit the bot saying that it doesn't exist anymore. You should just check for walk being set, print a message that walk_min and walk_max are used now instead, and then the bot should be able to keep running

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Switch it to a warning below.

@elicwhite
Copy link
Contributor

elicwhite commented Aug 15, 2016

👍

Approved with PullApprove

@elicwhite elicwhite merged commit 603aca6 into PokemonGoF:dev Aug 15, 2016
@dezayner
Copy link

dezayner commented Aug 15, 2016

I got this error

[01:09] Walking from (-7.982077060831172, 112.63066117494552, 0) to (-7.982088600000001, 112.6310973, 0) (48.0422623786 m)
[01:09]
[01:09] Ran for 0:01:40
[01:09] Total XP Earned: 110 Average: 3960.12/h
[01:09] Travelled 0.00km
[01:09] Visited 0 stops
[01:09] Encountered 1 pokemon, 1 caught, 1 released, 0 evolved, 0 never seen before
[01:09] Threw 1 pokeball
[01:09] Earned 100 Stardust
[01:09]
[01:09] Highest CP Pokemon: Scyther [CP: 548] [IV: 3/14/12] Potential: 0.64
[01:09] Most Perfect Pokemon: Scyther [CP: 548] [IV: 3/14/12] Potential: 0.64
Traceback (most recent call last):
File "pokecli.py", line 610, in
main()
File "pokecli.py", line 105, in main
bot.tick()
File "D:\gamezone\pokebots\PokemonGo-Bot-Dev\pokemongo_bot__init__.py", line 490, in tick
if worker.work() == WorkerResult.RUNNING:
File "D:\gamezone\pokebots\PokemonGo-Bot-Dev\pokemongo_bot\cell_workers\follow_spiral.py", line 117, in work
if dist <= 1 or (self.bot.config.walk > 0 and step_walker == None):
AttributeError: 'Namespace' object has no attribute 'walk'
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants