diff --git a/include/lama/pf_slam2d.h b/include/lama/pf_slam2d.h index 540a7d7..5a0af0d 100644 --- a/include/lama/pf_slam2d.h +++ b/include/lama/pf_slam2d.h @@ -82,59 +82,53 @@ class PFSlam2D { }; struct Options { - Options(); + Options(){} - /// the number of particles to use + /// The number of particles to use uint32_t particles; - - /// - bool use_gaussian_proposal; - - double srr; - double str; - double stt; - double srt; - - double meas_sigma; - double meas_sigma_gain; - - /// the ammount of displacement that the system must + /// How much the rotation affects rotation. + double srr = 0.1; + /// How much the translation affects rotation. + double str = 0.2; + /// How much the translation affects translation. + double stt = 0.1; + /// How much the rotation affects translation. + double srt = 0.2; + /// Measurement confidence. + double meas_sigma = 0.05; + /// Use this to smooth the measurements likelihood. + double meas_sigma_gain = 3; + /// The ammount of displacement that the system must /// gather before any update takes place. - double trans_thresh; - - /// the ammout of rotation that the system must + double trans_thresh = 0.5; + /// The ammout of rotation that the system must /// gather before any update takes place. - double rot_thresh; - - /// maximum distance (in meters) of the euclidean distance map. - double l2_max; - - double truncated_ray; - - /// resolutions of the maps. - double resolution; - + double rot_thresh = 0.5; + /// Maximum distance (in meters) of the euclidean distance map. + double l2_max = 0.5; + /// If != from zero, truncate the ray lenght (includes the endpoint). + double truncated_ray = 0.0; + /// Resolutions of the maps. + double resolution = 0.05; /// The side size of a patch - uint32_t patch_size; - - /// maximum number of iterations that the optimizer + uint32_t patch_size = 32; + /// Maximum number of iterations that the optimizer /// can achieve. - uint32_t max_iter; - - /// strategy to use in the optimization. - std::string strategy; - - int32_t threads; - - uint32_t seed; - - /// - bool use_compression; - uint32_t cache_size; - - /// compression algorithm to use when compression is activated - std::string calgorithm; - + uint32_t max_iter = 100; + /// Strategy to use in the optimization. + std::string strategy = "gn"; + /// Number of working threads. + /// -1 for none, 0 for auto, >0 user define number of workers. + int32_t threads = -1; + /// Pseudo random generator seed. + /// Use 0 to generate a new seed. + uint32_t seed = 0; + /// Should online data compression be used or not. + bool use_compression = false; + /// Size of LRU. + uint32_t cache_size = 100; + /// Compression algorithm to use when compression is activated + std::string calgorithm = "lz4"; }; PFSlam2D(const Options& options = Options()); diff --git a/include/lama/slam2d.h b/include/lama/slam2d.h index 722f7c4..8f152bf 100644 --- a/include/lama/slam2d.h +++ b/include/lama/slam2d.h @@ -53,44 +53,32 @@ class Slam2D { typedef RobustCost::Ptr RobustCostPtr; struct Options { - Options(); - /// the ammount of displacement that the system must - /// gather before any update takes place. - double trans_thresh; + Options(){} - /// the ammout of rotation that the system must + /// The ammount of linear motion that the system must /// gather before any update takes place. - double rot_thresh; - - /// maximum distance (in meters) of the euclidean distance map. - double l2_max; - - double truncated_ray; - - /// resolutions of the maps. - double resolution; - - /// The side size of a patch - uint32_t patch_size; - - /// maximum number of iterations that the optimizer - /// can achieve. - uint32_t max_iter; - - /// strategy to use in the optimization. - std::string strategy; - - /// wether or not to keep an execution summary. - bool keep_summary; - - /// online data compression - bool use_compression; - - /// size of LRU - uint32_t cache_size; - - /// compression algorithm to use when compression is activated - std::string calgorithm; + double trans_thresh = 0.5; + /// The ammout of rotation that the system must + /// gather before any update takes place. + double rot_thresh = 0.5; + /// Maximum distance (in meters) of the euclidean distance map. + double l2_max = 0.5; + /// If != from zero, truncate the ray lenght (includes the endpoint). + double truncated_ray = 0.0; + /// Resolutions of the maps. + double resolution = 0.05; + /// The side size of a patch. + uint32_t patch_size = 32; + /// Maximum number of iterations that the optimizer can achieve. + uint32_t max_iter = 100; + /// Strategy to use in the optimization. + std::string strategy = "gn"; + /// Should online data compression be used or not. + bool use_compression = false; + /// Size of LRU. + uint32_t cache_size = 100; + /// Compression algorithm to use when compression is activated + std::string calgorithm = "lz4"; }; diff --git a/src/pf_slam2d.cpp b/src/pf_slam2d.cpp index 649a2f7..0e89cd7 100644 --- a/src/pf_slam2d.cpp +++ b/src/pf_slam2d.cpp @@ -46,34 +46,9 @@ #include "lama/sdm/export.h" -lama::PFSlam2D::Options::Options() -{ - particles = 30; - use_gaussian_proposal = false; - srr = 0.1; - srt = 0.2; - str = 0.1; - stt = 0.2; - meas_sigma = 0.05; - meas_sigma_gain = 3; - - trans_thresh = 0.5; - rot_thresh = 0.5; - l2_max = 0.5; - truncated_ray = -1; - resolution = 0.05; - patch_size = 32; - max_iter = 100; - - threads = -1; - use_compression = false; - cache_size = 60; -} - lama::PFSlam2D::PFSlam2D(const Options& options) : options_(options) { - /* solver_options_.write_to_stdout= true; */ solver_options_.max_iterations = options.max_iter; solver_options_.strategy = makeStrategy(options.strategy, Vector2d::Zero()); /* solver_options_.robust_cost = makeRobust("cauchy", 0.25); */ diff --git a/src/slam2d.cpp b/src/slam2d.cpp index 4a175c0..fc3d8a8 100644 --- a/src/slam2d.cpp +++ b/src/slam2d.cpp @@ -41,22 +41,6 @@ #include "lama/slam2d.h" #include "lama/match_surface_2d.h" -lama::Slam2D::Options::Options() -{ - trans_thresh = 0.5; - rot_thresh = 0.5; - l2_max = 1.0; - truncated_ray= 0.0; - resolution = 0.05; - patch_size = 20; - max_iter = 100; - keep_summary = false; - - use_compression = false; - cache_size = 60; - calgorithm = "lz4"; -} - lama::Slam2D::Slam2D(const Options& options) { distance_map_ = new DynamicDistanceMap(options.resolution, options.patch_size);