PokemonGoF / PokemonGo-Bot

The Pokemon Go Bot, baking with community.
MIT License
3.87k stars 1.54k forks source link

Bot Is Moving SUPER-FAST #5168

Closed oralunal closed 8 years ago

oralunal commented 8 years ago

Expected Behavior

My speed should be between 2-4 km/h

Actual Behavior

It's like flying, He moved 270 meters in 5 secs :)

Your FULL config.json (remove your username, password, gmapkey and any other private info)

http://pastebin.com/Y3McgMeg

Output when issue occurred

http://pastebin.com/XkVLPfv1

Other Information

OS: Windows 10 Branch: dev Git Commit: 847c45bca3fa8244e00ab418308495b52b54436f

Python Version: Python 2.7.12
julienlavergne commented 8 years ago

https://github.com/PokemonGoF/PokemonGo-Bot/pull/5169

th3w4y commented 8 years ago

@oralunal that is because the StepWalker does not sleep if

if (self.dLat == 0 and self.dLng == 0) or self.dist < self.speed:

i added sleep(1) to that in https://github.com/PokemonGoF/PokemonGo-Bot/pull/5169

th3w4y commented 8 years ago

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)

oralunal commented 8 years ago

This is occured in Polyline.. Now I passed to stepwalker and there is problem about speed calculation..

[2016-09-04 12:44:31] [MoveToFort] [INFO] Moving towards pokestop Vişnelik Küçük Park - 315.53m
[2016-09-04 12:44:37] [MoveToFort] [INFO] Moving towards pokestop Vişnelik Küçük Park - 300.66m
[2016-09-04 12:44:42] [MoveToFort] [INFO] Moving towards pokestop Vişnelik Küçük Park - 285.04m
[2016-09-04 12:44:48] [MoveToFort] [INFO] Moving towards pokestop Vişnelik Küçük Park - 270.33m

With this log my speed is 10 km/h.. But it should be max 4.16 km/h..

th3w4y commented 8 years ago

values are in m/s not km/h

thus values are between 7.8-15Km/h

macio525 commented 8 years ago

4.16km/h= ~1.2m/s

th3w4y commented 8 years ago

@macio525: speed is calculated in m/s not km/h

oralunal commented 8 years ago

@th3w4y exactly. If you take a look to my config file you'll see this:

    "walk_max": 4.16,
    "walk_min": 2.16,

So, there is something wrong.

macio525 commented 8 years ago

4.16m/s in config, right?

oralunal commented 8 years ago

No, walk_max and walk_min values are km/h

macio525 commented 8 years ago

"walk_max: 4.16: Set the maximum walking speed (1 is about 1.5km/hr)" "walk_min: 2.16: Set the minimum walking speed (1 is about 1.5km/hr)"

th3w4y commented 8 years ago

@oralunal where is this written? that the speed are in km/h? everywhere in the code calculations and all are in m/s

oralunal commented 8 years ago

@th3w4y as @macio525 mentioned it's written in configuration https://github.com/PokemonGoF/PokemonGo-Bot/blob/master/docs/configuration_files.md

th3w4y commented 8 years ago

@oralunal documentation is incorrect then.. it always has been m/s check even the master code..

th3w4y commented 8 years ago

@oralunal

Nr of steps was distance/speed

self.steps = (self.dist + 0.0) / (self.speed + 0.0)

we had steps of one second because of the sleep(1)

        sleep(1)  # sleep one second plus a random delta
        # self._work_at_position(
        #     self.initLat, self.initLng,
        #     alt, False)
th3w4y commented 8 years ago

@oralunal this we have self.dist in meter decided per "self.speed" and step was one second this makes it m/s

th3w4y commented 8 years ago

I will update the documentation https://github.com/PokemonGoF/PokemonGo-Bot/commit/3259fb660d19276ef26427435f655f85cc0ed61d

mjmadsen commented 8 years ago

Walking speed is an empirical number - not a real world unit.

mjmadsen commented 8 years ago

arbitrary is probably a better word.

Plus the distance between two coords using long/lat will vary depending on where in the world we're running the bot.

th3w4y commented 8 years ago

@mjmadsen it kinda is a real unit is m/s

the distance variance depending on where in the world is very very small not even worth mentioning... will maybe cause more confusion...

th3w4y commented 8 years ago

@mjmadsen or...

do we still waist lot of time in bot.heartbeat()??

mjmadsen commented 8 years ago

I'm not sure atm

th3w4y commented 8 years ago

@mjmadsen if we do.. then every second spent then make the real speed smaller...

th3w4y commented 8 years ago

but if i am to infer from @oralunal comment regarding 10km/h i'd guess we don't spend much time in bot.heartbeat() otherwise we will not see that speed...

mjmadsen commented 8 years ago
def heartbeat(self):
    if self.config.health_record:
        current_time = time.time()
        if current_time - self.heartbeat_wait > self.last_heartbeat:
            self.last_heartbeat = current_time
            self.track_url('/heartbeat')

That doesn't do what I expected :smile: I thought we had some timing bits in here.

mjmadsen commented 8 years ago

Why are we even calling that from tasks and walkers? Should be somewhere higher on the foodchain

th3w4y commented 8 years ago

@mjmadsen it has a self.last_heartbeat default 10seconds threadsholt at least... thus runs every 10 sec...

        now = time.time()
        self.fort_timeouts = {id: timeout for id, timeout
                              in self.fort_timeouts.iteritems()
                              if timeout >= now * 1000}

        if now - self.last_heartbeat >= self.heartbeat_threshold:
            self.last_heartbeat = now
            request = self.api.create_request()
            request.get_player()
            request.check_awarded_badges()
            responses = request.call()

thus i'd guess only one in 3-4 steps are slowed by it...

th3w4y commented 8 years ago

@mjmadsen the one you were mentioning is a different heartbeat... health_record.heartbeat()

th3w4y commented 8 years ago

@oralunal @mjmadsen let's get https://github.com/PokemonGoF/PokemonGo-Bot/pull/5169 merge to fix this issues...

mjmadsen commented 8 years ago

Oh I see it now. Duh!

mjmadsen commented 8 years ago

Merged

kureijir commented 8 years ago

I had my max and min speed set to 6 and 5 respectively before and it ran just fine. Updated today and realized that the bot move too fast, so I tuned down max speed to 3 and min speed to 2.5, yet it's still a little faster than before.

th3w4y commented 8 years ago

what do you guys think... shall we bailout with a message say if average min-max > 4 ?