rst-tu-dortmund / mpc_local_planner

The mpc_local_planner package implements a plugin to the base_local_planner of the 2D navigation stack. It provides a generic and versatile model predictive control implementation with minimum-time and quadratic-form receding-horizon configurations.
http://wiki.ros.org/mpc_local_planner
GNU General Public License v3.0
566 stars 142 forks source link

Prevent reconfigure from overwriting parameters at the initialization #24

Closed matijazigic closed 3 years ago

matijazigic commented 3 years ago

During my testing, I run into one bug regarding reconfigure parameters loading. During initialization parameters from launch files and .yamls will be overwritten with the default ones from the .cfg file. To prevent this to be happening, params from .yamls and ones from .cfg files should have the same names. Now, they don't have the same names due to missing prefixes - controller, footprint_model and 'collision' inside .cfg files, so parameters from .yaml files are overwritten inside reconfigure callback.

Config file cheks is there parameter with the same name, if there is, the default value from params server will be used, and not the one specified from the user inside cfg file. See: https://answers.ros.org/question/28327/dynamic-reconfigure-default-parameters/?answer=28332#post-id-28332

amakarow commented 3 years ago

Many thanks for pointing this out and for providing a fix.

roboticlemon commented 3 weeks ago

One problem now is the dynamic reconfigure namespace is in a different namespace to the rosparam server, only for collision avoidance. This can be seen here: https://github.com/rst-tu-dortmund/mpc_local_planner/blob/5b4e465fec718245484e8668e6dd45539ca37983/mpc_local_planner/src/mpc_local_planner_ros.cpp#L196

The fix is to modify collision to collision_avoidance like this: ros::NodeHandle collision_nh(nh, "collision_avoidance");

You can see an example where the collision_avoidance namespace is correctly used in other code: https://github.com/rst-tu-dortmund/mpc_local_planner/blob/5b4e465fec718245484e8668e6dd45539ca37983/mpc_local_planner/src/mpc_local_planner_ros.cpp#L117