Ask Your Question
0

no matching function for call to ‘tf::TransformListener::lookupTransform(const char [13], const char [5], ros::Time, tf::Transform&)’ listener.lookupTransform("/ar_marker_1", "/map", ros::Time(0), transform) [closed]

asked 2018-02-21 03:42:13 -0500

simff gravatar image

updated 2018-02-21 03:59:22 -0500

Code

#include <std_msgs/String.h>
#include <string>
#include <iostream>
#include <ros/ros.h>
#include <ar_track_alvar_msgs/AlvarMarkers.h>
#include <ar_track_alvar_msgs/AlvarMarker.h>
#include <tf/transform_broadcaster.h>
#include <tf/transform_listener.h>
#include <tf/transform_datatypes.h>
#include <tf/time_cache.h>
#include <geometry_msgs/PoseWithCovarianceStamped.h>
#include <nav_msgs/Odometry.h>
#include <std_msgs/Int32.h>
#include <math.h>


class Dynamic_tf
{
public:
  ros::NodeHandle nh_;
  ros::NodeHandle globalNode;
  tf::TransformListener listener;
  tf::Transform transform;

  int i = 1;
  std::string mMapFrame;
  std::string mRobotFrame;

  void robot_callback();

  Dynamic_tf()
  {
    globalNode.param("map_frame", mMapFrame, std::string("map"));
    globalNode.param("robot_frame", mRobotFrame, std::string("base_link"));
  };
};

void Dynamic_tf::robot_callback()
{
   if(i==1){
    try{
      listener.waitForTransform("/ar_marker_1", "/map", ros::Time(0), ros::Duration(10.0));
      listener.lookupTransform("/ar_marker_1", "/map", ros::Time(0), transform);
    }

    catch (tf::TransformException &ex) {
      ROS_ERROR("%s",ex.what());
      ros::Duration(1.0).sleep();
    }

    tf::Stamped<tf::Pose> now (transform,ros::Time::now(),mMapFrame);
    prev = now;
    i++; //read only one
   }
}

int main(int argc, char **argv)
{
  ros::init(argc, argv, "dynamic_tf");

  Dynamic_tf dynamic;
  int desidered_freq = 15.0;

  ros::Rate r(desidered_freq);

  while (ros::ok())
  {
    dynamic.robot_callback();
    ros::spinOnce();
    r.sleep();
  } 
  return 0;
}

Error

In member function ‘void Dynamic_tf::robot_callback()’: /home/simoneforno/simon_ws/src/tf_config/src/tf_husky_dynamic.cpp:72:79: error: no matching function for call to ‘tf::TransformListener::lookupTransform(const char [13], const char [5], ros::Time, tf::Transform&)’ listener.lookupTransform("/ar_marker_1", "/map", ros::Time(0), transform);

Question

Why do I get this error? I am newby to C++, sorry for the quite easy question.

Thanks for the one helping me out!

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by NEngelhard
close date 2018-02-21 04:25:45.566111

1 Answer

Sort by » oldest newest most voted
0

answered 2018-02-21 03:59:39 -0500

simff gravatar image

Solved

My oversight, the method lookupTranform want a tf::StampedTransform as argument, and not simply a tf::Transform :)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-02-21 03:42:13 -0500

Seen: 560 times

Last updated: Feb 21 '18