@@ -82,10 +82,10 @@ def save_to_excel_with_colors_and_params(collision_table, file_name, ego_params,
82
82
83
83
84
84
def main (args ):
85
- front_vehicle_params = Params (pos = 30 , speed = args . speed if args . use_same_speed else 10 ,
86
- reaction_time = 1.0 , accel = args . acceleration if args . use_same_acceleration else - 3.0 , length = 5 )
87
- rear_vehicle_params = Params (pos = - 30 , speed = args . speed if args . use_same_speed else 10 ,
88
- reaction_time = 1.0 , accel = args . acceleration if args . use_same_acceleration else - 3.0 , length = 5 )
85
+ front_vehicle_params = Params (pos = 30 , speed = 10 ,
86
+ reaction_time = 1.0 , accel = - 3.0 , length = 5 )
87
+ rear_vehicle_params = Params (pos = - 30 , speed = 10 ,
88
+ reaction_time = 1.0 , accel = - 3.0 , length = 5 )
89
89
90
90
speeds = np .arange (1 , 31 ) # 1 m/s to 30 m/s
91
91
accelerations = np .linspace (- 1.0 , - 10 , 19 ) # -1.0 m/s² to -10 m/s²
@@ -95,6 +95,14 @@ def main(args):
95
95
96
96
for speed in speeds :
97
97
for accel in accelerations :
98
+ if args .use_same_speed :
99
+ front_vehicle_params .speed = speed
100
+ rear_vehicle_params .speed = speed
101
+
102
+ if args .use_same_acceleration :
103
+ front_vehicle_params .accel = accel
104
+ rear_vehicle_params .accel = accel
105
+
98
106
ego_params = Params (pos = 0 , speed = speed , reaction_time = 1.5 , accel = accel , length = 5 )
99
107
is_front_collision , is_rear_collision = calculate_collision_with_rss (
100
108
ego_params , front_vehicle_params , rear_vehicle_params )
0 commit comments