ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
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!");
}
2 | No.2 Revision |
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.
3 | No.3 Revision |
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.
4 | No.4 Revision |
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?