Open ysli16 opened 1 month ago
@ysli16 could you please
eval
or metrics
and remove the evaluate_
prefix in the file names (makes import lines less redundant and cleaner)Other suggestions from looking at the code:
iterate with dt
acc_time = []
for idx in range(len(commands.timestamps)):
acc_time.append(commands.values[idx].acc)
can be a single line acc_time = [v.acc for v in commands.values]
for idx in range(0, len(states.values)):
state = states.values[idx]
timestep = states.timestamps[idx]
reached = desired_lane_reached(lanelet_network, goal_lane, state, pos_tol, heading_tol)
if reached:
reached_time = timestep
break
return float(reached_time)
can be
for idx, state in enumerate(states.values):
reached = desired_lane_reached(lanelet_network, goal_lane, state, pos_tol, heading_tol)
if reached:
reached_time = states.timestamps[idx]
break
return float(reached_time)
ps: Here I don't really like the -1 as return if it is not reached, very bug prone
Attention: Patch coverage is 84.37500%
with 40 lines
in your changes missing coverage. Please review.
Project coverage is 80.22%. Comparing base (
c217817
) to head (330ec2c
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@ysli16 see the above comment as review
Add common functions to evaluate the performance of ego vehicle in the simulation. For safety, the functions to find the minimum distance, minimum time-to-collision(ttc) and maximum deceleration-rate-to-avoid-collision(drac) are implemented. The vehicle geometry is considered in the computation. For efficiency, the function to find the first time that the ego vehicle entered its desired lane is implemented. It only checks whether the vehicle enters the goal lane(or its predecessor/successor), regardless of the progress on the lane. For comfort, the max jerk and the rms of frequency-weighted acceleration(according to ISO2631) is computed.
This will be merged after tested locally for the pdm4ar exercise.