Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6257df9

Browse files
committedMay 28, 2024·
solve bug same speeds
Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>
1 parent 74b5baf commit 6257df9

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed
 

‎collision_table.xlsx

18 Bytes
Binary file not shown.

‎rss_collision_calculator.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ def save_to_excel_with_colors_and_params(collision_table, file_name, ego_params,
8282

8383

8484
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)
8989

9090
speeds = np.arange(1, 31) # 1 m/s to 30 m/s
9191
accelerations = np.linspace(-1.0, -10, 19) # -1.0 m/s² to -10 m/s²
@@ -95,6 +95,14 @@ def main(args):
9595

9696
for speed in speeds:
9797
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+
98106
ego_params = Params(pos=0, speed=speed, reaction_time=1.5, accel=accel, length=5)
99107
is_front_collision, is_rear_collision = calculate_collision_with_rss(
100108
ego_params, front_vehicle_params, rear_vehicle_params)

0 commit comments

Comments
 (0)
Please sign in to comment.