From 02c2c04ca4f48e930e654deb4a0391be67047a67 Mon Sep 17 00:00:00 2001 From: NikolajDanger Date: Wed, 2 Nov 2022 14:43:44 +0100 Subject: [PATCH] :sparkles: --- rally.py | 13 +++++++++++-- rally2.py | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/rally.py b/rally.py index aa2eab9..c1963b1 100644 --- a/rally.py +++ b/rally.py @@ -100,7 +100,7 @@ def main(): )[1][0][0] angle = np.rad2deg(np.arctan(position[0]/position[2])) - drive_distance = np.sqrt(position[0]**2 + position[2]**2) - 30 + drive_distance = np.sqrt(position[0]**2 + position[2]**2) - 100 if drive_distance < 30: break @@ -114,7 +114,16 @@ def main(): noah.stop() if not careful_forward((drive_distance * DRIVE_T)/1000, noah, 400): - break + arucos = find_aruco(noah.take_photo()) + if landmark in arucos: + position = cv2.aruco.estimatePoseSingleMarkers( + np.array([arucos[landmark]]), 14.5, CAMERA_MATRIX, DIST_COEF + )[1][0][0] + noah.go_diff(POWER, POWER, 1, 1) + time.sleep((90 * DRIVE_T)/1000) + noah.stop() + + break if __name__ == "__main__": main() diff --git a/rally2.py b/rally2.py index d0a2689..8f3f0f3 100644 --- a/rally2.py +++ b/rally2.py @@ -18,7 +18,7 @@ LANDMARK_POSITIONS = { POWER = 70 -TURN_T = 9.8 # 1 degree +TURN_T = 9.6 # 1 degree DRIVE_T = 22 # 1 centimeter RIGHT_WHEEL_OFFSET = 4