mpc local planner 使用了 teb local planner 的部分文件。安装 teb local planner 的 noetic 版本,编译后报错:
/home/lmr/ws/navigation_ws/src/nav/mpc_local_planner/mpc_local_planner/src/mpc_local_planner_ros.cpp:926:124: required from here
/usr/include/boost/smart_ptr/make_shared_object.hpp:256:5: error: no matching function for call to ‘teb_local_planner::LineRobotFootprint::LineRobotFootprint(Eigen::Map<const Eigen::Matrix<double, 2, 1>, 0, Eigen::Stride<0, 0> >, Eigen::Map<const Eigen::Matrix<double, 2, 1>, 0, Eigen::Stride<0, 0> >)’
256 | ::new( pv ) T( boost::detail::sp_forward<Args>( args )... );
再往下翻会看到
这下面的提示才是重点:
458 | LineRobotFootprint(const Eigen::Vector2d& line_start, const Eigen::Vector2d& line_end, const double min_obstacle_dist) : min_obstacle_dist_(min_obstacle_dist)
/home/lmr/ws/navigation_ws/src/nav/teb_local_planner/include/teb_local_planner/robot_footprint_model.h:458:3: note: candidate expects 3 arguments, 2 provided
这里说 teb 中 LineRobotFootprint 函数声明有三个参数,但是 mpc 里的 LineRobotFootprint 函数调用只传递了两个参数。
mpc 中的调用只传递了两个参数
翻看了下 teb 的 LineRobotFootprint 确实是三个参数 !
可以看到注释中也只有两个参数的说明,第三个参数应该是后来更新的,但是 mpc 的 noetic 版本还未同步。
给 mpc 中函数补充上第三个参数即可:
编译成功 !