GAMS
1.4.0
|
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 (const ReferenceFrameType *type, P &&origin, uint64_t timestamp=ETERNAL, bool temp=false) | |
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 (const ReferenceFrameType *type, std::string name, P &&origin, uint64_t timestamp=ETERNAL, bool temp=false) | |
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 (P &&origin, uint64_t timestamp=ETERNAL, bool temp=false) | |
Constructor from 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=ETERNAL, bool temp=false) | |
Constructor from an existing ReferenceFrameIdentity, 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, P &&origin, uint64_t timestamp=ETERNAL, bool temp=false) | |
Constructor from an existing ReferenceFrameIdentity, 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=ETERNAL, bool temp=false) | |
Constructor from a id, 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 (const Position &new_origin, uint64_t timestamp) const |
Creates a new ReferenceFrame with modified origin and timestamp. More... | |
ReferenceFrame | move (Position new_origin) const |
Creates a new ReferenceFrame with modified origin. 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 (const Orientation &new_origin, uint64_t timestamp) const |
Creates a new ReferenceFrame with modified origin and timestamp. More... | |
ReferenceFrame | orient (Orientation new_origin) const |
Creates a new ReferenceFrame with modified origin. 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 (const Pose &new_origin, uint64_t timestamp) const |
Creates a new ReferenceFrame with modified origin and timestamp. More... | |
ReferenceFrame | pose (Pose new_origin) const |
Creates a new ReferenceFrame with modified origin. 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 (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_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... | |
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... | |
bool | temp () const |
Returns true if this frame is a temporary; one invented to serve as root of a frame tree. 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 bool | check_is_connected (const std::vector< ReferenceFrame > &frames) |
static const std::string & | default_prefix () |
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... | |
template<typename InputIterator > | |
static uint64_t | latest_common_timestamp (madara::knowledge::KnowledgeBase &kb, InputIterator begin, InputIterator end, 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=ETERNAL, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT, bool throw_on_errors=true, ReferenceFrameArena *arena=nullptr) |
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=ETERNAL, uint64_t parent_timestamp=ETERNAL, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT, bool throw_on_errors=true, ReferenceFrameArena *arena=nullptr) |
Load a single ReferenceFrame, by ID and timestamp. More... | |
template<typename Container > | |
static std::vector< ReferenceFrame > | load_tree (madara::knowledge::KnowledgeBase &kb, const Container &ids, uint64_t timestamp=ETERNAL, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT, ReferenceFrameArena *arena=nullptr) |
Load ReferenceFrames, by ID, and their common ancestors. More... | |
template<typename ForwardIterator > | |
static std::vector< ReferenceFrame > | load_tree (madara::knowledge::KnowledgeBase &kb, ForwardIterator begin, ForwardIterator end, uint64_t timestamp=ETERNAL, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT, ReferenceFrameArena *arena=nullptr) |
Load ReferenceFrames, by ID, and their common ancestors. More... | |
static void | throw_if_not_connected (const std::vector< ReferenceFrame > &frames) |
Static Public Attributes | |
static const uint64_t | ETERNAL = ReferenceFrameIdentity::ETERNAL |
static const uint64_t | TEMP = ReferenceFrameIdentity::TEMP |
Private Types | |
using | ancestor_elem = std::pair< std::string, uint64_t > |
using | ancestor_vec = std::vector< ancestor_elem > |
Private Member Functions | |
bool | check_consistent () const |
Static Private Member Functions | |
static uint64_t | find_common_timestamp_to_first_ancestor (const std::vector< ancestor_vec > &stamps) |
static std::pair< uint64_t, uint64_t > | find_nearest_neighbors (madara::knowledge::KnowledgeBase &kb, const std::string &id, uint64_t timestamp, const FrameEvalSettings &settings) |
static ancestor_vec | get_ancestry (madara::knowledge::KnowledgeBase &kb, std::string name, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT) |
template<typename T > | |
static uint64_t | init_timestamp (uint64_t given, const T &p) |
static ReferenceFrame | load_exact_internal (madara::knowledge::KnowledgeBase &kb, const std::string &id, uint64_t timestamp=ETERNAL, uint64_t parent_timestamp=ETERNAL, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT, bool throw_on_errors=true, ReferenceFrameArena *arena=nullptr) |
Load a single ReferenceFrame, by ID and timestamp. More... | |
Private Attributes | |
std::shared_ptr< ReferenceFrameIdentity > | ident_ |
bool | interpolated_ = false |
Pose | origin_ |
bool | temp_ = false |
uint64_t | timestamp_ = ETERNAL |
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 335 of file ReferenceFrame.h.
|
private |
Definition at line 853 of file ReferenceFrame.h.
|
private |
Definition at line 854 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 373 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 395 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 416 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 439 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 464 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 491 of file ReferenceFrame.h.
|
private |
|
static |
|
inlinestatic |
Definition at line 726 of file ReferenceFrame.h.
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
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 677 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 665 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 688 of file ReferenceFrame.h.
|
inline |
Get the ReferenceFrameIdentity object associated with this frame, creating one with random ID if none exists.
Definition at line 503 of file ReferenceFrame.h.
|
inlinestaticprivate |
Definition at line 348 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 1071 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 714 of file ReferenceFrame.h.
|
inline |
Returns the key that save() will use to store this frame.
Definition at line 733 of file ReferenceFrame.h.
|
inlinestatic |
Get the latest available timestamp in the knowledge base common to all the given ids.
Will return ETERNAL 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 935 of file ReferenceFrame.h.
|
inlinestatic |
Get the latest available timestamp in the knowledge base common to all the given ids.
Will return ETERNAL if no common timestamp is available.
kb | the knowledge base to search |
begin | iterator which dereferences to std::string |
end | ending iterator |
InputIterator | an InputIterator type, such as std::vector::iterator |
Definition at line 883 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 ETERNAL, 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. ETERNAL 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() |
|
staticprivate |
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. ETERNAL 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 | Container, supporting cbegin() and cend(), of item type std::string |
ids | a Container of ids |
timestamp | if ETERNAL, the latest possible tree will be returned. Otherwise, the specified timestamp will be returned. |
Definition at line 1025 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 | ForwardIterator, of item type std::string |
begin | beginning iterator |
end | ending iterator |
timestamp | if ETERNAL, the latest possible tree will be returned. Otherwise, the specified timestamp will be returned. |
Definition at line 963 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 590 of file ReferenceFrame.h.
|
inline |
Creates a new ReferenceFrame with modified origin.
new_origin | the new origin |
Definition at line 557 of file ReferenceFrame.h.
|
inline |
Gets the origin of this Frame.
Definition at line 537 of file ReferenceFrame.h.
|
inline |
Returns a human-readable name for the reference frame type.
Definition at line 656 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 and timestamp.
new_origin | the new origin |
timestamp | the new timestamp |
Definition at line 602 of file ReferenceFrame.h.
|
inline |
Creates a new ReferenceFrame with modified origin.
new_origin | the new origin |
Definition at line 567 of file ReferenceFrame.h.
|
inline |
Gets the origin of this Frame.
Definition at line 526 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 611 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 578 of file ReferenceFrame.h.
|
inline |
Creates a new ReferenceFrame with modified origin.
new_origin | the new origin |
Definition at line 547 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 ETERNAL, it will always be treated as the most recent frame.
kb | the KnowledgeBase to store into |
Definition at line 763 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 ETERNAL, 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 748 of file ReferenceFrame.h.
|
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 1053 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 |
Returns true if this frame is a temporary; one invented to serve as root of a frame tree.
Definition at line 722 of file ReferenceFrame.h.
|
static |
|
inline |
Get the timestamp assigned to this frame.
Definition at line 695 of file ReferenceFrame.h.
|
inline |
Clone the this frame, but with new timestamp.
Definition at line 704 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 517 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 1111 of file ReferenceFrame.h.
|
static |
Definition at line 358 of file ReferenceFrame.h.
|
mutableprivate |
Definition at line 339 of file ReferenceFrame.h.
|
mutableprivate |
Definition at line 343 of file ReferenceFrame.h.
|
private |
Definition at line 342 of file ReferenceFrame.h.
|
static |
Definition at line 359 of file ReferenceFrame.h.
|
private |
Definition at line 344 of file ReferenceFrame.h.
|
private |
Definition at line 341 of file ReferenceFrame.h.
|
private |
Definition at line 340 of file ReferenceFrame.h.