From 8a343fecef4519c19e802e85cd8c9e06319b2633 Mon Sep 17 00:00:00 2001 From: anthony Date: Fri, 26 Apr 2024 11:40:41 -0400 Subject: [PATCH] stuff --- jetson_code/main.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/jetson_code/main.py b/jetson_code/main.py index 11efe94..b2a4b9e 100644 --- a/jetson_code/main.py +++ b/jetson_code/main.py @@ -50,13 +50,22 @@ def rotate(self, angle_rad: float): angle_deg = angle_rad * 180 / math.pi # TODO: Handle the case where the seconds needed to turn is greater than the maximum amount of seconds allowed + if angle_deg < 0: # turn left - turnLeft(ROBOT_SECONDS_PER_DEGREE * angle_deg) + fp = turnLeft else: # turn right - turnRight(ROBOT_SECONDS_PER_DEGREE * angle_deg) + fp = turnRight + + secs = ROBOT_SECONDS_PER_DEGREE * angle_deg + while secs > 0: + fp(min(secs * 1000, 999)) + secs -= min(secs * 1000, 999) def move_forward(self, distance_meters: float): - goForward(ROBOT_SECONDS_PER_METER * distance_meters) + secs = ROBOT_SECONDS_PER_METER * distance_meters + while secs > 0: + goForward(min(secs * 1000, 999)) + secs -= min(secs * 1000, 999) def collect_trash(self): pass