cannot convert ‘tf2_ros::TransformListener*’ to ‘tf2_ros::Buffer*’
I am trying to upgrade some existing code that use tf with kinetic to use instead tf2 with noetic.
In the following line of code, planner_
is of type base_local_planner::TrajectoryPlannerROS and the code wants to call its initialize function.
planner_.initialize("TrajectoryPlannerROS", &tf_, &costmap_ros_);
The function signature for "initialize" is:
void base_local_planner::TrajectoryPlannerROS::initialize (
std::string name,
tf2_ros::Buffer * tf,
costmap_2d::Costmap2DROS * costmap_ros
}
and the documentation says that tf
is "a pointer to a transform listener", despite its type being tf2_ros::Buffer.
In the line of code above, tf_
is of type tf2_ros::TransformListener, which seems to match the documentation. However, the compiler throws an error that:
error: cannot convert ‘tf2_ros::TransformListener’ to ‘tf2_ros::Buffer’
I am very confused. How should one pass in a tf2_ros::TransformListener as a parameter of type tf2_ros::Buffer? The documentation is very confusing.