Tidy up some lidar stuff for testing and clarity.

This commit is contained in:
Piv
2020-03-09 23:02:19 +10:30
parent ef83365fd8
commit 50d8923ad0
5 changed files with 85 additions and 28 deletions

View File

@@ -27,11 +27,11 @@ class Group:
self._number = number
def _update_min_max(self, new_point):
'''
"""
Updates the in and max points for this group.
This is to determine when assigning groups whether the
same group is selected.
'''
"""
converted_point = convert_lidar_to_cartesian(new_point)
if self._minX is None or self._minX > converted_point[0]:
@@ -66,11 +66,22 @@ def convert_lidar_to_cartesian(new_point):
def calc_groups(scan):
'''
"""
Calculates groups of points from a lidar scan. The scan should
already be sorted.
Should return all groups.
'''
Parameters
----------
scan: Iterable
The lidar scan data to get groups of.
Should be of format: (quality, angle, distance)
Returns
-------
list
List of groups that were found.
"""
prevPoint = None
currentGroup = None
allGroups = []
@@ -104,9 +115,9 @@ def find_centre(group):
def assign_groups(prev_groups, new_groups):
'''
"""
Assigns group numbers to a new scan based on the groups of an old scan.
'''
"""
for group in prev_groups:
old_centre = find_centre(prev_groups)
for new_group in new_groups:
@@ -119,9 +130,9 @@ def assign_groups(prev_groups, new_groups):
def updateCarVelocity(oldGroup, newGroup):
'''
Return a tuple (throttleChange, steeringChange) that should be
applied given the change in the centre of the groups.
'''
"""
Return a vector indicating how the tracked group has changed, which can
be used to then update the steering/throttle of the car (or other vehicle that
may be used)
"""
pass