nobleo / path_tracking_pid

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

Simplified the calculation of goal direction. #108

Closed lewie-donckers closed 2 years ago

lewie-donckers commented 2 years ago

Simplified the calculation of the direction of the goal in Controller::update(). Fix for #82 .

lewie-donckers commented 2 years ago

@Rayman @rokusottervanger @Timple I need some help. I noticed that I introduced a change in behavior which can be seen when running the visualization of the tests. I tracked it down to this commit.

In certain tests, you can see that the robot takes longer to stop and turns a bit more at the end of the test.

Example before change: image

Example after change: image

Any idea what's going on and how to fix it?

rokusottervanger commented 2 years ago

I'm not sure. But could you maybe refactor this first, so that this calculation is isolated as a separate function. Then a unit test can show if/how the behavior changes.

lewie-donckers commented 2 years ago

@Timple @rokusottervanger @Rayman

I have reworked this PR. I fixed the new implementation with the help of @rokusottervanger . The calculation is now moved to a separate function and I've added some unit tests.

I tested this by running a build with both the old and new calculation in tandem. It logged if they were not the same. None of the automated tests showed any differences.