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

Revision history [back]

waitForTransform has a boolean return type that indicates success or failure. If it returns false, you reached your timeout period, and something is likely not right about your transforms. Do something like this:

if(tf_l.waitForTransform("map", "base_link", _s.header.stamp, ros::Duration(1.0)))
{
  try
  {
      tf_l.transformPoint("map", _s, our_s);
  }
  catch(tf::TransformException& ex)
  {
      ROS_INFO("%s is the exception.", ex.what());
  }
}
else
{
  ROS_INFO("No transform available!");
}

waitForTransform has a boolean return type that indicates success or failure. If it returns false, you reached your timeout period, and something is likely not right about your transforms. Do something like this:

if(tf_l.waitForTransform("map", "base_link", _s.header.stamp, ros::Duration(1.0)))
{
  try
  {
      tf_l.transformPoint("map", _s, our_s);
  }
  catch(tf::TransformException& ex)
  {
      ROS_INFO("%s is the exception.", ex.what());
  }
}
else
{
  ROS_INFO("No transform available!");
}

The way you have it written, it's going to attempt the transform whether waitForTransform succeeds or not.

waitForTransform has a boolean return type that indicates success or failure. If it returns false, you reached your timeout period, and something is likely not right about your transforms. Do something like this:

if(tf_l.waitForTransform("map", "base_link", _s.header.stamp, ros::Duration(1.0)))
{
  try
  {
      tf_l.transformPoint("map", _s, our_s);
  }
  catch(tf::TransformException& ex)
  {
      ROS_INFO("%s is the exception.", ex.what());
  }
}
else
{
  ROS_INFO("No transform available!");
}

The way you have it written, it's going to attempt the transform whether waitForTransform waitForTransform succeeds or not.

waitForTransform has a boolean return type that indicates success or failure. If it returns false, you reached your timeout period, and something is likely not right about your transforms. Do something like this:

if(tf_l.waitForTransform("map", "base_link", _s.header.stamp, ros::Duration(1.0)))
{
  try
  {
      tf_l.transformPoint("map", _s, our_s);
  }
  catch(tf::TransformException& ex)
  {
      ROS_INFO("%s is the exception.", ex.what());
  }
}
else
{
  ROS_INFO("No transform available!");
}

The way you have it written, it's going to attempt the transform whether waitForTransform succeeds or not.

EDIT: Also, what is producing the map to base_link transform? Is it on the same machine? What time stamp value is being used for the transform when it gets broadcast?