Fixed RPLidar bug

This commit is contained in:
simondlevy
2018-07-01 01:37:03 -04:00
parent fd831ba858
commit 1c8ec22b99

View File

@@ -23,9 +23,11 @@ class Laser(object):
'''
A class representing the specifications of a scanning laser rangefinder (Lidar).
'''
def __init__(self, scan_rate_hz, distance_no_detection_mm, detection_margin=0, offset_mm=0):
def __init__(self, scan_size, scan_rate_hz, detection_angle_degrees, distance_no_detection_mm, detection_margin=0, offset_mm=0):
self.scan_size = scan_size
self.scan_rate_hz = scan_rate_hz
self.detection_angle_degrees = detection_angle_degrees
self.distance_no_detection_mm = distance_no_detection_mm
self.detection_margin = detection_margin
self.offset_mm = offset_mm
@@ -39,40 +41,22 @@ class Laser(object):
return str(self)
class FixedSizeLaser(Laser):
'''
A class for lasers that have a fixed number of angles per scan
'''
def __init__(self, scan_size, scan_rate_hz, detection_angle_degrees, distance_no_detection_mm, detection_margin=0, offset_mm=0):
Laser.__init__(self, scan_rate_hz, distance_no_detection_mm, detection_margin, offset_mm)
self.scan_size = scan_size
self.detection_angle_degrees = detection_angle_degrees
def __str__(self):
return Laser.__str__(self) + ' | ' + ('scan_size=%d | detection_angle=%3.3f deg' % (self.scan_size, self.detection_angle_degrees))
def __repr__(self):
return str(self)
class URG04LX(FixedSizeLaser):
class URG04LX(Laser):
'''
A class for the Hokuyo URG-04LX
'''
def __init__(self, detectionMargin = 0, offsetMillimeters = 0):
FixedSizeLaser.__init__(self, 682, 10, 240, 4000, detectionMargin, offsetMillimeters)
Laser.__init__(self, 682, 10, 240, 4000, detectionMargin, offsetMillimeters)
class XVLidar(FixedSizeLaser):
class XVLidar(Laser):
'''
A class for the GetSurreal XVLidar
'''
def __init__(self, detectionMargin = 0, offsetMillimeters = 0):
FixedSizeLaser.__init__(self, 360, 5.5, 360, 6000, detectionMargin, offsetMillimeters)
Laser.__init__(self, 360, 5.5, 360, 6000, detectionMargin, offsetMillimeters)
class RPLidarA1(Laser):
'''
@@ -80,6 +64,5 @@ class RPLidarA1(Laser):
'''
def __init__(self, detectionMargin = 0, offsetMillimeters = 0):
Laser.__init__(self, 5.5, 12000, detectionMargin, offsetMillimeters)
Laser.__init__(self, 360, 5.5, 360, 12000, detectionMargin, offsetMillimeters)