Skip to content

fix issue when steering command become nan#4

Merged
DiuLaMaX merged 2 commits into
mainfrom
linwei/fix-nan-issue
Jun 7, 2026
Merged

fix issue when steering command become nan#4
DiuLaMaX merged 2 commits into
mainfrom
linwei/fix-nan-issue

Conversation

@DiuLaMaX

@DiuLaMaX DiuLaMaX commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@zeerekahmad zeerekahmad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, but we need to clean up this pattern

Comment thread src/articulated_model.cpp Outdated
// the wheelbase allows pushes it past +/-1; without clamping acos returns NaN, which then
// propagates into the articulation angle and every wheel-velocity command. Clamp so an
// over-tight command saturates to the sharpest representable turn (the controller further
// clamps the resulting steering command to the steering limits).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add the description to the derivation markdown file on why we're doing this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved

Comment thread src/articulated_model.cpp Outdated

// copysign selects + for forward, - for reverse.
double acos_calculation = std::acos(
// The acos argument is in [-1, 1] only when omega^2 * (Lr^2 - Lf^2) <= v^2, i.e. when the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very good edge case, and supports the argument that the kinematic lib should be able to tell us the limits.

For now we can remove NaNs, but let's get a design in place that the user can query the vehicle limits based on what is sent. And then we can check against that.

This hack can obfuscate the issue

@DiuLaMaX DiuLaMaX merged commit 79399f9 into main Jun 7, 2026
3 of 4 checks passed
@DiuLaMaX DiuLaMaX deleted the linwei/fix-nan-issue branch June 7, 2026 19:04
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.

2 participants