ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Adding this line solved the problem:

listener.waitForTransform("base_link", "odom", ros::Time(0),
            ros::Duration(3.0));

so the final code is:

try {

    listener.waitForTransform("base_link", "odom", ros::Time(0),
            ros::Duration(3.0));
    listener.lookupTransform("/base_link", "/odom", ros::Time(0),
            transform);
} catch (tf::TransformException ex) {
    ROS_ERROR("%s", ex.what());
}