将静态变换关系改成固定的矩阵需要在代码中手动定义一个矩阵,并将其转换为'geometry_msgs::TransformStamped'消息格式,然后发布出去。修改后的代码如下:

// 定义一个固定的变换矩阵 Eigen::Matrix4f imu_T_velo_fixed; imu_T_velo_fixed << 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 2.0, 0.0, 1.0, 0.0, 3.0, 0.0, 0.0, 0.0, 1.0;

// 将矩阵转换为'geometry_msgs::TransformStamped'消息格式 geometry_msgs::TransformStamped imu_stamped_tf_velo_fixed; imu_stamped_tf_velo_fixed.header.stamp = ros::Time::now(); imu_stamped_tf_velo_fixed.header.frame_id = "imu"; imu_stamped_tf_velo_fixed.child_frame_id = "velo"; imu_stamped_tf_velo_fixed.transform = tf2::eigenToTransform(imu_T_velo_fixed.cast());

// 发布固定的变换关系 static_broadcaster.sendTransform(imu_stamped_tf_velo_fixed);

ROS中将IMU到Velodyne的静态变换关系改为固定矩阵

原文地址: https://www.cveoy.top/t/topic/n5QS 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录