Dateien nach "dennis_nodes/tutel_nodes_max_value_pure_variations" hochladen

This commit is contained in:
2024-03-04 16:22:23 +01:00
parent bdde39d6d0
commit 4f98f5bf85
@@ -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]: