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

cost function #25

Open hhxzzy opened 3 years ago

hhxzzy commented 3 years ago

Hello, I am new to this and I got a little confused when I try to find the cost funtion of the MPC process. I want to alter the cost function like adding some term to it. And I wonder if there an explicit way of setting the cost function. Thank you so much!

soldierofhell commented 3 years ago

See the available options starting here: https://github.com/rst-tu-dortmund/mpc_local_planner/blob/9700f11f70db691a22eb76ec1b31cf0091f925d2/mpc_local_planner/src/controller.cpp#L555

hhxzzy commented 3 years ago

Thanks for replying! A few more questions:

  1. It seems that the codes from line 555 to line 641 ask me to set the objective type for the optimal control problem. But I am not very clear the meanings of the options. Is the option "minimum_time" sets the cost function whose solution uses the least time? And what do "quadratic_form" and "minimum_time_via_points" mean?
  2. This segment of codes set some parameters like the weights in the matrixes. Is this all I can do to alter the cost function? Can I alter the cost function more flexibly? Thanks again for your reply!
soldierofhell commented 3 years ago

See the cost implementations in https://github.com/rst-tu-dortmund/mpc_local_planner/tree/master/mpc_local_planner/include/mpc_local_planner/optimal_control They subclass corbo::StageCost mostly by implementing computeXXXTerm() cost terms

MuXingchui commented 2 years ago

See the cost implementations in https://github.com/rst-tu-dortmund/mpc_local_planner/tree/master/mpc_local_planner/include/mpc_local_planner/optimal_control They subclass corbo::StageCost mostly by implementing computeXXXTerm() cost terms

Hello, I am also a new to this and I got a little confused when I try to find the cost funtion of the MPC process. Where can I see the definition of the cost function? I want to know how MPC plans the trajectory to avoid obstacles if there are unknown obstacles on the path. In other words, I want to know in which file can I see the definition of the obstacle avoidance function?