From 4f98f5bf857ac2dbe8d9b15627fb61e7d7b436dd Mon Sep 17 00:00:00 2001 From: becker Date: Mon, 4 Mar 2024 16:22:23 +0100 Subject: [PATCH] Dateien nach "dennis_nodes/tutel_nodes_max_value_pure_variations" hochladen --- .../tutel_max_value_pure.py | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 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 5cbaa37..ac3540d 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 @@ -146,10 +146,10 @@ class tutel(): if (time.time() - self.search_time) < 31.415925: if self.verbose == "terminal" or self.verbose == "both": print("LOOKING AROUND") self.t.linear.x = 0.00 * self.vel_fac - self.t.angular.z = 0.2 * self.vel_fac + self.t.angular.z = 0.15 * self.vel_fac else: if self.verbose == "terminal" or self.verbose == "both":print("TIMES UP") - self.t.linear.x = 0.2 * self.vel_fac + self.t.linear.x = 0.1 * self.vel_fac self.t.angular.z = 0.0 * self.vel_fac self.search_time = time.time() self.pub.publish(self.t) @@ -175,23 +175,23 @@ class tutel(): if self.verbose == "terminal" or self.verbose == "both": print("I NEED TO GO LEFT!") cv2.rectangle(rgb_image, (0,0), (20, self.h), (0,0,255), cv2.FILLED) self.t.linear.x = 0.0 * self.vel_fac - self.t.angular.z = 0.2 * self.vel_fac + self.t.angular.z = 0.15 * self.vel_fac self.pub.publish(self.t) elif self.position is POSITIONS[1]: if self.verbose == "terminal" or self.verbose == "both": print("I NEED TO GO RIGHT") cv2.rectangle(rgb_image, (self.w-20,0), (self.w, self.h), (0,0,255), cv2.FILLED) self.t.linear.x = 0.0 * self.vel_fac - self.t.angular.z = -0.2 * self.vel_fac + self.t.angular.z = -0.15 * self.vel_fac self.pub.publish(self.t) elif self.search == "place": if self.verbose == "terminal" or self.verbose == "both": print("SEARCH TIME") if (time.time() - self.search_time) < 31.415925: if self.verbose == "terminal" or self.verbose == "both": print("LOOKING AROUND") self.t.linear.x = 0.00 * self.vel_fac - self.t.angular.z = 0.2 * self.vel_fac + self.t.angular.z = 0.15 * self.vel_fac else: if self.verbose == "terminal" or self.verbose == "both": print("TIMES UP") - self.t.linear.x = 0.2 * self.vel_fac + self.t.linear.x = 0.15 * self.vel_fac self.t.angular.z = 0.0 * self.vel_fac self.search_time = time.time() self.pub.publish(self.t) @@ -349,17 +349,29 @@ class tutel(): #self.t.linear.x = 0.0 * self.vel_fac #self.t.angular.z = -0.2 * self.vel_fac #self.pub.publish(self.t) - if self.last_depth > 700: - if self.x[1] < self.w//2 - 30: + if self.last_depth > 1000: + if self.x[1] < self.w//2 - 80: if self.verbose == "terminal" or self.verbose == "both": print("LEFT") self.t.linear.x = 0.0 self.t.angular.z = 0.15 - elif self.x[0] > self.w//2 + 30: + elif self.x[0] > self.w//2 + 80: if self.verbose == "terminal" or self.verbose == "both": print("RIGHT") self.t.linear.x = 0.0 self.t.angular.z = -0.15 else: - self.t.linear.x = 0.2 + self.t.linear.x = 0.1 + self.t.angular.z = 0.0 + if self.last_depth > 700: + if self.x[1] < self.w//2 - 50: + if self.verbose == "terminal" or self.verbose == "both": print("LEFT") + self.t.linear.x = 0.0 + self.t.angular.z = 0.15 + elif self.x[0] > self.w//2 + 50: + if self.verbose == "terminal" or self.verbose == "both": print("RIGHT") + self.t.linear.x = 0.0 + self.t.angular.z = -0.15 + else: + self.t.linear.x = 0.1 self.t.angular.z = 0.0 else: marker_x = ((self.x[0] + (self.x[1]-self.x[0])//2 - 5), (self.x[0] + (self.x[1]-self.x[0])//2 + 5)) @@ -372,7 +384,7 @@ class tutel(): self.t.linear.x = 0.0 self.t.angular.z = -0.15 else: - self.t.linear.x = 0.2 + self.t.linear.x = 0.1 self.t.angular.z = 0.0 self.pub.publish(self.t) if int(self.w / 2) > self.top_left[0]: