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
565 stars 142 forks source link

Add dynamic reconfigure #18

Closed kosmastsk closed 4 years ago

kosmastsk commented 4 years ago

Add support for dynamic reconfigure of several parameters, as mentioned in #16 Specifically, these parameters are: xy_goal_tolerance, yaw_goal_tolerance, global_plan_overwrite_orientation, global_plan_prune_distance, max_global_plan_lookahead_dist, global_plan_viapoint_sep, is_footprint_dynamic, include_costmap_obstacles, costmap_obstacles_behind_robot_dist, collision_check_min_resolution_angular and collision_check_no_poses.

The implementation is based on the similar one from teb local planner.

Feedback is always welcome!

amakarow commented 4 years ago

Many thanks. I just merged this.

Huyhust13 commented 3 years ago

Dear kosmastsk, Why did you not move more other parameters to dynamic reconfigure, such as max_vel_x, max_vel_x_backward?

kosmastsk commented 3 years ago

@Huyhust13 in my opinion, these kind of parameters usually remain constant for a specific robot. That's why there would be no reason to dynamically change their maximum velocity etc. Once you tune these values, you do not really need to change them dynamically

Huyhust13 commented 3 years ago

@kosmastsk but in some of cases, We need to change robot maximum speed to be safe when robot goes into some certain areas. I'm trying to do this, can you give me advises? Thank you!

kosmastsk commented 3 years ago

@Huyhust13 I can see that these parameters are defined for example in _"mpc_local_planner/mpc_local_planner_examples/cfg/carlike/mpc_local_plannerparams.yaml" . You have to create a .cfg file, containing the parameters you want (max_velx etc) as in "mpc_local_planner/mpc_localplanner/cfg/" directory, make the necessary changes in CMakeLists.txt and create the dynamic reconfigure server in the ROS node that this parameter is used.

Huyhust13 commented 3 years ago

@kosmastsk Yes, I did that, however when I made changes in dynamic reconfigure it didn't work. Because I saw that it was loaded into the configuration at the planner initialization.

kosmastsk commented 3 years ago

@Huyhust13 in the dynamic reconfigure callback function, when you receive the new values you should call the configureOcp function to update these values in the planner. After that, I am not sure if something else should also be called to update the parameter values in the planner

Huyhust13 commented 3 years ago

Thank you @kosmastsk, I'll try that

Huyhust13 commented 3 years ago

@kosmastsk Dear, I did following your advise. But It did not update velocity.

Huyhust13 commented 3 years ago

@kosmastsk It worked fine. Thank you so much!

zjz154 commented 5 months ago

@Huyhust13 Dear, I am facing the same issue in mpc_local_planner, can you share exactly how you solved it? I would appreciate if you can share the relevant code.

roboticlemon commented 3 weeks ago

@Huyhust13 please share code, I am interested in submitting a PR for this

Huyhust13 commented 2 weeks ago

Hi @zjz154 , @roboticlemon sorry because it's so long. I am no longer doing that project. So I don't know where I save that piece of code.