Skip to content

Commit

Permalink
Merge pull request #6 from robotika/feature/fix-laser-dirt
Browse files Browse the repository at this point in the history
Feature/fix laser dirt
  • Loading branch information
m3d committed Nov 28, 2017
2 parents 29ccf5a + e79df94 commit a0c1fe3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion logparser.py
Expand Up @@ -84,11 +84,14 @@ def parse(filename, verbose, gyro_output=False):
assert size == 2*271 + 271, size
scan = struct.unpack('>' + 'H'*271, data[:2*271])

# restrict laser view to 180deg
scan = scan[45:-45]

d = total_dist_raw * 6.465/400.0
pose_arr.append((d, 0))
for i, dist_mm in enumerate(scan):
if dist_mm > 0:
angle = math.radians(i-135.0)
angle = math.radians(i-90.0)
dist = dist_mm/1000.0
x, y = d + math.cos(angle)*dist, math.sin(angle)*dist
arr.append((x, y))
Expand Down
3 changes: 2 additions & 1 deletion myr2017.py
Expand Up @@ -147,6 +147,7 @@ def navigate_row(robot, verbose):
MAX_GAP_SIZE = 13 # defined for plants on both sides
OPEN_SIZE = 17
OFFSET_SIZE = 5
END_OF_ROW_SIZE = 18 + 19 # for 180deg FOV

robot.move_forward()
end_of_row = False
Expand Down Expand Up @@ -186,7 +187,7 @@ def navigate_row(robot, verbose):

if verbose:
print('%4d' % max_dist, triplet)
if max_dist == 0:
if left + right >= END_OF_ROW_SIZE:
end_of_row = True


Expand Down
2 changes: 1 addition & 1 deletion robot.py
Expand Up @@ -74,7 +74,7 @@ def wait(self, how_long):

def update_laser(self, data):
assert len(data) == 2*271 + 271, len(data)
self.laser = struct.unpack('>' + 'H'*271, data[:2*271])
self.laser = struct.unpack('>' + 'H'*271, data[:2*271])[45:-45]

def update_odometry(self, data):
assert len(data) == 4, len(data)
Expand Down

0 comments on commit a0c1fe3

Please sign in to comment.