32template<
typename T,
typename PoseTypeSpec,
size_t PoseDim,
typename TwistTypeSpec,
size_t TwistDim>
62 this->pose = other.
pose;
63 this->twist = other.
twist;
72 x.
pose = PoseTypeSpec::ZeroType();
73 x.
twist = TwistTypeSpec::ZeroType();
83 x.
pose = PoseTypeSpec::NansType();
84 x.
twist = TwistTypeSpec::NansType();
93 const T poseNorm = PoseTypeSpec::Norm(
pose);
94 const T twistNorm = TwistTypeSpec::Norm(
twist);
95 return std::sqrt(poseNorm * poseNorm + twistNorm * twistNorm);
111 template<
typename T2>
123template<
typename T,
typename PTS,
size_t PD,
typename TTS,
size_t TD>
124State<T, PTS, PD, TTS, TD> operator+(
const State<T, PTS, PD, TTS, TD>& l,
const State<T, TTS, TD, TTS, TD>& r)
135template<
typename T,
typename PTS,
size_t PD,
typename TTS,
size_t TD>
136State<T, TTS, TD, TTS, TD> operator-(
const State<T, PTS, PD, TTS, TD>& l,
const State<T, PTS, PD, TTS, TD>& r)
147template<
typename T,
typename PTS,
size_t PD,
typename TTS,
size_t TD>
159template<
typename T,
typename PTS,
size_t PD,
typename TTS,
size_t TD>
174 os <<
"ScalarStateType: pose=" << x.
pose <<
"; twist=" << x.
twist;
190template<
typename T,
size_t d>
193template<
typename T,
size_t d>
196 os <<
"VectorStateType: pose=" << x.
pose.transpose() <<
"; twist=" << x.
twist.transpose();
203template<
typename T,
size_t d>
212template<
typename T,
typename ManifoldType,
size_t PD,
size_t TD>
215template<
typename T,
typename ManifoldType,
size_t PD,
size_t TD>
218 os <<
"VectorStateType: pose=" << x.
pose <<
"; twist=" << x.
twist;
260template<
typename T,
size_t d>
296template<
typename T,
typename ManifoldType,
size_t PD,
size_t TD>
331 os <<
"ScalarStateSignal at t=" << x.
t() <<
": pose=" << x().pose <<
"; twist=" << x().twist;
335template<
typename T,
size_t d>
338template<
typename T,
size_t d>
341 os <<
"VectorStateSignal at t=" << x.
t() <<
": pose=" << x().pose.transpose()
342 <<
"; twist=" << x().twist.transpose();
346template<
typename T,
typename ManifoldType,
size_t PD,
size_t TD>
349template<
typename T,
typename ManifoldType,
size_t PD,
size_t TD>
352 os <<
"ManifoldStateSignal at t=" << x.
t() <<
": pose=" << x().pose <<
"; twist=" << x().twist;
356#define MAKE_VECTOR_STATES(Dimension) \
357 template<typename T> \
358 using Vector##Dimension##State = VectorStateType<T, Dimension>; \
359 template<typename T> \
360 using Vector##Dimension##StateSignal = VectorStateSignal<T, Dimension>; \
361 typedef Vector##Dimension##State<double> Vector##Dimension##dState; \
362 typedef Vector##Dimension##StateSignal<double> Vector##Dimension##dStateSignal;
364#define MAKE_MANIF_STATES(Manif, Dimension, TangentDimension) \
365 template<typename T> \
366 using Manif##State = ManifoldStateType<T, Manif<T>, Dimension, TangentDimension>; \
367 template<typename T> \
368 using Manif##StateSignal = ManifoldStateSignal<T, Manif<T>, Dimension, TangentDimension>; \
369 typedef Manif##State<double> Manif##dState; \
370 typedef Manif##StateSignal<double> Manif##dStateSignal;
State< T, VectorSignalSpec< T, d >, d, VectorSignalSpec< T, d >, d > VectorStateType
Definition State.h:191
Signal< T, ScalarStateSignalSpec< T >, ScalarStateSignalSpec< T > > ScalarStateSignal
Definition State.h:326
#define MAKE_MANIF_STATES(Manif, Dimension, TangentDimension)
Definition State.h:364
State< T, PTS, PD, TTS, TD > operator*(const double &l, const State< T, PTS, PD, TTS, TD > &r)
Scale the state (pose and twist) by a scalar.
Definition State.h:148
ScalarStateSignal< double > ScalardStateSignal
Definition State.h:375
ScalarState< double > ScalardState
Definition State.h:374
State< T, ScalarSignalSpec< T >, 1, ScalarSignalSpec< T >, 1 > ScalarStateType
Definition State.h:169
Signal< T, ManifoldStateSignalSpec< T, ManifoldType, PD, TD >, VectorStateSignalSpec< T, TD > > ManifoldStateSignal
Definition State.h:347
State< T, PTS, PD, TTS, TD > operator+(const State< T, PTS, PD, TTS, TD > &l, const State< T, TTS, TD, TTS, TD > &r)
Add a tangent space state (twist and derivative of twist) to the current state.
Definition State.h:124
State< T, TTS, TD, TTS, TD > operator-(const State< T, PTS, PD, TTS, TD > &l, const State< T, PTS, PD, TTS, TD > &r)
Subtract a tangent space state (twist and derivative of twist) from the current state.
Definition State.h:136
std::ostream & operator<<(std::ostream &os, const ScalarStateType< T > &x)
Definition State.h:172
ScalarStateType< T > ScalarState
Definition State.h:373
State< T, ManifoldSignalSpec< T, ManifoldType >, PD, VectorSignalSpec< T, TD >, TD > ManifoldStateType
Definition State.h:213
#define MAKE_VECTOR_STATES(Dimension)
Definition State.h:356
Signal< T, VectorStateSignalSpec< T, d >, VectorStateSignalSpec< T, d > > VectorStateSignal
Definition State.h:336
ScalarStateType< T > operator/(const ScalarStateType< T > &l, const double &r)
Scale the state (pose and twist) by a scalar.
Definition State.h:182
Template class for time-series signals with interpolation, extrapolation, and derivative capabilities...
Definition Signal.h:63
double t() const
Get the current time of the signal.
Definition Signal.h:151
Type specification for manifold state signals.
Definition State.h:298
static T Norm(const Type &a)
Compute the combined norm of a manifold state.
Definition State.h:319
static Type NansType()
Returns state with NaN values.
Definition State.h:310
static Type ZeroType()
Returns identity (zero) state.
Definition State.h:303
ManifoldStateType< T, ManifoldType, PD, TD > Type
Definition State.h:299
Type specification for scalar-valued signals.
Definition Signal.h:805
Type specification for scalar state signals.
Definition State.h:228
static Type ZeroType()
Returns identity (zero) state.
Definition State.h:233
static T Norm(const Type &a)
Compute the combined norm of a scalar state.
Definition State.h:249
ScalarStateType< T > Type
Definition State.h:229
static Type NansType()
Returns state with NaN values.
Definition State.h:240
Base type for all Model state representations.
Definition State.h:34
static State identity()
Definition State.h:69
State(T *arr)
Definition State.h:55
PoseType pose
Definition State.h:41
typename PoseTypeSpec::Type PoseType
Definition State.h:35
TwistType twist
Definition State.h:45
T norm() const
Definition State.h:91
State & operator+=(const State< T2, ScalarSignalSpec< T >, TwistDim, ScalarSignalSpec< T >, TwistDim > &r)
Definition State.h:112
static State nans()
Definition State.h:80
State(const State &other)
Definition State.h:60
typename TwistTypeSpec::Type TwistType
Definition State.h:36
State()
Initialize an empty state.
Definition State.h:50
State & operator*=(const double &s)
Definition State.h:101
Type specification for vector-valued signals.
Definition Signal.h:839
Type specification for vector state signals.
Definition State.h:262
VectorStateType< T, d > Type
Definition State.h:263
static Type NansType()
Returns state with NaN values.
Definition State.h:274
static T Norm(const Type &a)
Compute the combined norm of a vector state.
Definition State.h:283
static Type ZeroType()
Returns identity (zero) state.
Definition State.h:267