File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
srunner/scenariomanager/actorcontrols Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -92,19 +92,25 @@ def run_step(self):
9292
9393 self ._actor .set_target_velocity (linear_velocity )
9494
95-
95+ reached_end = True
9696 for i in range (len (self ._waypoints )):
9797 target_transform = self ._waypoints [i ]
9898 target_time = self ._times [i ]
9999 if current_transform .location .distance (target_transform .location ) > self ._distance_threshold :
100+ reached_end = False
100101 break
101102
102- delta_time = target_time + self ._start_time - current_time
103- delta_yaw = math .degrees (math .atan2 (target_vec .y , target_vec .x )) - current_transform .rotation .yaw
104- delta_yaw = delta_yaw % 360
105- if delta_yaw > 180 :
106- delta_yaw = delta_yaw - 360
107- angular_speed = delta_yaw / min (delta_time , self ._max_yaw_time )
103+ if not reached_end :
104+ delta_time = target_time + self ._start_time - current_time
105+ target_vec = target_transform .location - current_transform .location
106+ delta_yaw = math .degrees (math .atan2 (target_vec .y , target_vec .x )) - current_transform .rotation .yaw
107+ delta_yaw = delta_yaw % 360
108+ if delta_yaw > 180 :
109+ delta_yaw = delta_yaw - 360
110+ angular_speed = delta_yaw / min (delta_time , self ._max_yaw_time )
111+ else :
112+ angular_speed = 0
113+
108114 angular_velocity = carla .Vector3D (0 , 0 , angular_speed )
109115
110116 self ._actor .set_target_angular_velocity (angular_velocity )
You can’t perform that action at this time.
0 commit comments