@@ -22,11 +22,6 @@ def __init__(self, vehicle_interface : GEMHardwareInterface):
2222 self .prev_time = time .time ()
2323 self .curr_time = time .time ()
2424
25- # while True :
26- # self.curr_time = time.time()
27- # if (self.curr_time - self.prev_time > 2):
28- # self.update()
29- # self.prev_time = self.curr_time
3025
3126 def rate (self ):
3227 """Requested update frequency, in Hz"""
@@ -59,30 +54,28 @@ def update(self, *args):
5954 # self.vehicle_interface.send_command(command)
6055 self .curr_time = time .time ()
6156
62- print ("====================" )
63- print (args )
64- print ("====================" )
57+ intent = args [0 ]
6558
66-
67- if (self .curr_time - self .prev_time > 2 ):
68- if command .left_turn_signal is True :
69- # print("code goes if")
70- command .left_turn_signal = False
71- command .right_turn_signal = True
72-
73- elif command .right_turn_signal is True :
74- # print("code goes elif")
75- command .left_turn_signal = False
76- command .right_turn_signal = False
59+ if (intent == 2 ):
60+ if (self .curr_time - self .prev_time > 2 ):
61+ if command .left_turn_signal is True :
62+ # print("code goes if")
63+ command .left_turn_signal = False
64+ command .right_turn_signal = True
65+
66+ elif command .right_turn_signal is True :
67+ # print("code goes elif")
68+ command .left_turn_signal = False
69+ command .right_turn_signal = False
70+
71+ else :
72+ # print("code goes else")
73+ command .left_turn_signal = True
74+ command .right_turn_signal = False
7775
78- else :
79- # print("code goes else")
80- command .left_turn_signal = True
81- command .right_turn_signal = False
76+ self .prev_time = self .curr_time
77+ self .command = command
8278
83- self .prev_time = self .curr_time
84- self .command = command
85-
8679 self .vehicle_interface .send_command (command )
8780 # print(command.left_turn_signal, command.right_turn_signal)
8881
0 commit comments