Skip to content

Commit

Permalink
Use only RPM delta for replay exit detection to avoid false positive …
Browse files Browse the repository at this point in the history
…caused by crashes
  • Loading branch information
Nathaniel-Wu committed Feb 4, 2023
1 parent afbcd61 commit 2c07c73
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gt7communication.py
Expand Up @@ -211,7 +211,7 @@ def check_for_replay_end(self, data_history):
time_delta = data_history[index].recvtime - data_history[index + 1].recvtime
abs_rpm_delta = abs(data_history[index].rpm - data_history[index + 1].rpm)
abs_speed_delta = abs(data_history[index].car_speed - data_history[index + 1].car_speed)
if time_delta <= 1.0 / 30 and (abs_rpm_delta > data_history[index + 1].rpm_rev_limiter * 0.1 or abs_speed_delta > data_history[index + 1].estimated_top_speed * 0.1):
if time_delta <= 1.0 / 30 and (abs_rpm_delta > data_history[index + 1].rpm_rev_limiter * 0.1):
log.info('Replay exit detected: time delta: %.4f s; rpm delta: %.2f (%.2f%%); speed delta: %.2f kph(%.2f%%)', time_delta, abs_rpm_delta, abs_rpm_delta * 100 / data_history[index + 1].rpm_rev_limiter, abs_speed_delta, abs_speed_delta * 100 / data_history[index + 1].estimated_top_speed)
for index_ in range (index + 1, len(data_history)):
data_history.pop()
Expand Down

0 comments on commit 2c07c73

Please sign in to comment.