From a71b9ee970451afebf64cb778cd5985dc5867bcc Mon Sep 17 00:00:00 2001 From: Vincent Belpois Date: Thu, 9 May 2024 10:58:54 +0200 Subject: [PATCH] changed speed and time calculation --- src/matchs/src/sequenceur_match1.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/matchs/src/sequenceur_match1.py b/src/matchs/src/sequenceur_match1.py index 3c5c883..0b0e31f 100644 --- a/src/matchs/src/sequenceur_match1.py +++ b/src/matchs/src/sequenceur_match1.py @@ -18,13 +18,15 @@ def __init__(self): self.tirette = False self.detected_object = False self.cmd_vel = Twist() - self.cmd_vel.linear.x = 0.2 - #self.cmd_vel.linear.y = 0.2 + self.cmd_vel.linear.x = 0.3 + self.cmd_vel.linear.y = 0.3 self.cmd_vel.angular.z = 0.0 self.start_time = 0 self.cumulated_time = 0 self.start_moving = False self.time_since_detection = 0 + self.movement_time = 11.2 + def tirette_callback(self, msg): self.tirette = msg.data @@ -41,12 +43,14 @@ def timer_callback(self): self.start_time = time.time() self.start_moving = True self.cumulated_time = time.time() - self.start_time - if self.cumulated_time < 6 and self.time_since_detection > 0.5: + if self.cumulated_time < 100 and self.time_since_detection > 0.5 and self.movement_time > 0: self.publisher_cmd_vel.publish(self.cmd_vel) + self.movement_time = self.movement_time - 0.1 else: self.publisher_cmd_vel.publish(Twist()) else: self.cumulated_time = 0 + self.movement_time = 11.2 self.start_moving = False if self.time_since_detection<0.5 and self.start_moving: self.publisher_cmd_vel.publish(Twist())