Skip to content

Commit

Permalink
revert changes to follow_path.py from request 4350 (#4395)
Browse files Browse the repository at this point in the history
* fix commit 4350

* Update follow_path.py

* Update follow_path.py

* Update follow_path.py
  • Loading branch information
ckrmml authored and solderzzc committed Aug 21, 2016
1 parent c995d82 commit 7ed96fe
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pokemongo_bot/cell_workers/follow_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ def load_gpx(self):
gpx = gpxpy.parse(gpx_file)

if len(gpx.tracks) == 0:
raise RuntimeError('GPX file does not cotain a track')
raise RuntimeError('GPX file does not contain a track')

points = []
track = gpx.tracks[0]
for segment in track.segments:
for point in segment.points:
points.append({"lat": point.latitude, "lng": point.longitude})
points.append({"lat": point.latitude, "lng": point.longitude, "alt": point.elevation})

return points

Expand All @@ -82,8 +82,10 @@ def find_closest_point_idx(self, points):
point = points[index]
botlat = self.bot.api._position_lat
botlng = self.bot.api._position_lng
botalt = self.bot.api._position_alt
lat = float(point['lat'])
lng = float(point['lng'])
alt = float(point['alt'])

dist = distance(
botlat,
Expand All @@ -99,11 +101,14 @@ def find_closest_point_idx(self, points):
return return_idx

def work(self):
last_lat, last_lng, last_alt = self.bot.api.get_position()
last_lat = self.bot.api._position_lat
last_lng = self.bot.api._position_lng
last_alt = self.bot.api._position_alt

point = self.points[self.ptr]
lat = float(point['lat'])
lng = float(point['lng'])
alt = float(point['alt'])

if self.bot.config.walk_max > 0:
step_walker = StepWalker(
Expand Down

0 comments on commit 7ed96fe

Please sign in to comment.