GAMS
1.2.2
|
For internal use. More...
#include <ReferenceFrame.h>
Public Member Functions | |
template<typename P , typename std::enable_if< supports_transform_to< P >::value, void * >::type = nullptr> | |
ReferenceFrameVersion (P &&origin, uint64_t timestamp=-1) | |
Constructor from an origin, and optional timestamp. More... | |
template<typename P , typename std::enable_if< supports_transform_to< P >::value, void * >::type = nullptr> | |
ReferenceFrameVersion (const ReferenceFrameType *type, P &&origin, uint64_t timestamp=-1) | |
Constructor from a type, an origin, and optional timestamp. More... | |
template<typename P , typename std::enable_if< supports_transform_to< P >::value, void * >::type = nullptr> | |
ReferenceFrameVersion (std::string name, P &&origin, uint64_t timestamp=-1) | |
Constructor from a id, an origin, and optional timestamp. More... | |
template<typename P , typename std::enable_if< supports_transform_to< P >::value, void * >::type = nullptr> | |
ReferenceFrameVersion (const ReferenceFrameType *type, std::string name, P &&origin, uint64_t timestamp=-1) | |
Constructor from a type, id, an origin, and optional timestamp. More... | |
template<typename P , typename std::enable_if< supports_transform_to< P >::value, void * >::type = nullptr> | |
ReferenceFrameVersion (std::shared_ptr< ReferenceFrameIdentity > ident, const ReferenceFrameType *type, P &&origin, uint64_t timestamp=-1) | |
Constructor from an existing ReferenceFrameIdentity, an origin, and optional timestamp. More... | |
bool | has_id () const |
Does this frame have an ID? Frames gain an ID either at construction, or lazily as needed (by having the id() method, or save* methods called). More... | |
const std::string & | id () const |
Get the ID string of this frame. More... | |
const std::string * | id_ptr () const |
Get the ID string of this frame. More... | |
const ReferenceFrameIdentity & | ident () const |
Get the ReferenceFrameIdentity object associated with this frame, creating one with random ID if none exists. More... | |
ReferenceFrame | interpolate (const ReferenceFrame &other, ReferenceFrame parent, uint64_t time) const |
Interpolate a frame between the given frame; use the given parent. More... | |
bool | interpolated () const |
Returns true if this frame was interpolated from two stored frames. More... | |
std::string | key (const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT) const |
Returns the key that save() will use to store this frame. More... | |
ReferenceFrame | move (Position new_origin) const |
Creates a new ReferenceFrame with modified origin. More... | |
ReferenceFrame | move (const Position &new_origin, uint64_t timestamp) const |
Creates a new ReferenceFrame with modified origin and timestamp. More... | |
Pose & | mut_origin () |
Gets the origin of this Frame. More... | |
const char * | name () const |
Returns a human-readable name for the reference frame type. More... | |
bool | operator!= (const ReferenceFrame &other) const |
Inequality operator. More... | |
bool | operator!= (const ReferenceFrameVersion &other) const |
Inequality operator. More... | |
bool | operator== (const ReferenceFrame &other) const |
Equality operator. More... | |
bool | operator== (const ReferenceFrameVersion &other) const |
Equality operator. More... | |
ReferenceFrame | orient (Orientation new_origin) const |
Creates a new ReferenceFrame with modified origin. More... | |
ReferenceFrame | orient (const Orientation &new_origin, uint64_t timestamp) const |
Creates a new ReferenceFrame with modified origin and timestamp. More... | |
const Pose & | origin () const |
Gets the origin of this Frame. More... | |
ReferenceFrame | origin_frame () const |
Gets the parent frame (the one the origin is within). More... | |
ReferenceFrame | pose (Pose new_origin) const |
Creates a new ReferenceFrame with modified origin. More... | |
ReferenceFrame | pose (const Pose &new_origin, uint64_t timestamp) const |
Creates a new ReferenceFrame with modified origin and timestamp. More... | |
void | save (madara::knowledge::KnowledgeBase &kb, uint64_t expiry, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT) const |
Save this ReferenceFrame to the knowledge base, The saved frames will be marked with their timestamp for later retrieval. More... | |
void | save (madara::knowledge::KnowledgeBase &kb, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT) const |
Save this ReferenceFrame to the knowledge base, The saved frames will be marked with their timestamp for later retrieval. More... | |
void | save_as (madara::knowledge::KnowledgeBase &kb, std::string key, uint64_t expiry, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT) const |
Save this ReferenceFrame to the knowledge base, with a specific key value. More... | |
void | save_as (madara::knowledge::KnowledgeBase &kb, std::string key, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT) const |
Save this ReferenceFrame to the knowledge base, with a specific key value. More... | |
uint64_t | timestamp () const |
Get the timestamp assigned to this frame. More... | |
ReferenceFrame | timestamp (uint64_t timestamp) const |
Clone the this frame, but with new timestamp. More... | |
const ReferenceFrameType * | type () const |
Retrieve the frame type object for this frame. More... | |
Static Public Member Functions | |
static const std::string & | default_prefix () |
template<typename ForwardIterator > | |
static uint64_t | latest_common_timestamp (madara::knowledge::KnowledgeBase &kb, ForwardIterator begin, ForwardIterator end, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT) |
Get the latest available timestamp in the knowledge base common to all the given ids. More... | |
template<typename Container > | |
static uint64_t | latest_common_timestamp (madara::knowledge::KnowledgeBase &kb, const Container &ids, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT) |
Get the latest available timestamp in the knowledge base common to all the given ids. More... | |
static uint64_t | latest_timestamp (madara::knowledge::KnowledgeBase &kb, const std::string &id, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT) |
Get the latest available timestamp in the knowledge base for the given id. More... | |
static ReferenceFrame | load (madara::knowledge::KnowledgeBase &kb, const std::string &id, uint64_t timestamp=-1, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT) |
Load a single ReferenceFrame, by ID and timestamp, interpolated if applicable. More... | |
static ReferenceFrame | load_exact (madara::knowledge::KnowledgeBase &kb, const std::string &id, uint64_t timestamp=-1, uint64_t parent_timestamp=-1, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT) |
Load a single ReferenceFrame, by ID and timestamp. More... | |
template<typename ForwardIterator > | |
static std::vector< ReferenceFrame > | load_tree (madara::knowledge::KnowledgeBase &kb, ForwardIterator begin, ForwardIterator end, uint64_t timestamp=-1, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT) |
Load ReferenceFrames, by ID, and their common ancestors. More... | |
template<typename Container > | |
static std::vector< ReferenceFrame > | load_tree (madara::knowledge::KnowledgeBase &kb, const Container &ids, uint64_t timestamp=-1, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT) |
Load ReferenceFrames, by ID, and their common ancestors. More... | |
Private Member Functions | |
bool | check_consistent () const |
Static Private Member Functions | |
template<typename T > | |
static uint64_t | init_timestamp (uint64_t given, const T &p) |
Private Attributes | |
std::shared_ptr< ReferenceFrameIdentity > | ident_ |
bool | interpolated_ = false |
Pose | origin_ |
uint64_t | timestamp_ = -1 |
const ReferenceFrameType * | type_ |
Friends | |
template<typename CoordType > | |
class | Coordinate |
New coordinate types which are frame-dependant can inherit from this class. More... | |
For internal use.
Use ReferenceFrame or FrameStore instead.
Represents a specific frame version; internal implementation of ReferenceFrame, behind a shared_ptr.
Definition at line 285 of file ReferenceFrame.h.
|
inlineexplicit |
Constructor from an origin, and optional timestamp.
Will be constructed with Cartesian type, and a random id.
a | Coordinate type convertible to Pose |
origin | the origin of this frame, relative to another frame. |
timestamp | the timestamp of this frame. By default, will be treated as "always most current". |
Definition at line 319 of file ReferenceFrame.h.
|
inline |
Constructor from a type, an origin, and optional timestamp.
Will be constructed with a random id.
a | Coordinate type convertible to Pose |
type | a pointer to a ReferenceFrameType struct; typically, either Cartesian, or GPS. |
origin | the origin of this frame, relative to another frame. |
timestamp | the timestamp of this frame. By default, will be treated as "always most current". |
Definition at line 340 of file ReferenceFrame.h.
|
inline |
Constructor from a id, an origin, and optional timestamp.
Will be constructed with Cartesian type.
a | Coordinate type convertible to Pose |
id | a string identifier for this frame. |
origin | the origin of this frame, relative to another frame. |
timestamp | the timestamp of this frame. By default, will be treated as "always most current". |
Definition at line 360 of file ReferenceFrame.h.
|
inline |
Constructor from a type, id, an origin, and optional timestamp.
a | Coordinate type convertible to Pose |
type | a pointer to a ReferenceFrameType struct; typically, either Cartesian, or GPS. |
id | a string identifier for this frame. |
origin | the origin of this frame, relative to another frame. |
timestamp | the timestamp of this frame. By default, will be treated as "always most current". |
Definition at line 382 of file ReferenceFrame.h.
|
inline |
Constructor from an existing ReferenceFrameIdentity, an origin, and optional timestamp.
Typical users should not use this constructor.
a | Coordinate type convertible to Pose |
ident | shared_ptr to a ReferenceFrameIdentity, which holds type and id information. |
id | a string identifier for this frame. |
origin | the origin of this frame, relative to another frame. |
timestamp | the timestamp of this frame. By default, will be treated as "always most current". |
Definition at line 406 of file ReferenceFrame.h.
|
private |
|
inlinestatic |
Definition at line 635 of file ReferenceFrame.h.
|
inline |
Does this frame have an ID? Frames gain an ID either at construction, or lazily as needed (by having the id() method, or save* methods called).
This method can be useful to prevent, e.g., logging code from incurring the overhead of generating an ID for an ephemeral frame.
Definition at line 594 of file ReferenceFrame.h.
|
inline |
Get the ID string of this frame.
Generates a random ID for this frame if it doesn't already have one. This ID will not change until this frame is destructed.
Definition at line 582 of file ReferenceFrame.h.
|
inline |
Get the ID string of this frame.
Will not generate an ID if this frame doesn't have one. In that case, returns nullptr.
Definition at line 605 of file ReferenceFrame.h.
|
inline |
Get the ReferenceFrameIdentity object associated with this frame, creating one with random ID if none exists.
Definition at line 420 of file ReferenceFrame.h.
|
inlinestaticprivate |
Definition at line 297 of file ReferenceFrame.h.
|
inline |
Interpolate a frame between the given frame; use the given parent.
Note: no sanity checking is done. Ensure that parent has a compatible timestamp, and that this and other are the same frame at different times.
other | the other frame to interpolate towards. |
parent | the parent the returned frame will have. |
time | the timestamp to interpolate at. |
Definition at line 900 of file ReferenceFrame.h.
|
inline |
Returns true if this frame was interpolated from two stored frames.
If this frame is itself stored, it will no longer be considered as interpolated.
Definition at line 631 of file ReferenceFrame.h.
|
inline |
Returns the key that save() will use to store this frame.
Definition at line 642 of file ReferenceFrame.h.
|
inlinestatic |
Get the latest available timestamp in the knowledge base common to all the given ids.
Will return -1 if no common timestamp is available.
kb | the knowledge base to search |
begin | iterator which derences to std::string |
end | ending iterator |
ForwardIterator | a ForwardIterator type such as std::vector::iterator |
Definition at line 747 of file ReferenceFrame.h.
|
inlinestatic |
Get the latest available timestamp in the knowledge base common to all the given ids.
Will return -1 if no common timestamp is available.
kb | the knowledge base to search |
container | container of std::string |
Container | a container type (such as std::vector) |
Definition at line 780 of file ReferenceFrame.h.
|
static |
Get the latest available timestamp in the knowledge base for the given id.
kb | the knowledge base to search |
id | the id to search for |
|
static |
Load a single ReferenceFrame, by ID and timestamp, interpolated if applicable.
id | the ID of the frame to load |
timestamp | if -1, gets the latest frame (no interpolation) Otherwise, gets the frame at a specified timestamp, interpolated necessary. |
|
static |
Load a single ReferenceFrame, by ID and timestamp.
Will not interpolate. Returns an invalid frame if none exists with given ID and timestamp.
id | the ID of the frame to load |
timestamp | of frame to load. -1 is matched exactly; it will only return a frame if one with that timestamp exists. |
parent_timsteamp | timestamp of parent to load. Parent is loaded using load() |
|
inlinestatic |
Load ReferenceFrames, by ID, and their common ancestors.
Will interpolate frames to ensure the returned frames all have a common timestamp.
a | ForwardIterator, of item type std::string |
begin | beginning iterator |
end | ending iterator |
timestamp | if -1, the latest possible tree will be returned. Otherwise, the specified timestamp will be returned. |
Definition at line 807 of file ReferenceFrame.h.
|
inlinestatic |
Load ReferenceFrames, by ID, and their common ancestors.
Will interpolate frames to ensure the returned frames all have a common timestamp.
a | Container, supporting cbegin() and cend(), of item type std::string |
ids | a Container of ids |
timestamp | if -1, the latest possible tree will be returned. Otherwise, the specified timestamp will be returned. |
Definition at line 854 of file ReferenceFrame.h.
|
inline |
Creates a new ReferenceFrame with modified origin.
new_origin | the new origin |
Definition at line 474 of file ReferenceFrame.h.
|
inline |
Creates a new ReferenceFrame with modified origin and timestamp.
new_origin | the new origin |
timestamp | the new timestamp |
Definition at line 507 of file ReferenceFrame.h.
|
inline |
Gets the origin of this Frame.
Definition at line 454 of file ReferenceFrame.h.
|
inline |
Returns a human-readable name for the reference frame type.
Definition at line 573 of file ReferenceFrame.h.
bool gams::pose::ReferenceFrameVersion::operator!= | ( | const ReferenceFrame & | other | ) | const |
Inequality operator.
other | the frame to compare to. |
bool gams::pose::ReferenceFrameVersion::operator!= | ( | const ReferenceFrameVersion & | other | ) | const |
Inequality operator.
other | the frame to compare to. |
bool gams::pose::ReferenceFrameVersion::operator== | ( | const ReferenceFrame & | other | ) | const |
Equality operator.
other | the frame to compare to. |
bool gams::pose::ReferenceFrameVersion::operator== | ( | const ReferenceFrameVersion & | other | ) | const |
Equality operator.
other | the frame to compare to. |
|
inline |
Creates a new ReferenceFrame with modified origin.
new_origin | the new origin |
Definition at line 484 of file ReferenceFrame.h.
|
inline |
Creates a new ReferenceFrame with modified origin and timestamp.
new_origin | the new origin |
timestamp | the new timestamp |
Definition at line 519 of file ReferenceFrame.h.
|
inline |
Gets the origin of this Frame.
Definition at line 443 of file ReferenceFrame.h.
|
inline |
Gets the parent frame (the one the origin is within).
Will be *this if no parent frame.
Definition at line 528 of file ReferenceFrame.h.
|
inline |
Creates a new ReferenceFrame with modified origin.
new_origin | the new origin |
Definition at line 464 of file ReferenceFrame.h.
|
inline |
Creates a new ReferenceFrame with modified origin and timestamp.
new_origin | the new origin |
timestamp | the new timestamp |
Definition at line 495 of file ReferenceFrame.h.
|
inline |
Save this ReferenceFrame to the knowledge base, The saved frames will be marked with their timestamp for later retrieval.
If timestamp is -1, it will always be treated as the most recent frame.
kb | the KnowledgeBase to store into |
expiry | use this expiry time instead of the one set on this ID |
Definition at line 657 of file ReferenceFrame.h.
|
inline |
Save this ReferenceFrame to the knowledge base, The saved frames will be marked with their timestamp for later retrieval.
If timestamp is -1, it will always be treated as the most recent frame.
kb | the KnowledgeBase to store into |
Definition at line 672 of file ReferenceFrame.h.
void gams::pose::ReferenceFrameVersion::save_as | ( | madara::knowledge::KnowledgeBase & | kb, |
std::string | key, | ||
uint64_t | expiry, | ||
const FrameEvalSettings & | settings = FrameEvalSettings::DEFAULT |
||
) | const |
Save this ReferenceFrame to the knowledge base, with a specific key value.
kb | the KnowledgeBase to save to |
key | a key prefix to save with |
expiry | use this expiry time instead of the one set on this ID |
|
inline |
Save this ReferenceFrame to the knowledge base, with a specific key value.
kb | the KnowledgeBase to save to |
key | a key prefix to save with |
Definition at line 882 of file ReferenceFrame.h.
|
inline |
Get the timestamp assigned to this frame.
Definition at line 612 of file ReferenceFrame.h.
|
inline |
Clone the this frame, but with new timestamp.
Definition at line 621 of file ReferenceFrame.h.
|
inline |
Retrieve the frame type object for this frame.
Mostly useful for comparing to the pose::Cartesian or pose::GPS instances to test what kind of frame this is.
Definition at line 434 of file ReferenceFrame.h.
|
friend |
New coordinate types which are frame-dependant can inherit from this class.
Pass the type of the child class as CoordType
New coordinate types must: – Inherit from Coordinate, and pass itself as template parameter – Inherit from a base class which does not inherit from Coordinate – That base class must: – Have a typedef BaseType which refers to itself – Implement operator== – Implement the following methods: static std::string name() // return the type's name static int size() // return # of values in representation double get(int i) const // return ith value of representation bool operator==(const BaseType &rhs) const BaseType &as_vec() // return *this const BaseType &as_vec() const // return *this
Additionally, new coordinate types should either: – Specialize the ReferenceFrame::*_within_frame templates; OR – Add new overloads for transform_to_origin, transform_from_origin, do_normalize, and calc_distance virtual methods in ReferenceFrame, and add transformation logic for those methods in the various frames
Definition at line 940 of file ReferenceFrame.h.
|
mutableprivate |
Definition at line 289 of file ReferenceFrame.h.
|
mutableprivate |
Definition at line 293 of file ReferenceFrame.h.
|
private |
Definition at line 292 of file ReferenceFrame.h.
|
private |
Definition at line 291 of file ReferenceFrame.h.
|
private |
Definition at line 290 of file ReferenceFrame.h.