Skip to content

Commit

Permalink
changed speed and time calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
VincidaB committed May 9, 2024
1 parent 8c2a546 commit a71b9ee
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/matchs/src/sequenceur_match1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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())
Expand Down

0 comments on commit a71b9ee

Please sign in to comment.