.pbstreamマップを保存します-.pbstreamマップをpgm、yamlファイルに変換します。こちらを参照してください
.pbstreamファイル用に生成されたplyファイルとpcdファイルは次のとおりです。bag
パッケージは、生成された.pbstreamファイルに対応します(*以下のコードでは、独自のファイル名に変更してください)。
roslaunch cartographer_ros assets_writer_my_3d.launch bag_filenames:=/home/hyper/Downloads/***.bag pose_graph_filename:=/home/hyper/Downloads/***.pbstream
この文を実行した後、対応するplyファイルが生成され、plyからpcdへの変換は次のようになります。
pcl_ply2pcd ***.bag_points.ply ***.pcd
次のコマンドを使用して、pcdポイントクラウドを視覚化できます。
pcl_viewer ***.pcd
Assets_writer_my_3d.launchファイルは次のとおりです。
<launch>
<node name="cartographer_assets_writer" pkg="cartographer_ros" required="true"
type="cartographer_assets_writer" args="
-configuration_directory $(find cartographer_ros)/configuration_files
-configuration_basename assets_writer_my_3d.lua
-urdf_filename $(find cartographer_ros)/urdf/my_backpack_3d.urdf
-bag_filenames $(arg bag_filenames)
-pose_graph_filename $(arg pose_graph_filename)"
output="screen">
</node>
</launch>
起動ファイル内の対応するassets_writer_my_3d.luaファイルは次のとおりです。
VOXEL_SIZE = 5e-2
include "transform.lua"
options = {
tracking_frame = "base_link",
pipeline = {
{
action = "min_max_range_filter",
min_range = 1.,
max_range = 60.,
},
{
action = "dump_num_points",
},
{
action = "fixed_ratio_sampler",
sampling_ratio = 0.01,
},
{
action = "write_ply",
filename = "points.ply"
},
-- Gray X-Rays. These only use geometry to color pixels.
{
action = "write_xray_image",
voxel_size = VOXEL_SIZE,
filename = "xray_yz_all",
transform = YZ_TRANSFORM,
},
{
action = "write_xray_image",
voxel_size = VOXEL_SIZE,
filename = "xray_xy_all",
transform = XY_TRANSFORM,
},
{
action = "write_xray_image",
voxel_size = VOXEL_SIZE,
filename = "xray_xz_all",
transform = XZ_TRANSFORM,
},
-- Now we recolor our points by frame and write another batch of X-Rays. It
-- is visible in them what was seen by the horizontal and the vertical
-- laser.
{
action = "color_points",
frame_id = "world",
color = {
255., 0., 0. },
},
{
action = "write_xray_image",
voxel_size = VOXEL_SIZE,
filename = "xray_yz_all_color",
transform = YZ_TRANSFORM,
},
{
action = "write_xray_image",
voxel_size = VOXEL_SIZE,
filename = "xray_xy_all_color",
transform = XY_TRANSFORM,
},
{
action = "write_xray_image",
voxel_size = VOXEL_SIZE,
filename = "xray_xz_all_color",
transform = XZ_TRANSFORM,
},
}
}
return options
最も重要なことは、luaファイルのtracking_frameとframe_idを変更することです。