nobleo / path_tracking_pid

Path Tracking PID offers a tuneable PID control loop, decouling steering and forward velocity
Apache License 2.0
130 stars 37 forks source link

Replaced helper function sign(). #61

Closed lewie-donckers closed 2 years ago

lewie-donckers commented 2 years ago

Replaced helper function sign().

I saw three (minor) problems with it:

So I replaced it with a function that does exactly that with a descriptive name and an intuitive return type/value.

lewie-donckers commented 2 years ago

I wouldn't just remove the old sign function. There are a lot of places where it could be used.

If you grep for sign you see a lot of these constructions

copysign(1.0, somevalue)

Which could be replaced by

sign(somevalue)

While I think refactoring those copysign() calls is a great idea, I don't think we should keep the function because we might need it in the future.

We know it existed (we can refer to it in an issue to request the refactor) so we can retrieve it when we want to use it again. But for now, it is dead code.