How do latch transforms work?
I am getting this error after publishing latch transforms for camera-link to base-link. The code is at the end of the errors...
[ERROR] [1380316527.758532146, 2.527000000]: Error getting latest time from frame 'camera_link' to frame 'base_link': Could not find a connection between 'base_link' and 'NO_PARENT' because they are not part of the same tree.Tf has two or more unconnected trees. (Error code: 2)
[ERROR] [1380316527.758625055, 2.527000000]: Error getting latest time from frame 'hokuyo_frame' to frame 'base_link': Could not find a connection between 'base_link' and 'NO_PARENT' because they are not part of the same tree.Tf has two or more unconnected trees. (Error code: 2)
[ERROR] [1380316527.767405664, 2.528000000]: Error getting latest time from frame 'camera_frame' to frame 'base_link': Could not find a connection between 'base_link' and 'NO_PARENT' because they are not part of the same tree.Tf has two or more unconnected trees. (Error code: 2)
[ERROR] [1380316527.767563302, 2.528000000]: Error getting latest time from frame 'camera_link' to frame 'base_link': Could not find a connection between 'base_link' and 'NO_PARENT' because they are not part of the same tree.Tf has two or more unconnected trees. (Error code: 2)
[ERROR] [1380316527.767687690, 2.528000000]: Error getting latest time from frame 'hokuyo_frame' to frame 'base_link': Could not find a connection between 'base_link' and 'NO_PARENT' because they are not part of the same tree.Tf has two or more unconnected trees. (Error code: 2)
My code is as follows:
tf2_ros::StaticTransformBroadcaster static_broadcaster;
geometry_msgs::TransformStamped msg;
msg.header.stamp = ros::Time::now();
msg.transform.rotation.x = 0.0;
msg.transform.rotation.y = 0.0;
msg.transform.rotation.z = 0.0;
msg.transform.rotation.w = 1.0;
msg.header.frame_id = "base_link";
msg.transform.translation.x = 0;
msg.transform.translation.y = 0;
msg.transform.translation.z = 0.1;
msg.child_frame_id = "camera_link";
static_broadcaster.sendTransform(msg);
msg.header.frame_id = "camera_link";
msg.transform.translation.x = 0;
msg.transform.translation.y = 0;
msg.transform.translation.z = 0.2;
msg.child_frame_id = "hokuyo_frame";
static_broadcaster.sendTransform(msg);
msg.header.frame_id = "camera_link";
msg.transform.translation.x = 0;
msg.transform.translation.y = 0;
msg.transform.translation.z = 0.3;
msg.child_frame_id = "camera_frame";
static_broadcaster.sendTransform(msg);
Did you try broadcasting these frames from a launch file?