mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-08 12:30:20 +08:00
fixed build with older gtsam versions
This commit is contained in:
@@ -38,10 +38,10 @@
|
|||||||
//////////////////
|
//////////////////
|
||||||
|
|
||||||
|
|
||||||
namespace gtsam {
|
namespace rtabmap {
|
||||||
|
|
||||||
template<class DERIVED>
|
template<class DERIVED>
|
||||||
class DerivedValue : public Value {
|
class DerivedValue : public gtsam::Value {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DerivedValue() {}
|
DerivedValue() {}
|
||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
* For the sake of performance, this function use singleton pool allocator instead of the normal heap allocator.
|
* For the sake of performance, this function use singleton pool allocator instead of the normal heap allocator.
|
||||||
* The result must be deleted with Value::deallocate_, not with the 'delete' operator.
|
* The result must be deleted with Value::deallocate_, not with the 'delete' operator.
|
||||||
*/
|
*/
|
||||||
virtual Value* clone_() const {
|
virtual gtsam::Value* clone_() const {
|
||||||
void *place = boost::singleton_pool<PoolTag, sizeof(DERIVED)>::malloc();
|
void *place = boost::singleton_pool<PoolTag, sizeof(DERIVED)>::malloc();
|
||||||
DERIVED* ptr = new(place) DERIVED(static_cast<const DERIVED&>(*this));
|
DERIVED* ptr = new(place) DERIVED(static_cast<const DERIVED&>(*this));
|
||||||
return ptr;
|
return ptr;
|
||||||
@@ -72,12 +72,12 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Clone this value (normal clone on the heap, delete with 'delete' operator)
|
* Clone this value (normal clone on the heap, delete with 'delete' operator)
|
||||||
*/
|
*/
|
||||||
virtual boost::shared_ptr<Value> clone() const {
|
virtual boost::shared_ptr<gtsam::Value> clone() const {
|
||||||
return boost::make_shared<DERIVED>(static_cast<const DERIVED&>(*this));
|
return boost::make_shared<DERIVED>(static_cast<const DERIVED&>(*this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// equals implementing generic Value interface
|
/// equals implementing generic Value interface
|
||||||
virtual bool equals_(const Value& p, double tol = 1e-9) const {
|
virtual bool equals_(const gtsam::Value& p, double tol = 1e-9) const {
|
||||||
// Cast the base class Value pointer to a derived class pointer
|
// Cast the base class Value pointer to a derived class pointer
|
||||||
const DERIVED& derivedValue2 = dynamic_cast<const DERIVED&>(p);
|
const DERIVED& derivedValue2 = dynamic_cast<const DERIVED&>(p);
|
||||||
|
|
||||||
@@ -86,20 +86,20 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Generic Value interface version of retract
|
/// Generic Value interface version of retract
|
||||||
virtual Value* retract_(const Vector& delta) const {
|
virtual gtsam::Value* retract_(const gtsam::Vector& delta) const {
|
||||||
// Call retract on the derived class
|
// Call retract on the derived class
|
||||||
const DERIVED retractResult = (static_cast<const DERIVED*>(this))->retract(delta);
|
const DERIVED retractResult = (static_cast<const DERIVED*>(this))->retract(delta);
|
||||||
|
|
||||||
// Create a Value pointer copy of the result
|
// Create a Value pointer copy of the result
|
||||||
void* resultAsValuePlace = boost::singleton_pool<PoolTag, sizeof(DERIVED)>::malloc();
|
void* resultAsValuePlace = boost::singleton_pool<PoolTag, sizeof(DERIVED)>::malloc();
|
||||||
Value* resultAsValue = new(resultAsValuePlace) DERIVED(retractResult);
|
gtsam::Value* resultAsValue = new(resultAsValuePlace) DERIVED(retractResult);
|
||||||
|
|
||||||
// Return the pointer to the Value base class
|
// Return the pointer to the Value base class
|
||||||
return resultAsValue;
|
return resultAsValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generic Value interface version of localCoordinates
|
/// Generic Value interface version of localCoordinates
|
||||||
virtual Vector localCoordinates_(const Value& value2) const {
|
virtual gtsam::Vector localCoordinates_(const gtsam::Value& value2) const {
|
||||||
// Cast the base class Value pointer to a derived class pointer
|
// Cast the base class Value pointer to a derived class pointer
|
||||||
const DERIVED& derivedValue2 = dynamic_cast<const DERIVED&>(value2);
|
const DERIVED& derivedValue2 = dynamic_cast<const DERIVED&>(value2);
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Assignment operator
|
/// Assignment operator
|
||||||
virtual Value& operator=(const Value& rhs) {
|
virtual gtsam::Value& operator=(const gtsam::Value& rhs) {
|
||||||
// Cast the base class Value pointer to a derived class pointer
|
// Cast the base class Value pointer to a derived class pointer
|
||||||
const DERIVED& derivedRhs = dynamic_cast<const DERIVED&>(rhs);
|
const DERIVED& derivedRhs = dynamic_cast<const DERIVED&>(rhs);
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// DerivedValue.h removed from gtsam repo (Dec 2018): https://github.com/borglab/gtsam/commit/e550f4f2aec423cb3f2791b81cb5858b8826ebac
|
// DerivedValue2.h removed from gtsam repo (Dec 2018): https://github.com/borglab/gtsam/commit/e550f4f2aec423cb3f2791b81cb5858b8826ebac
|
||||||
#include "DerivedValue.h"
|
#include "DerivedValue.h"
|
||||||
#include <gtsam/base/Lie.h>
|
#include <gtsam/base/Lie.h>
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ namespace vertigo {
|
|||||||
/**
|
/**
|
||||||
* SwitchVariableLinear is a wrapper around double to allow it to be a Lie type
|
* SwitchVariableLinear is a wrapper around double to allow it to be a Lie type
|
||||||
*/
|
*/
|
||||||
struct SwitchVariableLinear : public gtsam::DerivedValue<SwitchVariableLinear> {
|
struct SwitchVariableLinear : public rtabmap::DerivedValue<SwitchVariableLinear> {
|
||||||
|
|
||||||
/** default constructor */
|
/** default constructor */
|
||||||
SwitchVariableLinear() : d_(0.0) {};
|
SwitchVariableLinear() : d_(0.0) {};
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace vertigo {
|
|||||||
/**
|
/**
|
||||||
* SwitchVariableSigmoid is a wrapper around double to allow it to be a Lie type
|
* SwitchVariableSigmoid is a wrapper around double to allow it to be a Lie type
|
||||||
*/
|
*/
|
||||||
struct SwitchVariableSigmoid : public gtsam::DerivedValue<SwitchVariableSigmoid> {
|
struct SwitchVariableSigmoid : public rtabmap::DerivedValue<SwitchVariableSigmoid> {
|
||||||
|
|
||||||
/** default constructor */
|
/** default constructor */
|
||||||
SwitchVariableSigmoid() : d_(10.0) {};
|
SwitchVariableSigmoid() : d_(10.0) {};
|
||||||
|
|||||||
Reference in New Issue
Block a user