Correcting VLA issue, and add template specification for between Pose2 objects. More template specifcations will be needed on windows, unless another fix is found
parent
5bcb880759
commit
701dcc1c99
|
@ -206,11 +206,20 @@ private:
|
||||||
// with an execution trace, made up entirely of "Record" structs, see
|
// with an execution trace, made up entirely of "Record" structs, see
|
||||||
// the FunctionalNode class in expression-inl.h
|
// the FunctionalNode class in expression-inl.h
|
||||||
size_t size = traceSize();
|
size_t size = traceSize();
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
ExecutionTraceStorage* traceStorage = new ExecutionTraceStorage[size];
|
||||||
|
ExecutionTrace<T> trace;
|
||||||
|
T value(traceExecution(values, trace, traceStorage));
|
||||||
|
trace.startReverseAD1(jacobians);
|
||||||
|
delete[] traceStorage;
|
||||||
|
return value;
|
||||||
|
#else
|
||||||
ExecutionTraceStorage traceStorage[size];
|
ExecutionTraceStorage traceStorage[size];
|
||||||
ExecutionTrace<T> trace;
|
ExecutionTrace<T> trace;
|
||||||
T value(traceExecution(values, trace, traceStorage));
|
T value(traceExecution(values, trace, traceStorage));
|
||||||
trace.startReverseAD1(jacobians);
|
trace.startReverseAD1(jacobians);
|
||||||
return value;
|
return value;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// be very selective on who can access these private methods:
|
// be very selective on who can access these private methods:
|
||||||
|
|
|
@ -8,13 +8,26 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <gtsam/nonlinear/Expression.h>
|
#include <gtsam/nonlinear/Expression.h>
|
||||||
|
#include <gtsam/geometry/Pose2.h>
|
||||||
|
#include <gtsam/geometry/Pose3.h>
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
|
// 2D Geometry
|
||||||
|
typedef Expression<Pose2> Pose2_;
|
||||||
|
|
||||||
|
Pose2_ between(const Pose2_& x, const Pose2_& p) {
|
||||||
|
Pose2(Pose2::*transform)(const Pose2& p,
|
||||||
|
boost::optional<Matrix3&> H1,
|
||||||
|
boost::optional<Matrix3&> H2) const = &Pose2::between;
|
||||||
|
|
||||||
|
return Pose2_(x, transform, p);
|
||||||
|
}
|
||||||
|
|
||||||
// Generics
|
// Generics
|
||||||
|
|
||||||
template<class T>
|
template<typename T>
|
||||||
Expression<T> between(const Expression<T>& t1, const Expression<T>& t2) {
|
Expression<T> between(const Expression<T>& t1, const Expression<T>& t2) {
|
||||||
return Expression<T>(t1, &T::between, t2);
|
return Expression<T>(t1, &T::between, t2);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue