tf2转换关系建立成功,报错Could not transform base_link to lidar_mid: "base_link" passed to lookupTransform argument target_frame does not exist
-
这样定义的,每次就到catch了
看结果就这样的 -
-
@小鱼 好的鱼哥
std::unique_ptr<tf2_ros::Buffer> base_link_lidar_mid_tf_buffer_;
std::shared_ptr<tf2_ros::TransformListener> base_link_lidar_mid_tf_listener_{nullptr};
bool base_link_lidar_mid_transform_flag = false;
tf2::Stampedtf2::Transform base_link_lidar_mid_transform;
geometry_msgs::msg::TransformStamped tfGeom_lidar_mid;base_link_lidar_mid_tf_buffer_ =
std::make_unique<tf2_ros::Buffer>(this->get_clock());
// Buffer::lookupTransform(const std::string& target_frame, const std::string& source_frame, const ros::Time& time, const ros::Duration timeout)
base_link_lidar_mid_tf_listener_ =
std::make_shared<tf2_ros::TransformListener>(
*base_link_lidar_mid_tf_buffer_);
if (!base_link_lidar_mid_transform_flag)
{
try {
tfGeom_lidar_mid = base_link_lidar_mid_tf_buffer_->lookupTransform(
"base_link", "lidar_mid", tf2::TimePointZero);
base_link_lidar_mid_transform_flag = true;
}
catch (const tf2::TransformException &ex) {
RCLCPP_INFO(this->get_logger(), "Could not transform %s to %s: %s",
"base_link", "lidar_mid", ex.what());
base_link_lidar_mid_transform_flag = false;
}
}
tf2::convert(tfGeom_lidar_mid, base_link_lidar_mid_transform); -
@小鱼 鱼哥 这是终端打印的
[Sensors_Fusion_node-1] [INFO] [1677828330.587144345] [Sensors_Fusion_node]: Could not transform base_link to lidar_mid: "base_link" passed to lookupTransform argument target_frame does not exist.
[Sensors_Fusion_node-1] [INFO] [1677828331.585971687] [Sensors_Fusion_node]: Could not transform base_link to lidar_mid: "base_link" passed to lookupTransform argument target_frame does not exist.
[Sensors_Fusion_node-1] [INFO] [1677828332.586446715] [Sensors_Fusion_node]: Could not transform base_link to lidar_mid: "base_link" passed to lookupTransform argument target_frame does not exist.
[Sensors_Fusion_node-1] [INFO] [1677828333.585558863] [Sensors_Fusion_node]: Could not transform base_link to lidar_mid: "base_link" passed to lookupTransform argument target_frame does not exist.
[Sensors_Fusion_node-1] [INFO] [1677828334.586966889] [Sensors_Fusion_node]: Could not transform base_link to lidar_mid: "base_link" passed to lookupTransform argument target_frame does not exist.
[Sensors_Fusion_node-1] [INFO] [1677828335.586095871] [Sensors_Fusion_node]: Could not transform base_link to lidar_mid: "base_link" passed to lookupTransform argument target_frame does not exist.
[Sensors_Fusion_node-1] [INFO] [1677828336.586538045] [Sensors_Fusion_node]: Could not transform base_link to lidar_mid: "base_link" passed to lookupTransform argument target_frame does not exist.
[Sensors_Fusion_node-1] [INFO] [1677828337.587170264] [Sensors_Fusion_node]: Could not transform base_link to lidar_mid: "base_link" passed to lookupTransform argument target_frame does not exist.
[Sensors_Fusion_node-1] [INFO] [1677828338.587091985] [Sensors_Fusion_node]: Could not transform base_link to lidar_mid: "base_link" passed to lookupTransform argument target_frame does not exist.
[Sensors_Fusion_node-1] [INFO] [1677828339.585534715] [Sensors_Fusion_node]: Could not transform base_link to lidar_mid: "base_link" passed to lookupTransform argument target_frame does not exist.
[Sensors_Fusion_node-1] [INFO] [1677828340.585897984] [Sensors_Fusion_node]: Could not transform base_link to lidar_mid: "base_link" passed to lookupTransform argument target_frame does not exist.通过 ros2 run tf2_tools view_frames.py
[INFO] [1677828306.663303521] [view_frames]: Result:tf2_msgs.srv.FrameGraph_Response(frame_yaml="lidar_mid: \n parent: 'base_link'\n broadcaster: 'default_authority'\n rate: 10000.000\n most_recent_transform: 0.000000\n oldest_transform: 0.000000\n buffer_length: 0.000\nfront_mmwave: \n parent: 'base_link'\n broadcaster: 'default_authority'\n rate: 10000.000\n most_recent_transform: 0.000000\n oldest_transform: 0.000000\n buffer_length: 0.000\nrear_mmwave: \n parent: 'base_link'\n broadcaster: 'default_authority'\n rate: 10000.000\n most_recent_transform: 0.000000\n oldest_transform: 0.000000\n buffer_length: 0.000\n")ros2 run tf2_ros tf2_echo base_link lidar_mid
[INFO] [1677828491.273727584] [tf2_echo]: Waiting for transform base_link -> lidar_mid: Invalid frame ID "base_link" passed to canTransform argument target_frame - frame does not exist
At time 0.0- Translation: [0.067, 7.415, 0.490]
- Rotation: in Quaternion [0.022, -0.020, -0.022, 0.999]
At time 0.0 - Translation: [0.067, 7.415, 0.490]
- Rotation: in Quaternion [0.022, -0.020, -0.022, 0.999]
At time 0.0 - Translation: [0.067, 7.415, 0.490]
- Rotation: in Quaternion [0.022, -0.020, -0.022, 0.999]
与小乌龟的教程都一样 但是就是报这个问题了Could not transform base_link to lidar_mid: "base_link" passed to lookupTransform argument target_frame does not exist;一直进catch