From 1bd99ff57b8beb7acb2e8dd2ce3914fc726fdcbe Mon Sep 17 00:00:00 2001 From: Dylan Zemlin Date: Sun, 2 Jun 2024 17:05:38 -0500 Subject: [PATCH] good changes for day 3 --- autonav_ws/src/autonav_nav/src/astar.py | 3 ++- autonav_ws/src/autonav_serial/src/serial_node.py | 8 ++++---- autonav_ws/src/autonav_vision/src/transformations.py | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/autonav_ws/src/autonav_nav/src/astar.py b/autonav_ws/src/autonav_nav/src/astar.py index 33bd596..1c159d4 100644 --- a/autonav_ws/src/autonav_nav/src/astar.py +++ b/autonav_ws/src/autonav_nav/src/astar.py @@ -23,7 +23,7 @@ CV_BRIDGE = cv_bridge.CvBridge() competition_waypoints = [ - [(42.6682623, -83.2193709), (42.6681206, -83.2193606), (42.6680766, -83.2193592), (42.6679277, -83.2193276), (42.668130236144883, -83.21889785301433)], # NORTH + [(42.6682623, -83.2193709), (42.6681206, -83.2193606), (42.6680766, -83.2193592), (42.6679277, -83.2193276), (42.6679216, -83.2189126), (42.668130236144883, -83.21889785301433)], # NORTH [(42.668086, -83.218446)], # [] ] @@ -168,6 +168,7 @@ def create_path(self): cv2.circle(cvimg, (self.best_pos[0], self.best_pos[1]), 1, (255, 0, 0), 1) cvimg = cv2.resize(cvimg, (320, 320), interpolation=cv2.INTER_NEAREST) + # Draw a grid on the image that is the scale of the original image, so it should be a 80x80 grid scaled up 4x for i in range(80): cv2.line(cvimg, (0, i * 4), (320, i * 4), (85, 85, 85), 1) diff --git a/autonav_ws/src/autonav_serial/src/serial_node.py b/autonav_ws/src/autonav_serial/src/serial_node.py index 026762f..642065a 100644 --- a/autonav_ws/src/autonav_serial/src/serial_node.py +++ b/autonav_ws/src/autonav_serial/src/serial_node.py @@ -105,7 +105,7 @@ def canThreadWorker(self): continue if self.can is not None: try: - msg = self.can.recv(timeout=1) + msg = self.can.recv(timeout=0.01) if msg is not None: self.onCanMessageReceived(msg) except can.CanError: @@ -166,14 +166,14 @@ def onCanMessageReceived(self, msg): def canWorker(self): try: - with open("/dev/autonav-can-835", "r") as f: + with open("/dev/ttyACM0", "r") as f: pass if self.can is not None: return self.can = can.ThreadSafeBus( - bustype="slcan", channel="/dev/autonav-can-835", bitrate=100000) + bustype="slcan", channel="/dev/ttyACM0", bitrate=100000) self.set_device_state(DeviceStateEnum.OPERATING) except: if self.can is not None: @@ -189,7 +189,7 @@ def onSafetyLightsReceived(self, lights: SafetyLights): packed_data = SafetyLightsPacket() packed_data.autonomous = lights.autonomous packed_data.eco = False - packed_data.mode = 0 + packed_data.mode = 0 if not lights.autonomous else 2 packed_data.brightness = lights.brightness packed_data.red = lights.red packed_data.green = lights.green diff --git a/autonav_ws/src/autonav_vision/src/transformations.py b/autonav_ws/src/autonav_vision/src/transformations.py index 4d10dce..1ab370d 100644 --- a/autonav_ws/src/autonav_vision/src/transformations.py +++ b/autonav_ws/src/autonav_vision/src/transformations.py @@ -234,8 +234,8 @@ def apply_hsv(self, img): upper = (self.config.upper_hue, self.config.upper_sat, self.config.upper_val) mask1 = cv2.inRange(img, lower, upper) - lower = (70, 128, 80) - upper = (145, 255, 255) + lower = (110, 180, 110) + upper = (145, 255, 180) mask2 = cv2.inRange(img, lower, upper) epic_mask = cv2.add(mask1, mask2)