@yu 在 ROS2 foxy cartographer纯激光建图报错 中说:
@小鱼 我在节点启动的文件里面,用pointcloud_to_laserscan转了一下,但是我用ros2 topic echo看了一下输出话题的内容,发现里面没有数据,输入话题数据是正常的,不知道是由什么其他问题,pointcloud_to_laserscan的配置文件是:
pointcloud_to_laserscan_node:
ros__parameters:
target_frame: 'odom' # 设置为点云数据的 frame_id
min_height: -1.0 # 根据需要设置高度过滤范围
max_height: 3.5 # 根据需要设置高度过滤范围
angle_min: -1.5708 # 通常为 -π/2(左边)
angle_max: 1.5708 # 通常为 π/2(右边)
angle_increment: 0.0174533 # 取决于你的扫描角度分辨率
range_min: 0.1 # 最小范围
'scan_time': 0.01
range_max: 10.0 # 最大范围
scan_height: 0.1 # 扫描高度
horizontal_sampling_ratio: 1.0
vertical_sampling_ratio: 1.0
keep_organized: true
节点启动代码是:
# 配置文件
configuration_basename = LaunchConfiguration('configuration_basename', default='test_dog_2d.lua')
configuration_convertname = LaunchConfiguration('configuration_convertname', default='pointcloud2_to_laserscan_config.yaml')
pointcloud_to_laserscan_node = Node(
package='pointcloud_to_laserscan',
executable='pointcloud_to_laserscan_node',
name='pointcloud_to_laserscan',
output='screen',
arguments=['-configuration_directory', configuration_directory,
'-configuration_convertname', configuration_convertname],
# parameters=[{'scan_in': '/utlidar/cloud_deskewed', 'cloud': '/cartographer_scan'}],
remappings=[
('/cloud_in', '/utlidar/cloud_deskewed'),
('/scan', '/cartographer_scan')
]
)
现在是输出话题/cartographer_scan全是inf了:
微信图片_20240816144733.jpg
但是这种已经可以建图了,只是地图上rviz没有显示点云数据,后面我再看下,感谢