Hello all,
In foxy tf2_ros::Buffer::lookupTransform(),
geometry_msgs::msg::TransformStamped
tf2_ros::Buffer::lookupTransform(const std::string& target_frame,
const std::string& source_frame,
const tf2::TimePoint& time,
const tf2::Duration timeout ) const
@param time: The time at which the value of the transform is desired. (0 will get the latest)
We can use tf2::TimePoint(std::chrono::nanoseconds(0))
to get the latest transform. In foxy tf2 namespace
using tf2::Duration = typedef std::chrono::nanoseconds
using tf2::TimePoint = typedef std::chrono::time_point<std::chrono::system_clock, Duration>
tf2::TimePoint
use system_clock. Although we can use tf2::TimePoint fromRclcpp(const rclcpp::Time & time) to convert a rclcpp::Time into tf2::TimePoint, rclcpp::Time may be use a ROS time, such as RCL_ROS_TIME
time source
inline tf2::TimePoint fromRclcpp(const rclcpp::Time & time)
{
// tf2::TimePoint is a typedef to a system time point, but rclcpp::Time may be ROS time.
// Ignore that, and assume the clock used from rclcpp time points is consistent.
return tf2::TimePoint(std::chrono::nanoseconds(time.nanoseconds()));
}
My question is:
1: Could we directly use rclcpp::Time lookupTransform() version to get latest transform, no need to convert into tf2::TimePoint ?
2: AutowareArchitectureProposal: Replacing tf2_ros::Buffer says there is some bug in tf2_ros::Buffter, is it true ?
Thanks for your help and time!
Originally posted by jxl on ROS Answers with karma: 252 on 2022-03-25
Post score: 1