GAMS
1.4.0
|
Provides Reference Frame (i.e., coordinate systemm) transforms. More...
#include <ReferenceFrameFwd.h>
Public Member Functions | |
ReferenceFrame () | |
Default constructor. More... | |
template<typename P , typename std::enable_if< supports_transform_to< P >::value, void * >::type = nullptr> | |
ReferenceFrame (const ReferenceFrameType *type, P &&origin, uint64_t timestamp=ETERNAL) | |
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> | |
ReferenceFrame (const ReferenceFrameType *type, std::string id, P &&origin, uint64_t timestamp=ETERNAL) | |
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> | |
ReferenceFrame (P &&origin, uint64_t timestamp=ETERNAL) | |
Constructor from an origin, and optional timestamp. More... | |
ReferenceFrame (std::shared_ptr< ReferenceFrameVersion > impl) | |
Construct from an existing ReferenceFrameVersion object. More... | |
template<typename P , typename std::enable_if< supports_transform_to< P >::value, void * >::type = nullptr> | |
ReferenceFrame (std::string id, P &&origin, uint64_t timestamp=ETERNAL) | |
Constructor from a id, an origin, and optional timestamp. More... | |
uint64_t | expiry () const |
Return the current expiry for frames of this ID. More... | |
uint64_t | expiry (uint64_t age=ETERNAL) const |
Sets configuration for all frames of this frames ID. More... | |
const std::string & | id () const |
Get the ID string of this frame. 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 |
Test if frame is interpolated. More... | |
ReferenceFrame | move (const 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... | |
std::string | 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 ReferenceFrame &other) const |
bool | operator<= (const ReferenceFrame &other) const |
bool | operator== (const ReferenceFrame &other) const |
Equality operator. More... | |
bool | operator> (const ReferenceFrame &other) const |
bool | operator>= (const ReferenceFrame &other) const |
ReferenceFrame | orient (const 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 (const 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, 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, const 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, const 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) const |
Clone the this frame, but with new timestamp. More... | |
const ReferenceFrameType * | type () const |
Retrieve the frame type object for this frame. More... | |
bool | valid () const |
Test whether this frame is valid. More... | |
Static Public Member Functions | |
static uint64_t | default_expiry () |
Return the default expiry for new frame IDs. More... | |
static uint64_t | default_expiry (uint64_t age) |
Set the default expiry value for new frames IDs. More... | |
static const std::string & | default_prefix () |
Return the default prefix for load/save operations. More... | |
static ReferenceFrame | load (madara::knowledge::KnowledgeBase &kb, const std::string &id, uint64_t timestamp=ETERNAL, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT) |
Load a single ReferenceFrame, by ID. 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... | |
static std::vector< ReferenceFrame > | load_tree (madara::knowledge::KnowledgeBase &kb, const std::initializer_list< const char * > &ids, uint64_t timestamp=ETERNAL, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT, ReferenceFrameArena *arena=nullptr) |
Load ReferenceFrames, by ID, and their common ancestors. More... | |
template<typename InputIterator > | |
static std::vector< ReferenceFrame > | load_tree (madara::knowledge::KnowledgeBase &kb, InputIterator begin, InputIterator end, uint64_t timestamp=ETERNAL, const FrameEvalSettings &settings=FrameEvalSettings::DEFAULT, ReferenceFrameArena *arena=nullptr) |
Load ReferenceFrames, by ID, and their common ancestors. More... | |
Static Public Attributes | |
static const uint64_t | ETERNAL = 0UL - 1 |
static const uint64_t | TEMP = 0UL - 2 |
Private Attributes | |
std::shared_ptr< ReferenceFrameVersion > | impl_ |
Friends | |
GAMS_EXPORT const ReferenceFrame * | find_common_frame (const ReferenceFrame *from, const ReferenceFrame *to, std::vector< const ReferenceFrame * > *to_stack) |
Helper function to find the common frame between two frames. More... | |
class | ReferenceFrameVersion |
Provides Reference Frame (i.e., coordinate systemm) transforms.
A ReferenceFrame has:
ReferenceFrame objects are immutable. "Setters" like timestamp() and pose() return a new ReferenceFrame object modified accordingly.
If you use gps_frame() or default_frame(), and wish to save any frames which involve them as ancestors, ensure you save them to any KnowledgeBase you will be saving such frames to.
ReferenceFrames get saved to KnowledgeBases under the ".gams.frames" prefix. Do not modify keys under this prefix directly.
ReferenceFrame objects are ref-counted proxies for an underlying object. As such, they are cheap and safe to pass and return by value.
Definition at line 198 of file ReferenceFrameFwd.h.
|
inline |
Default constructor.
This frame's valid() will return false. Calling any other method is undefined behavior.
If a frame has a Pose as origin with an invalid frame, it will be treated as a parent-less frame.
Definition at line 214 of file ReferenceFrameFwd.h.
|
inline |
Construct from an existing ReferenceFrameVersion object.
In general, you should not be constructing ReferenceFrameVersion objects directly. Use the other constructors of this class.
impl | a shared_ptr to construct with. This object will act as a proxy for the pointed-to object. |
Definition at line 224 of file ReferenceFrameFwd.h.
|
inlineexplicit |
Constructor from an origin, and optional timestamp.
Will be constructed with Cartesian type, and a random id.
P | a Pose or StampedPose |
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 239 of file ReferenceFrameFwd.h.
|
inline |
Constructor from a type, an origin, and optional timestamp.
Will be constructed with a random id.
P | a Pose or StampedPose |
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 259 of file ReferenceFrameFwd.h.
|
inline |
Constructor from a id, an origin, and optional timestamp.
Will be constructed with Cartesian type.
P | a Pose or StampedPose |
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 279 of file ReferenceFrameFwd.h.
|
inline |
Constructor from a type, id, an origin, and optional timestamp.
P | a Pose or StampedPose |
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 300 of file ReferenceFrameFwd.h.
|
static |
Return the default expiry for new frame IDs.
|
static |
Set the default expiry value for new frames IDs.
Setting this will not change any already created frame IDs.
If a frame newer than its expiry is saved, saved frames expire of the same ID older than this duration into the past from the timestamp of the new frame.
Expired frames are deleted from the KnowledgeBase.
Set to ETERNAL (the default) to never expire frames.
Note: if a timestamp ETERNAL frame is saved and this is not ETERNAL, all other frames will expire immediately.
|
static |
Return the default prefix for load/save operations.
uint64_t gams::pose::ReferenceFrame::expiry | ( | ) | const |
Return the current expiry for frames of this ID.
uint64_t gams::pose::ReferenceFrame::expiry | ( | uint64_t | age = ETERNAL | ) | const |
Sets configuration for all frames of this frames ID.
If a frame newer than this time is saved, expire saved frames of the same ID older than this duration into the past from the timestamp of the new frame.
Expired frames are deleted from the KnowledgeBase.
Set to ETERNAL (the default) to never expire frames.
Note: if a timestamp ETERNAL frame is saved and this is not ETERNAL, all other frames will expire immediately.
const std::string& gams::pose::ReferenceFrame::id | ( | ) | const |
Get the ID string of this frame.
By default, frames generate a random GUID as their ID
ReferenceFrame gams::pose::ReferenceFrame::interpolate | ( | const ReferenceFrame & | other, |
ReferenceFrame | parent, | ||
uint64_t | time | ||
) | const |
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. Users should generally not call this directly. Use load() or load_tree() instead.
other | the other frame to interpolate towards. |
parent | the parent the returned frame will have. |
time | the timestamp to interpolate at. |
bool gams::pose::ReferenceFrame::interpolated | ( | ) | const |
Test if frame is interpolated.
@eturn true if this frame was interpolated from two stored frames, false otherwise
|
static |
Load a single ReferenceFrame, by ID.
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 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. |
|
static |
Load ReferenceFrames, by ID, and their common ancestors.
Will interpolate frames to ensure the returned frames all have a common timestamp.
ids | a list of ids |
timestamp | if ETERNAL, the latest possible tree will be returned. Otherwise, the specified timestamp will be returned. |
|
static |
Load ReferenceFrames, by ID, and their common ancestors.
Will interpolate frames to ensure the returned frames all have a common timestamp.
an | InputIterator, 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. |
ReferenceFrame gams::pose::ReferenceFrame::move | ( | const Position & | new_origin | ) | const |
Creates a new ReferenceFrame with modified origin.
new_origin | the new origin |
ReferenceFrame gams::pose::ReferenceFrame::move | ( | const Position & | new_origin, |
uint64_t | timestamp | ||
) | const |
Creates a new ReferenceFrame with modified origin and timestamp.
new_origin | the new origin |
timestamp | the new timestamp |
std::string gams::pose::ReferenceFrame::name | ( | ) | const |
Returns a human-readable name for the reference frame type.
bool gams::pose::ReferenceFrame::operator!= | ( | const ReferenceFrame & | other | ) | const |
Inequality operator.
other | the frame to compare to. |
|
inline |
Definition at line 400 of file ReferenceFrameFwd.h.
|
inline |
Definition at line 405 of file ReferenceFrameFwd.h.
bool gams::pose::ReferenceFrame::operator== | ( | const ReferenceFrame & | other | ) | const |
Equality operator.
other | the frame to compare to. |
|
inline |
Definition at line 410 of file ReferenceFrameFwd.h.
|
inline |
Definition at line 415 of file ReferenceFrameFwd.h.
ReferenceFrame gams::pose::ReferenceFrame::orient | ( | const Orientation & | new_origin | ) | const |
Creates a new ReferenceFrame with modified origin.
new_origin | the new origin |
ReferenceFrame gams::pose::ReferenceFrame::orient | ( | const Orientation & | new_origin, |
uint64_t | timestamp | ||
) | const |
Creates a new ReferenceFrame with modified origin and timestamp.
new_origin | the new origin |
timestamp | the new timestamp |
const Pose& gams::pose::ReferenceFrame::origin | ( | ) | const |
ReferenceFrame gams::pose::ReferenceFrame::origin_frame | ( | ) | const |
Gets the parent frame (the one the origin is within).
Will be *this if no parent frame.
ReferenceFrame gams::pose::ReferenceFrame::pose | ( | const Pose & | new_origin | ) | const |
Creates a new ReferenceFrame with modified origin.
new_origin | the new origin |
ReferenceFrame gams::pose::ReferenceFrame::pose | ( | const Pose & | new_origin, |
uint64_t | timestamp | ||
) | const |
Creates a new ReferenceFrame with modified origin and timestamp.
new_origin | the new origin |
timestamp | the new timestamp |
void gams::pose::ReferenceFrame::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.
If timestamp is ETERNAL, it will always be treated as the most recent frame.
kb | the KnowledgeBase to store into |
void gams::pose::ReferenceFrame::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.
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 |
void gams::pose::ReferenceFrame::save_as | ( | madara::knowledge::KnowledgeBase & | kb, |
const std::string & | key, | ||
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 |
void gams::pose::ReferenceFrame::save_as | ( | madara::knowledge::KnowledgeBase & | kb, |
const 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 |
bool gams::pose::ReferenceFrame::temp | ( | ) | const |
Returns true if this frame is a temporary; one invented to serve as root of a frame tree.
uint64_t gams::pose::ReferenceFrame::timestamp | ( | ) | const |
Get the timestamp assigned to this frame.
ReferenceFrame gams::pose::ReferenceFrame::timestamp | ( | uint64_t | ) | const |
Clone the this frame, but with new timestamp.
const ReferenceFrameType* gams::pose::ReferenceFrame::type | ( | ) | const |
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.
|
inline |
Test whether this frame is valid.
If not, all other methods will have undefined behavior.
Definition at line 314 of file ReferenceFrameFwd.h.
|
friend |
Helper function to find the common frame between two frames.
from | the initial frame |
to | the target frame |
to_stack | if not nullptr, the frames needed to go from base to target frame will be pushed to pointed to vector |
|
friend |
Definition at line 666 of file ReferenceFrameFwd.h.
|
static |
Definition at line 204 of file ReferenceFrameFwd.h.
|
private |
Definition at line 201 of file ReferenceFrameFwd.h.
|
static |
Definition at line 205 of file ReferenceFrameFwd.h.