I think Controller::distToSegmentSquared() should be refactored in several ways:
Its name suggests it calculates a distance but the main purpose is to determine a pose: the closest pose on segment. I propose we change the name to reflect this.
Beside the pose, it also returns distances but these can easily be calculated by the caller (if required). I propose we remove those distances from the output.
It's currently a const member function but it only uses the data member estimate_pose_angle_enabled_. I propose we replace that with an input parameter.
If the previous point has been done, the function can be extracted (to calculations.h/cpp for example) and unit tests can be added.
To do this, distSquared() from the anonymous namespace in controller.cpp would have to be moved too. I propose we do this and add unit tests for that as well.
I think
Controller::distToSegmentSquared()
should be refactored in several ways:estimate_pose_angle_enabled_
. I propose we replace that with an input parameter.calculations.h/cpp
for example) and unit tests can be added.distSquared()
from the anonymous namespace incontroller.cpp
would have to be moved too. I propose we do this and add unit tests for that as well.