0
$\begingroup$

Rosanswers logo

Hello everyone, I'm trying to write some c++ code that uses the Costmap2DROS class, but I have this error at compile time:

error: no matching function for call to ‘costmap_2d::Costmap2DROS::Costmap2DROS(std::__cxx11::string&, tf2_ros::Buffer&)

/opt/ros/kinetic/include/costmap_2d/costmap_2d_ros.h:80:3: note: candidate: costmap_2d::Costmap2DROS::Costmap2DROS(std::__cxx11::string, tf::TransformListener&)
   Costmap2DROS(std::string name, tf::TransformListener& tf);

The line that gives the problem is this one:

costmap = new costmap_2d::Costmap2DROS("global_planner", tfl);

where tfl is a tf2::Buffer& object.

I have seen from these reference pages
http://docs.ros.org/jade/api/costmap_2d/html/classcostmap__2d_1_1Costmap2DROS.html

http://docs.ros.org/melodic/api/costmap_2d/html/classcostmap__2d_1_1Costmap2DROS.html that depending on the ROS version you have different constructors for the class. The problem is that I am working on ROS Kinetic, that according to the ROS wiki, uses the melodic version, so why my compiler is using the jade one? How can I solve this?

Thank you in advance to anyone who can help


Originally posted by SteBisi on ROS Answers with karma: 3 on 2018-09-14

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

According to the docs, in ROS kinetic the constructor for the Costmap is the following

Costmap2DROS (std::string name, tf::TransformListener &tf)

From your error message your ros distro is kinetic, not jade or melodic, so you should go with this one (which in this particular case it's equal to the jade one).


Originally posted by alsora with karma: 1322 on 2018-09-14

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by SteBisi on 2018-09-15:
Thank you. My bad, I misread the references

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.