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

Bot Is Moving SUPER-FAST #5168

Closed
oralunal opened this issue Sep 4, 2016 · 33 comments
Closed

Bot Is Moving SUPER-FAST #5168

oralunal opened this issue Sep 4, 2016 · 33 comments
Labels

Comments

@oralunal
Copy link
Contributor

oralunal commented Sep 4, 2016

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

@oralunal oralunal added the Bug label Sep 4, 2016
@julienlavergne
Copy link
Contributor

#5169

@th3w4y
Copy link
Contributor

th3w4y commented Sep 4, 2016

@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 #5169

@th3w4y
Copy link
Contributor

th3w4y commented Sep 4, 2016

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
Copy link
Contributor Author

oralunal commented Sep 4, 2016

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
Copy link
Contributor

th3w4y commented Sep 4, 2016

values are in m/s not km/h

thus values are between 7.8-15Km/h

@macio525
Copy link

macio525 commented Sep 4, 2016

4.16km/h= ~1.2m/s

@th3w4y
Copy link
Contributor

th3w4y commented Sep 4, 2016

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

@oralunal
Copy link
Contributor Author

oralunal commented Sep 4, 2016

@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
Copy link

macio525 commented Sep 4, 2016

4.16m/s in config, right?

@oralunal
Copy link
Contributor Author

oralunal commented Sep 4, 2016

No, walk_max and walk_min values are km/h

@macio525
Copy link

macio525 commented Sep 4, 2016

"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
Copy link
Contributor

th3w4y commented Sep 4, 2016

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

@oralunal
Copy link
Contributor Author

oralunal commented Sep 4, 2016

@th3w4y
Copy link
Contributor

th3w4y commented Sep 4, 2016

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

@th3w4y
Copy link
Contributor

th3w4y commented Sep 4, 2016

@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
Copy link
Contributor

th3w4y commented Sep 4, 2016

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

@th3w4y
Copy link
Contributor

th3w4y commented Sep 4, 2016

I will update the documentation 3259fb6

@mjmadsen
Copy link
Contributor

mjmadsen commented Sep 4, 2016

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

@mjmadsen
Copy link
Contributor

mjmadsen commented Sep 4, 2016

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
Copy link
Contributor

th3w4y commented Sep 4, 2016

@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
Copy link
Contributor

th3w4y commented Sep 4, 2016

@mjmadsen or...

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

@mjmadsen
Copy link
Contributor

mjmadsen commented Sep 4, 2016

I'm not sure atm

@th3w4y
Copy link
Contributor

th3w4y commented Sep 4, 2016

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

@th3w4y
Copy link
Contributor

th3w4y commented Sep 4, 2016

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
Copy link
Contributor

mjmadsen commented Sep 4, 2016

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 😄 I thought we had some timing bits in here.

@mjmadsen
Copy link
Contributor

mjmadsen commented Sep 4, 2016

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

@th3w4y
Copy link
Contributor

th3w4y commented Sep 4, 2016

@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
Copy link
Contributor

th3w4y commented Sep 4, 2016

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

@th3w4y
Copy link
Contributor

th3w4y commented Sep 4, 2016

@oralunal @mjmadsen let's get #5169 merge to fix this issues...

@mjmadsen
Copy link
Contributor

mjmadsen commented Sep 4, 2016

Oh I see it now. Duh!

@mjmadsen
Copy link
Contributor

mjmadsen commented Sep 4, 2016

Merged

@kureijir
Copy link

kureijir commented Sep 4, 2016

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.

@oralunal oralunal closed this as completed Sep 6, 2016
@th3w4y
Copy link
Contributor

th3w4y commented Sep 6, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants