24#include "cli/CLI11.hpp"
34 std::string transform_file{};
35 std::vector<double> cropbox{};
36 double cropsphere{0.0};
37 double cropcylinder{0.0};
38 std::vector<double> voxelfilter{};
39 std::pair<double, int> outlier_radius_filter{};
40 std::pair<double, int> outlier_stat_filter{};
41 int64_t max_frames{-1};
42 int64_t skip_frames{0};
43 int64_t stride_frames{1};
44 std::string out_dir{};
45 bool timestamps{
false};
46 bool sequential_names{
false};
47 bool inverse_crop{
false};
48 double split_grid_size{0.0};
52 bool load_kitti{
false};
53 bool load_nuscenes{
false};
58 bool save_kitti{
false};
59 bool save_nuscenes{
false};
67 if (load_ply)
return pointcloudcrafter::tools::formats::FileFormat::PLY;
68 if (load_txt)
return pointcloudcrafter::tools::formats::FileFormat::TXT;
69 if (load_kitti)
return pointcloudcrafter::tools::formats::FileFormat::KITTI;
70 if (load_nuscenes)
return pointcloudcrafter::tools::formats::FileFormat::NUSCENES;
71 if (load_obj)
return pointcloudcrafter::tools::formats::FileFormat::OBJ;
72 return pointcloudcrafter::tools::formats::FileFormat::PCD;
81 if (save_pcd)
return pointcloudcrafter::tools::formats::FileFormat::PCD;
82 if (save_ply)
return pointcloudcrafter::tools::formats::FileFormat::PLY;
83 if (save_txt)
return pointcloudcrafter::tools::formats::FileFormat::TXT;
84 if (save_kitti)
return pointcloudcrafter::tools::formats::FileFormat::KITTI;
85 if (save_nuscenes)
return pointcloudcrafter::tools::formats::FileFormat::NUSCENES;
96 app->
add_flag(
"--timestamps", timestamps,
"Save point cloud timestamps to a text file")
99 app->
add_flag(
"--sequential-name", sequential_names,
"Use sequential file names")
103 app->
add_option(
"-m,--max-frames", max_frames,
"Maximum number of frames (-1 = unlimited)")
106 app->
add_option(
"-j,--skip-frames", skip_frames,
"Number of frames to skip at the beginning")
109 app->
add_option(
"-s,--stride-frames", stride_frames,
"Write every Nth frame")
113 app->
add_flag(
"--save-pcd", save_pcd,
"Save PCD files (default)")
114 ->
group(
"File Format");
115 app->
add_flag(
"--save-ply", save_ply,
"Save PLY files")
116 ->
group(
"File Format");
117 app->
add_flag(
"--save-txt", save_txt,
"Save TXT ASCII files")
118 ->
group(
"File Format");
119 app->
add_flag(
"--save-kitti", save_kitti,
"Save KITTI binary files")
120 ->
group(
"File Format");
121 app->
add_flag(
"--save-nuscenes", save_nuscenes,
"Save nuScenes binary files")
122 ->
group(
"File Format");
126 "--split", split_grid_size,
127 "Split point cloud into grid cells of given size")
129 ->
group(
"Transforms");
132 "--tf, --transform-file", transform_file,
133 "TXT file with transform ([frame_id] r1 r2 r3 x r4 r5 r6 y r7 r8 r9 z)")
134 ->
group(
"Transforms");
137 app->
add_option(
"--cb, --crop-box", cropbox,
"Crop box [xmin ymin zmin xmax ymax zmax]")
139 ->
type_name(
"FLOAT FLOAT FLOAT FLOAT FLOAT FLOAT")
140 ->
group(
"Filtering");
142 app->
add_option(
"--cs, --crop-sphere", cropsphere,
"Crop to sphere with given radius")
144 ->
group(
"Filtering");
146 app->
add_option(
"--cc, --crop-cylinder", cropcylinder,
"Crop to cylinder with given radius")
148 ->
group(
"Filtering");
150 app->
add_flag(
"--inverse-crop", inverse_crop,
"Inverse crop filters")
151 ->
group(
"Filtering");
153 app->
add_option(
"--vf, --voxel-filter", voxelfilter,
"Voxel size [x y z]")
156 ->
group(
"Filtering");
159 "--orf, --outlier-radius-filter", outlier_radius_filter,
160 "Radius outlier removal [radius min_neighbors]")
163 ->
group(
"Filtering");
166 "--osf, --outlier-stat-filter", outlier_stat_filter,
167 "Statistical outlier removal [threshold mean_k]")
170 ->
group(
"Filtering");
179 std::string input_path{};
180 std::vector<double> translation{};
181 std::vector<double> rotation{};
183 bool merge_clouds{
false};
191 app->
add_option(
"input-path", input_path,
"Path to point cloud file or directory")
195 app->
add_option(
"out-dir", out_dir,
"Output directory for point cloud file(s)")
199 app->
add_flag(
"--load-pcd", load_pcd,
"Load PCD files (default)")
200 ->
group(
"File Format");
201 app->
add_flag(
"--load-ply", load_ply,
"Load PLY files")
202 ->
group(
"File Format");
203 app->
add_flag(
"--load-txt", load_txt,
"Load TXT ASCII files")
204 ->
group(
"File Format");
205 app->
add_flag(
"--load-kitti", load_kitti,
"Load KITTI binary files")
206 ->
group(
"File Format");
207 app->
add_flag(
"--load-nuscenes", load_nuscenes,
"Load nuScenes binary files")
208 ->
group(
"File Format");
209 app->
add_flag(
"--load-obj", load_obj,
"Load OBJ files")
210 ->
group(
"File Format");
212 app->
add_option(
"-t,--translation", translation,
"Translation [x y z]")
215 ->
group(
"Transforms");
217 app->
add_option(
"-r,--rotation", rotation,
"Rotation [roll pitch yaw]")
220 ->
group(
"Transforms");
222 app->
add_flag(
"--deg", degree,
"Rotation in degrees instead of radians")
223 ->
group(
"Transforms");
225 app->
add_flag(
"--merge-clouds", merge_clouds,
"Merge all point clouds into a single file")
226 ->
group(
"Transforms");
237 std::string bag_path{};
238 std::vector<std::string> topics{};
239 std::string target_frame{};
240 std::string urdf_file{};
248 app->
add_option(
"bag-path", bag_path,
"Path to ROS 2 bag")
252 app->
add_option(
"out-dir", out_dir,
"Output directory for point cloud file(s)")
256 app->
add_option(
"topic-names", topics,
"PointCloud2 topic names")
260 app->
add_option(
"-t,--target-frame", target_frame,
"Target TF frame for all point clouds")
261 ->
group(
"Transforms");
264 "--urdf, --urdf-file", urdf_file,
265 "URDF file providing additional static TF transforms")
266 ->
group(
"Transforms");
Creates a command line program, with very few defaults.
Definition CLI11.hpp:5883
Option * add_flag(std::string flag_name)
Add a flag with no description or variable assignment.
Definition CLI11.hpp:6415
Option * add_option(std::string option_name, callback_t option_callback, std::string option_description="", bool defaulted=false, std::function< std::string()> func={})
Definition CLI11.hpp:7372
CRTP * group(const std::string &name)
Changes the group membership.
Definition CLI11.hpp:4449
CRTP * required(bool value=true)
Set the option as required.
Definition CLI11.hpp:4458
Option * expected(int value)
Set the number of expected arguments.
Definition CLI11.hpp:5207
Option * type_name(std::string typeval)
Set a custom option typestring.
Definition CLI11.hpp:5111
FileConfig input configuration.
Definition cli_config.hpp:178
void add_cli_options(CLI::App *app)
Add FileConfig CLI options to the given app.
Definition cli_config.hpp:189
Common modifier configuration.
Definition cli_config.hpp:33
void add_modifier_options(CLI::App *app)
Add common modifier CLI options to the given app.
Definition cli_config.hpp:93
pointcloudcrafter::tools::formats::FileFormat get_save_format() const
Get the save format based on flags.
Definition cli_config.hpp:79
pointcloudcrafter::tools::formats::FileFormat get_load_format() const
Get the load format based on flags.
Definition cli_config.hpp:65
Rosbag input configuration.
Definition cli_config.hpp:236
void add_cli_options(CLI::App *app)
Add Rosbag CLI options to the given app.
Definition cli_config.hpp:246