From 2faf39408e1dd7fcb2cde7d79f7db3a0a395d39e Mon Sep 17 00:00:00 2001 From: becker Date: Wed, 28 Feb 2024 01:11:53 +0100 Subject: [PATCH] patch --- .../tutel_max_value_pure.py | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/dennis_nodes/tutel_nodes_max_value_pure_variations/tutel_max_value_pure.py b/dennis_nodes/tutel_nodes_max_value_pure_variations/tutel_max_value_pure.py index 2d9f1e7..c5ca932 100644 --- a/dennis_nodes/tutel_nodes_max_value_pure_variations/tutel_max_value_pure.py +++ b/dennis_nodes/tutel_nodes_max_value_pure_variations/tutel_max_value_pure.py @@ -228,7 +228,10 @@ class tutel(): #f(x)=2914.2987x^-1.0159, with x := distance between camera and marker. Values rounded down to 4 digits. self.pixel_depth = ((self.pixel_length/2914.29872964688)**(-1/1.01590290349592))*10 #*10 to get the depth value in mm as the depth image delivers them in mm #self.pixel_length = (abs(self.top_left[0]-self.top_right[0]) + abs(self.top_left[1] - self.bottom_left[1]) + abs(self.top_right[1]-self.bottom_right[1]) + abs(self.bottom_right[0]-self.bottom_left[0]))/4 - #self.pixel_depth = ((self.pixel_length/2675,4910012317)**(-1/0.993434027))*10 + #self.pixel_depth = ((self.pixel_length/2675.4910012317)**(-1/0.993434027))*10 + #pixels = (abs(self.top_left[0]-self.top_right[0]), abs(self.top_left[1] - self.bottom_left[1]), abs(self.top_right[1]-self.bottom_right[1]), abs(self.bottom_right[0]-self.bottom_left[0])) + #self.pixel_length = max(pixels) + #self.pixel_depth = ((self.pixel_length/2858.4636643479)**(-1/1.0056840993))*10 #self.pixel_depth = (self.pixel_depth + ((((self.x[1] - self.x[0] + self.y[1] - self.y[0]) / 2)/2914.29872964688)**(-1/1.01590290349592))*10)/2 print(self.pixel_depth) if self.pixel_depth > self.max_threshold: @@ -245,7 +248,7 @@ class tutel(): #cv2.imshow("Tutel_Depth", depth_image) if self.last_depth < self.min_threshold and self.last_depth != 0: self.depth_counter += 1 - if self.depth_counter > 0: + if self.depth_counter > 1: self.routine = True print("Only a few cm") self.t.linear.x = 0.1 * self.vel_fac @@ -315,7 +318,18 @@ class tutel(): #self.t.angular.z = -0.2 * self.vel_fac #self.pub.publish(self.t) marker_x = ((x[0] + (x[1]-x[0])//2 - 5), (x[0] + (x[1]-x[0])//2 + 5)) - + if marker_x[1] < self.w//2: + #print("LEFT") + self.t.linear.x = 0.0 + self.t.angular.z = 0.2 + elif marker_x[0] > self.w//2: + #print("RIGHT") + self.t.linear.x = 0.0 + self.t.angular.z = 0.2 + else: + self.t.linear.x = 0.2 + self.t.angular.z = 0.0 + self.pub.publish(self.t) if int(self.w / 2) > self.top_left[0]: self.position = POSITIONS[0] elif self.w - int(self.w / 2) < self.top_left[0]: