56 #ifndef _GAMS_POSE_STAMPED_H_
57 #define _GAMS_POSE_STAMPED_H_
64 #include "madara/knowledge/containers/DoubleVector.h"
65 #include "madara/knowledge/containers/NativeDoubleVector.h"
69 namespace gams {
namespace pose {
71 using madara::utility::Clock;
72 using madara::utility::TimeValue;
73 using madara::utility::Duration;
74 using madara::utility::SecondsDuration;
78 (x.time(), x.time(TimeValue{})));
85 template<
typename T,
typename... Args>
87 typename std::enable_if<supports_timestamp<T>::value, TimeValue>::type
92 template<
typename T,
typename... Args>
94 typename std::enable_if<!supports_timestamp<T>::value, TimeValue>::type
101 template<
typename Impl>
125 template<
typename... Args>
128 template<
typename Arg,
typename... Args,
129 typename std::enable_if<!std::is_same<typename std::decay<Arg>::type,
130 TimeValue>::value &&
sizeof...(Args) >= 1,
void*>::type =
nullptr>
131 Stamped(Arg&& arg, Args&&... args)
132 : Impl((Arg &)arg, ((Args &)args)...),
135 template<
typename Arg,
136 typename std::enable_if<!std::is_same<typename std::decay<Arg>::type,
137 TimeValue>::value,
void*>::type =
nullptr>
157 template<
typename... Args>
160 template<
typename... Args,
161 typename std::enable_if<(
sizeof...(Args) >= 1),
void*>::type =
nullptr>
163 : Impl(std::forward<Args>(args)...),
time_(
time) {}
175 namespace sc = std::chrono;
176 return sc::duration_cast<Duration>(
177 time_.time_since_epoch()).count();
183 time_ = TimeValue(dur);
189 namespace sc = std::chrono;
190 return sc::duration_cast<SecondsDuration>(
191 time_.time_since_epoch()).count();
196 namespace sc = std::chrono;
197 SecondsDuration dur(v);
198 Duration ndur(sc::duration_cast<Duration>(dur));
199 time_ = TimeValue(ndur);
207 template<
typename Base>
210 return o << v <<
"@" << v.
time();
Internal class implementing coordinates stamped with timestamp.
double secs(double v)
Set time as seconds since std::steady_clock epoch.
Stamped()=default
Default Constructor.
uint64_t nanos(uint64_t v)
Set time as nanos since std::steady_clock epoch.
TimeValue time(TimeValue v)
Set time from std::chrono based TimeValue.
double secs() const
Get time as seconds since std::steady_clock epoch.
uint64_t nanos() const
Get time as nanos since std::steady_clock epoch.
TimeValue time() const
Get time as std::chrono based TimeValue.
Stamped(TimeValue time)
Construct using a TimeValue object.
typename Impl::derived_type derived_type
Stamped(Args &&... args)
Construct without a TimeStamp object.
Stamped(TimeValue time, Args &&... args)
Construct with a timestamp.
std::ostream & operator<<(std::ostream &o, const Eigen::Vector3d &v)
MADARA_MAKE_VAL_SUPPORT_TEST(nano_timestamp, x,(x.nanos(), x.nanos(0UL)))
Type trait to detect stamped types.
Contains all GAMS-related tools, classes and code.
Copyright (c) 2015 Carnegie Mellon University.
Copyright (c) 2015 Carnegie Mellon University.