From 9deaeb32945fb258f23cb32f23e5c375eae35a15 Mon Sep 17 00:00:00 2001 From: Piv <18462828+Piv200@users.noreply.github.com> Date: Sun, 5 Apr 2020 18:59:38 +0930 Subject: [PATCH] Fix up some more commenting --- tracking/algorithms.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) 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):