Skip to content

Commit

Permalink
🎈 perf: Improve TF lookup error handling
Browse files Browse the repository at this point in the history
Avoid throwing an error and shutdown immediately.
  • Loading branch information
LihanChen2004 committed Dec 24, 2024
1 parent 82ae1e8 commit 2fbf1d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions loam_interface/src/loam_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ void LoamInterfaceNode::odometryCallback(const nav_msgs::msg::Odometry::ConstSha
tf_odom_to_lidar_odom_ = tf_base_frame_to_lidar;
base_frame_to_lidar_initialized_ = true;
} catch (tf2::TransformException & ex) {
RCLCPP_WARN(this->get_logger(), "TF lookup failed: %s", ex.what());
throw;
RCLCPP_WARN(this->get_logger(), "TF lookup failed: %s Retrying...", ex.what());
return;
}
}

Expand Down
4 changes: 2 additions & 2 deletions sensor_scan_generation/src/sensor_scan_generation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ tf2::Transform SensorScanGenerationNode::getTransform(
tf2::fromMsg(transform_stamped.transform, transform);
return transform;
} catch (tf2::TransformException & ex) {
RCLCPP_WARN(this->get_logger(), "TF lookup failed: %s", ex.what());
throw;
RCLCPP_WARN(this->get_logger(), "TF lookup failed: %s. Returning identity.", ex.what());
return tf2::Transform::getIdentity();
}
}

Expand Down

0 comments on commit 2fbf1d7

Please sign in to comment.