Controller::mpc_based_max_vel()
and Controller::update()
interaction should be refactored
#125
Labels
refactor
Refactor request
Controller::mpc_based_max_vel()
repeatedly callsController::update()
but rolls back some of its side effects. This is a very convoluted and error-prone setup.update()
sets the following member variables:current_with_carrot_
current_pos_on_plan_
current_goal_
distance_to_goal_
byfindPositionOnPlan()
- seeController::findPositionOnPlan()
should be refactored #123controller_state_
current_target_x_vel_
Before
mpc_based_max_vel()
callsupdate()
it creates a backup ofcontroller_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:
mpc_based_max_vel()
should be a const function that does not modify any state. Based on the name and function documentation, this should be possible.update()
should be refactored/split in such a way that at the very least no side effects need to be rolled back inmpc_based_max_vel()
.The text was updated successfully, but these errors were encountered: