Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix division by zero in lateral_planner.py #20071

Merged
merged 2 commits into from
Feb 16, 2021
Merged

Fix division by zero in lateral_planner.py #20071

merged 2 commits into from
Feb 16, 2021

Conversation

briskspirit
Copy link
Contributor

lateral_planner.py:191: RuntimeWarning: invalid value encountered in double_scalars

When v_ego = 0 and OP activated we are getting division by 0 which sets value to nan, so param angleSteers becomes set to nan and could potentially break other code.

How to reproduce: TSS2 Corolla, shift D, enable brake hold, enable ACC, enable OpenPilot. tmux will throw an error and ZMQ will publish lateralPlan with param angleSteers: nan while car is not moving.

@briskspirit briskspirit marked this pull request as ready for review February 13, 2021 03:04
@briskspirit
Copy link
Contributor Author

briskspirit commented Feb 13, 2021

Or != 0 would be better? Sometimes we are getting negative v_ego (When car is stopping)

@haraschax
Copy link
Contributor

Hmmm, I don't really like that logic. Since if v_ego is super small it can potentially output weird things.

I think the best is to replace v_ego with max(v_ego, 1e-1). Can you do that?

@briskspirit
Copy link
Contributor Author

Done

@briskspirit
Copy link
Contributor Author

Think I need to add a new reference

@pd0wm pd0wm merged commit 8f9ee10 into commaai:master Feb 16, 2021
@briskspirit briskspirit deleted the fix_lateral_planner branch February 16, 2021 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants