nobleo / path_tracking_pid

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

`Controller::mpc_based_max_vel()` and `Controller::update()` interaction should be refactored #125

Open lewie-donckers opened 2 years ago

lewie-donckers commented 2 years ago

Controller::mpc_based_max_vel() repeatedly calls Controller::update() but rolls back some of its side effects. This is a very convoluted and error-prone setup.

update() sets the following member variables:

Before mpc_based_max_vel() calls update() it creates a backup of controller_state_ and at certain points in its body (and just before the end) it overwrites the current state with this backup.

I propose the following:

cesar-lopez-mar commented 2 years ago

After our discussion indeed this can be changed by better making a copy of the state and running the simulation (calls to update included) using that copy. Currently we use the member variable in update so that part needs refactor