Skip to content

Commit

Permalink
Put SLAM Options default values in the declaration.
Browse files Browse the repository at this point in the history
  • Loading branch information
eupedrosa committed Nov 4, 2019
1 parent b5727c3 commit 07808d8
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 124 deletions.
88 changes: 41 additions & 47 deletions include/lama/pf_slam2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
60 changes: 24 additions & 36 deletions include/lama/slam2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -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";
};


Expand Down
25 changes: 0 additions & 25 deletions src/pf_slam2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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); */
Expand Down
16 changes: 0 additions & 16 deletions src/slam2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 07808d8

Please sign in to comment.