Skip to content

Commit 1469342

Browse files
committed
Handle negative path curvature for feedforward acceleration calculations
1 parent 3213be2 commit 1469342

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/npfg/npfg.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,8 @@ float NPFG::lateralAccelFF(const Vector2f &unit_path_tangent, const Vector2f &gr
456456

457457
// path frame curvature is the instantaneous curvature at our current distance
458458
// from the actual path (considering e.g. concentric circles emanating outward/inward)
459-
const float path_frame_curvature = path_curvature / math::max(1.0f - path_curvature * signed_track_error,
460-
path_curvature * MIN_RADIUS);
459+
float path_frame_curvature = path_curvature / math::max(1.0f - path_curvature * signed_track_error,
460+
fabsf(path_curvature) * MIN_RADIUS);
461461

462462
// limit tangent ground speed to along track (forward moving) direction
463463
const float tangent_ground_speed = math::max(ground_vel.dot(unit_path_tangent), 0.0f);

0 commit comments

Comments
 (0)