Lidar fixes

This commit is contained in:
Piv
2020-04-15 21:41:09 +09:30
parent e09465e33c
commit 65c19e7494
2 changed files with 7 additions and 6 deletions

View File

@@ -83,11 +83,11 @@ def convert_cartesian_to_lidar(x, y):
A tuple (distance, angle) that represents the point. Angle is in degrees.
"""
# Angle depends on x/y position.
# if x is positive and y is positive, then angle = 90 - tan-1(y/x)
# if x is positive and y is negative, then angle = 90 + tan-1(y/x)
# if x is negative and y is positive, then angle = 270 + tan-1(y/x)
# if x is negative and y is negative, then angle = 270 - tan-1(y/x)
return (math.sqrt(x ** 2 + y ** 2), math.degrees(math.atan(y/x) + (180 if ))
# if x is positive and y is positive, then angle = tan-1(y/x)
# if x is positive and y is negative, then angle = 360 + tan-1(y/x)
# if x is negative and y is positive, then angle = 180 + tan-1(y/x)
# if x is negative and y is negative, then angle = 180 + tan-1(y/x)
return (math.sqrt(x ** 2 + y ** 2), math.degrees(math.atan(y/x)) + (180 if x < 0 else 270 if y < 0 else 0))
def calc_groups(scan):