diff --git a/tracking/algorithms.py b/tracking/algorithms.py index 98d8e62..cfdf658 100644 --- a/tracking/algorithms.py +++ b/tracking/algorithms.py @@ -136,6 +136,19 @@ def calc_groups(scan): def find_centre(group): + """ + Gets a tuple (x,y) of the centre of the group. + + Parameters + ---------- + group: Group + A group of points to find the centre of. + + Returns + ------- + tuple (x,y) + The centre in the form of a tuple (x,y) + """ return ((group.get_maxX() + group.get_minX()) / 2, (group.get_maxY() + group.get_minY()) / 2) @@ -159,8 +172,21 @@ def updateCarVelocity(oldGroup, newGroup): Return a tuple (DistanceChange, AngleChange) indicating how the tracked groups have changed, which can be used to then update the steering/throttle of the car (or other vehicle that may be used) + + Parameters + ---------- + oldGroup: Group + The positioning of points for the group in the last scan. + + newGroup: Group + The positioning of points for the group in the latest scan. + + Returns + ------- + tuple (DistanceChange, AngleChange) + A tuple containing how the groups' centres changed in the form (distance,angle) """ - pass + return (find_centre(newGroup)) def dualServoChange(newCentre, changeTuple):