Wrapped per-variable thresholds for iSAM2
parent
305ab998fc
commit
fd4f11d21e
23
gtsam.h
23
gtsam.h
|
|
@ -1247,6 +1247,26 @@ class ISAM2DoglegParams {
|
||||||
void setVerbose(bool verbose);
|
void setVerbose(bool verbose);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ISAM2ThresholdMapValue {
|
||||||
|
ISAM2ThresholdMapValue(char c, Vector thresholds);
|
||||||
|
ISAM2ThresholdMapValue(const gtsam::ISAM2ThresholdMapValue& other);
|
||||||
|
};
|
||||||
|
|
||||||
|
class ISAM2ThresholdMap {
|
||||||
|
ISAM2ThresholdMap();
|
||||||
|
ISAM2ThresholdMap(const gtsam::ISAM2ThresholdMap& other);
|
||||||
|
|
||||||
|
// Note: no print function
|
||||||
|
|
||||||
|
// common STL methods
|
||||||
|
size_t size() const;
|
||||||
|
bool empty() const;
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
// structure specific methods
|
||||||
|
void insert(const gtsam::ISAM2ThresholdMapValue& value) const;
|
||||||
|
};
|
||||||
|
|
||||||
class ISAM2Params {
|
class ISAM2Params {
|
||||||
ISAM2Params();
|
ISAM2Params();
|
||||||
|
|
||||||
|
|
@ -1256,8 +1276,7 @@ class ISAM2Params {
|
||||||
void setOptimizationParams(const gtsam::ISAM2GaussNewtonParams& params);
|
void setOptimizationParams(const gtsam::ISAM2GaussNewtonParams& params);
|
||||||
void setOptimizationParams(const gtsam::ISAM2DoglegParams& params);
|
void setOptimizationParams(const gtsam::ISAM2DoglegParams& params);
|
||||||
void setRelinearizeThreshold(double relinearizeThreshold);
|
void setRelinearizeThreshold(double relinearizeThreshold);
|
||||||
// TODO: wrap this
|
void setRelinearizeThreshold(const gtsam::ISAM2ThresholdMap& relinearizeThreshold);
|
||||||
//void setRelinearizeThreshold(const FastMap<char,Vector>& relinearizeThreshold);
|
|
||||||
int getRelinearizeSkip() const;
|
int getRelinearizeSkip() const;
|
||||||
void setRelinearizeSkip(int relinearizeSkip);
|
void setRelinearizeSkip(int relinearizeSkip);
|
||||||
bool isEnableRelinearization() const;
|
bool isEnableRelinearization() const;
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,8 @@ struct ISAM2DoglegParams {
|
||||||
* @addtogroup ISAM2
|
* @addtogroup ISAM2
|
||||||
* Parameters for the ISAM2 algorithm. Default parameter values are listed below.
|
* Parameters for the ISAM2 algorithm. Default parameter values are listed below.
|
||||||
*/
|
*/
|
||||||
|
typedef FastMap<char,Vector> ISAM2ThresholdMap;
|
||||||
|
typedef ISAM2ThresholdMap::value_type ISAM2ThresholdMapValue;
|
||||||
struct ISAM2Params {
|
struct ISAM2Params {
|
||||||
typedef boost::variant<ISAM2GaussNewtonParams, ISAM2DoglegParams> OptimizationParams; ///< Either ISAM2GaussNewtonParams or ISAM2DoglegParams
|
typedef boost::variant<ISAM2GaussNewtonParams, ISAM2DoglegParams> OptimizationParams; ///< Either ISAM2GaussNewtonParams or ISAM2DoglegParams
|
||||||
typedef boost::variant<double, FastMap<char,Vector> > RelinearizationThreshold; ///< Either a constant relinearization threshold or a per-variable-type set of thresholds
|
typedef boost::variant<double, FastMap<char,Vector> > RelinearizationThreshold; ///< Either a constant relinearization threshold or a per-variable-type set of thresholds
|
||||||
|
|
@ -189,7 +191,12 @@ struct ISAM2Params {
|
||||||
if(relinearizeThreshold.type() == typeid(double))
|
if(relinearizeThreshold.type() == typeid(double))
|
||||||
std::cout << "relinearizeThreshold: " << boost::get<double>(relinearizeThreshold) << "\n";
|
std::cout << "relinearizeThreshold: " << boost::get<double>(relinearizeThreshold) << "\n";
|
||||||
else
|
else
|
||||||
|
{
|
||||||
std::cout << "relinearizeThreshold: " << "{mapped}" << "\n";
|
std::cout << "relinearizeThreshold: " << "{mapped}" << "\n";
|
||||||
|
BOOST_FOREACH(const ISAM2ThresholdMapValue& value, boost::get<ISAM2ThresholdMap>(relinearizeThreshold)) {
|
||||||
|
std::cout << " '" << value.first << "' -> [" << value.second.transpose() << " ]\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
std::cout << "relinearizeSkip: " << relinearizeSkip << "\n";
|
std::cout << "relinearizeSkip: " << relinearizeSkip << "\n";
|
||||||
std::cout << "enableRelinearization: " << enableRelinearization << "\n";
|
std::cout << "enableRelinearization: " << enableRelinearization << "\n";
|
||||||
std::cout << "evaluateNonlinearError: " << evaluateNonlinearError << "\n";
|
std::cout << "evaluateNonlinearError: " << evaluateNonlinearError << "\n";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue