GAMS  1.4.0
gams::pose::ReferenceFrameVersion Class Reference

For internal use. More...

#include <ReferenceFrame.h>

Inheritance diagram for gams::pose::ReferenceFrameVersion:

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 ReferenceFrameIdentityident () 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...
 
Posemut_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 Poseorigin () 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 ReferenceFrameTypetype () 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< ReferenceFrameload_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< ReferenceFrameload_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< ReferenceFrameIdentityident_
 
bool interpolated_ = false
 
Pose origin_
 
bool temp_ = false
 
uint64_t timestamp_ = ETERNAL
 
const ReferenceFrameTypetype_
 

Friends

template<typename CoordType >
class Coordinate
 New coordinate types which are frame-dependant can inherit from this class. More...
 

Detailed Description

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.

Member Typedef Documentation

◆ ancestor_elem

using gams::pose::ReferenceFrameVersion::ancestor_elem = std::pair<std::string, uint64_t>
private

Definition at line 853 of file ReferenceFrame.h.

◆ ancestor_vec

Definition at line 854 of file ReferenceFrame.h.

Constructor & Destructor Documentation

◆ ReferenceFrameVersion() [1/6]

template<typename P , typename std::enable_if< supports_transform_to< P >::value, void * >::type = nullptr>
gams::pose::ReferenceFrameVersion::ReferenceFrameVersion ( P &&  origin,
uint64_t  timestamp = ETERNAL,
bool  temp = false 
)
inlineexplicit

Constructor from an origin, and optional timestamp.

Will be constructed with Cartesian type, and a random id.

Template Parameters
aCoordinate type convertible to Pose
Parameters
originthe origin of this frame, relative to another frame.
timestampthe timestamp of this frame. By default, will be treated as "always most current".

Definition at line 373 of file ReferenceFrame.h.

◆ ReferenceFrameVersion() [2/6]

template<typename P , typename std::enable_if< supports_transform_to< P >::value, void * >::type = nullptr>
gams::pose::ReferenceFrameVersion::ReferenceFrameVersion ( const ReferenceFrameType type,
P &&  origin,
uint64_t  timestamp = ETERNAL,
bool  temp = false 
)
inline

Constructor from a type, an origin, and optional timestamp.

Will be constructed with a random id.

Template Parameters
aCoordinate type convertible to Pose
Parameters
typea pointer to a ReferenceFrameType struct; typically, either Cartesian, or GPS.
originthe origin of this frame, relative to another frame.
timestampthe timestamp of this frame. By default, will be treated as "always most current".

Definition at line 395 of file ReferenceFrame.h.

◆ ReferenceFrameVersion() [3/6]

template<typename P , typename std::enable_if< supports_transform_to< P >::value, void * >::type = nullptr>
gams::pose::ReferenceFrameVersion::ReferenceFrameVersion ( std::string  name,
P &&  origin,
uint64_t  timestamp = ETERNAL,
bool  temp = false 
)
inline

Constructor from a id, an origin, and optional timestamp.

Will be constructed with Cartesian type.

Template Parameters
aCoordinate type convertible to Pose
Parameters
ida string identifier for this frame.
originthe origin of this frame, relative to another frame.
timestampthe timestamp of this frame. By default, will be treated as "always most current".

Definition at line 416 of file ReferenceFrame.h.

◆ ReferenceFrameVersion() [4/6]

template<typename P , typename std::enable_if< supports_transform_to< P >::value, void * >::type = nullptr>
gams::pose::ReferenceFrameVersion::ReferenceFrameVersion ( const ReferenceFrameType type,
std::string  name,
P &&  origin,
uint64_t  timestamp = ETERNAL,
bool  temp = false 
)
inline

Constructor from a type, id, an origin, and optional timestamp.

Template Parameters
aCoordinate type convertible to Pose
Parameters
typea pointer to a ReferenceFrameType struct; typically, either Cartesian, or GPS.
ida string identifier for this frame.
originthe origin of this frame, relative to another frame.
timestampthe timestamp of this frame. By default, will be treated as "always most current".

Definition at line 439 of file ReferenceFrame.h.

◆ ReferenceFrameVersion() [5/6]

template<typename P , typename std::enable_if< supports_transform_to< P >::value, void * >::type = nullptr>
gams::pose::ReferenceFrameVersion::ReferenceFrameVersion ( std::shared_ptr< ReferenceFrameIdentity ident,
const ReferenceFrameType type,
P &&  origin,
uint64_t  timestamp = ETERNAL,
bool  temp = false 
)
inline

Constructor from an existing ReferenceFrameIdentity, an origin, and optional timestamp.

Typical users should not use this constructor.

Template Parameters
aCoordinate type convertible to Pose
Parameters
identshared_ptr to a ReferenceFrameIdentity, which holds type and id information.
ida string identifier for this frame.
originthe origin of this frame, relative to another frame.
timestampthe timestamp of this frame. By default, will be treated as "always most current".

Definition at line 464 of file ReferenceFrame.h.

◆ ReferenceFrameVersion() [6/6]

template<typename P , typename std::enable_if< supports_transform_to< P >::value, void * >::type = nullptr>
gams::pose::ReferenceFrameVersion::ReferenceFrameVersion ( std::shared_ptr< ReferenceFrameIdentity ident,
P &&  origin,
uint64_t  timestamp = ETERNAL,
bool  temp = false 
)
inline

Constructor from an existing ReferenceFrameIdentity, an origin, and optional timestamp.

Typical users should not use this constructor.

Template Parameters
aCoordinate type convertible to Pose
Parameters
identshared_ptr to a ReferenceFrameIdentity, which holds type and id information.
ida string identifier for this frame.
originthe origin of this frame, relative to another frame.
timestampthe timestamp of this frame. By default, will be treated as "always most current".

Definition at line 491 of file ReferenceFrame.h.

Member Function Documentation

◆ check_consistent()

bool gams::pose::ReferenceFrameVersion::check_consistent ( ) const
private

◆ check_is_connected()

static bool gams::pose::ReferenceFrameVersion::check_is_connected ( const std::vector< ReferenceFrame > &  frames)
static

◆ default_prefix()

static const std::string& gams::pose::ReferenceFrameVersion::default_prefix ( )
inlinestatic

Definition at line 726 of file ReferenceFrame.h.

◆ find_common_timestamp_to_first_ancestor()

static uint64_t gams::pose::ReferenceFrameVersion::find_common_timestamp_to_first_ancestor ( const std::vector< ancestor_vec > &  stamps)
staticprivate

◆ find_nearest_neighbors()

static std::pair<uint64_t, uint64_t> gams::pose::ReferenceFrameVersion::find_nearest_neighbors ( madara::knowledge::KnowledgeBase &  kb,
const std::string &  id,
uint64_t  timestamp,
const FrameEvalSettings settings 
)
staticprivate

◆ get_ancestry()

static ancestor_vec gams::pose::ReferenceFrameVersion::get_ancestry ( madara::knowledge::KnowledgeBase &  kb,
std::string  name,
const FrameEvalSettings settings = FrameEvalSettings::DEFAULT 
)
staticprivate

◆ has_id()

bool gams::pose::ReferenceFrameVersion::has_id ( ) const
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.

Returns
true if this frame already has an ID, false if not

Definition at line 677 of file ReferenceFrame.h.

◆ id()

const std::string& gams::pose::ReferenceFrameVersion::id ( ) const
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.

◆ id_ptr()

const std::string* gams::pose::ReferenceFrameVersion::id_ptr ( ) const
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.

Returns
nullptr has_id() is false; otherwise, a pointer to the result of id()

Definition at line 688 of file ReferenceFrame.h.

◆ ident()

const ReferenceFrameIdentity& gams::pose::ReferenceFrameVersion::ident ( ) const
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.

◆ init_timestamp()

template<typename T >
static uint64_t gams::pose::ReferenceFrameVersion::init_timestamp ( uint64_t  given,
const T &  p 
)
inlinestaticprivate

Definition at line 348 of file ReferenceFrame.h.

◆ interpolate()

ReferenceFrame gams::pose::ReferenceFrameVersion::interpolate ( const ReferenceFrame other,
ReferenceFrame  parent,
uint64_t  time 
) const
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.

Parameters
otherthe other frame to interpolate towards.
parentthe parent the returned frame will have.
timethe timestamp to interpolate at.
Returns
the interpolated frame.

Definition at line 1071 of file ReferenceFrame.h.

◆ interpolated()

bool gams::pose::ReferenceFrameVersion::interpolated ( ) const
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.

◆ key()

std::string gams::pose::ReferenceFrameVersion::key ( const FrameEvalSettings settings = FrameEvalSettings::DEFAULT) const
inline

Returns the key that save() will use to store this frame.

Definition at line 733 of file ReferenceFrame.h.

◆ latest_common_timestamp() [1/2]

template<typename Container >
static uint64_t gams::pose::ReferenceFrameVersion::latest_common_timestamp ( madara::knowledge::KnowledgeBase &  kb,
const Container &  ids,
const FrameEvalSettings settings = FrameEvalSettings::DEFAULT 
)
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.

Parameters
kbthe knowledge base to search
containercontainer of std::string
Template Parameters
Containera container type (such as std::vector)
Returns
the latest timestamp for the id in kb. If timestamp ETERNAL is available, that will be returned.

Definition at line 935 of file ReferenceFrame.h.

◆ latest_common_timestamp() [2/2]

template<typename InputIterator >
static uint64_t gams::pose::ReferenceFrameVersion::latest_common_timestamp ( madara::knowledge::KnowledgeBase &  kb,
InputIterator  begin,
InputIterator  end,
const FrameEvalSettings settings = FrameEvalSettings::DEFAULT 
)
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.

Parameters
kbthe knowledge base to search
beginiterator which dereferences to std::string
endending iterator
Template Parameters
InputIteratoran InputIterator type, such as std::vector::iterator
Returns
the latest timestamp for the id in kb. If timestamp ETERNAL is available, that will be returned.

Definition at line 883 of file ReferenceFrame.h.

◆ latest_timestamp()

static uint64_t gams::pose::ReferenceFrameVersion::latest_timestamp ( madara::knowledge::KnowledgeBase &  kb,
const std::string &  id,
const FrameEvalSettings settings = FrameEvalSettings::DEFAULT 
)
static

Get the latest available timestamp in the knowledge base for the given id.

Parameters
kbthe knowledge base to search
idthe id to search for
Returns
the latest timestamp for the id in kb. If timestamp ETERNAL is available, that will be returned.

◆ load()

static ReferenceFrame gams::pose::ReferenceFrameVersion::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 
)
static

Load a single ReferenceFrame, by ID and timestamp, interpolated if applicable.

Parameters
idthe ID of the frame to load
timestampif ETERNAL, gets the latest frame (no interpolation) Otherwise, gets the frame at a specified timestamp, interpolated necessary.
Returns
the loaded ReferenceFrame, or an invalid frame if none exists.

◆ load_exact()

static ReferenceFrame gams::pose::ReferenceFrameVersion::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 
)
static

Load a single ReferenceFrame, by ID and timestamp.

Will not interpolate. Returns an invalid frame if none exists with given ID and timestamp.

Parameters
idthe ID of the frame to load
timestampof frame to load. ETERNAL is matched exactly; it will only return a frame if one with that timestamp exists.
parent_timsteamptimestamp of parent to load. Parent is loaded using load()
Returns
the loaded ReferenceFrame, or an invalid frame if none exists.

◆ load_exact_internal()

static ReferenceFrame gams::pose::ReferenceFrameVersion::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 
)
staticprivate

Load a single ReferenceFrame, by ID and timestamp.

Will not interpolate. Returns an invalid frame if none exists with given ID and timestamp.

Parameters
idthe ID of the frame to load
timestampof frame to load. ETERNAL is matched exactly; it will only return a frame if one with that timestamp exists.
parent_timsteamptimestamp of parent to load. Parent is loaded using load()
Returns
the loaded ReferenceFrame, or an invalid frame if none exists.

◆ load_tree() [1/2]

template<typename Container >
static std::vector<ReferenceFrame> gams::pose::ReferenceFrameVersion::load_tree ( madara::knowledge::KnowledgeBase &  kb,
const Container &  ids,
uint64_t  timestamp = ETERNAL,
const FrameEvalSettings settings = FrameEvalSettings::DEFAULT,
ReferenceFrameArena arena = nullptr 
)
inlinestatic

Load ReferenceFrames, by ID, and their common ancestors.

Will interpolate frames to ensure the returned frames all have a common timestamp.

Template Parameters
aContainer, supporting cbegin() and cend(), of item type std::string
Parameters
idsa Container of ids
timestampif ETERNAL, the latest possible tree will be returned. Otherwise, the specified timestamp will be returned.
Returns
a vector of ReferenceFrames, each corresponding to the input IDs, in the same order. If the timestamp specified cannot be satisfied, returns an empty vector.

Definition at line 1025 of file ReferenceFrame.h.

◆ load_tree() [2/2]

template<typename ForwardIterator >
static std::vector<ReferenceFrame> gams::pose::ReferenceFrameVersion::load_tree ( madara::knowledge::KnowledgeBase &  kb,
ForwardIterator  begin,
ForwardIterator  end,
uint64_t  timestamp = ETERNAL,
const FrameEvalSettings settings = FrameEvalSettings::DEFAULT,
ReferenceFrameArena arena = nullptr 
)
inlinestatic

Load ReferenceFrames, by ID, and their common ancestors.

Will interpolate frames to ensure the returned frames all have a common timestamp.

Template Parameters
aForwardIterator, of item type std::string
Parameters
beginbeginning iterator
endending iterator
timestampif ETERNAL, the latest possible tree will be returned. Otherwise, the specified timestamp will be returned.
Returns
a vector of ReferenceFrames, each corresponding to the input IDs, in the same order. If the timestamp specified cannot be satisfied, returns an empty vector.

Definition at line 963 of file ReferenceFrame.h.

◆ move() [1/2]

ReferenceFrame gams::pose::ReferenceFrameVersion::move ( const Position new_origin,
uint64_t  timestamp 
) const
inline

Creates a new ReferenceFrame with modified origin and timestamp.

Parameters
new_originthe new origin
timestampthe new timestamp
Returns
the new ReferenceFrame with new origin and timestamp

Definition at line 590 of file ReferenceFrame.h.

◆ move() [2/2]

ReferenceFrame gams::pose::ReferenceFrameVersion::move ( Position  new_origin) const
inline

Creates a new ReferenceFrame with modified origin.

Parameters
new_originthe new origin
Returns
the new ReferenceFrame with new origin

Definition at line 557 of file ReferenceFrame.h.

◆ mut_origin()

Pose& gams::pose::ReferenceFrameVersion::mut_origin ( )
inline

Gets the origin of this Frame.

Returns
the Pose which is the origin within this frame's parent, or, a Pose within this own frame, with all zeros for coordinates, if this frame has no parent.

Definition at line 537 of file ReferenceFrame.h.

◆ name()

const char* gams::pose::ReferenceFrameVersion::name ( ) const
inline

Returns a human-readable name for the reference frame type.

Returns
the name reference frame type (e.g., GPS, Cartesian)

Definition at line 656 of file ReferenceFrame.h.

◆ operator!=() [1/2]

bool gams::pose::ReferenceFrameVersion::operator!= ( const ReferenceFrame other) const

Inequality operator.

Parameters
otherthe frame to compare to.
Returns
false if both frames are the same object (i.e., same address). Otherwise, frames are not considered equal (returns true).

◆ operator!=() [2/2]

bool gams::pose::ReferenceFrameVersion::operator!= ( const ReferenceFrameVersion other) const

Inequality operator.

Parameters
otherthe frame to compare to.
Returns
false if both frames are the same object (i.e., same address). Otherwise, frames are not considered equal (returns true).

◆ operator==() [1/2]

bool gams::pose::ReferenceFrameVersion::operator== ( const ReferenceFrame other) const

Equality operator.

Parameters
otherthe frame to compare to.
Returns
true if both frames are the same object (i.e., same address). Otherwise, frames are not considered equal (returns false).

◆ operator==() [2/2]

bool gams::pose::ReferenceFrameVersion::operator== ( const ReferenceFrameVersion other) const

Equality operator.

Parameters
otherthe frame to compare to.
Returns
true if both frames are the same object (i.e., same address). Otherwise, frames are not considered equal (returns false).

◆ orient() [1/2]

ReferenceFrame gams::pose::ReferenceFrameVersion::orient ( const Orientation new_origin,
uint64_t  timestamp 
) const
inline

Creates a new ReferenceFrame with modified origin and timestamp.

Parameters
new_originthe new origin
timestampthe new timestamp
Returns
the new ReferenceFrame with new origin and timestamp

Definition at line 602 of file ReferenceFrame.h.

◆ orient() [2/2]

ReferenceFrame gams::pose::ReferenceFrameVersion::orient ( Orientation  new_origin) const
inline

Creates a new ReferenceFrame with modified origin.

Parameters
new_originthe new origin
Returns
the new ReferenceFrame with new origin

Definition at line 567 of file ReferenceFrame.h.

◆ origin()

const Pose& gams::pose::ReferenceFrameVersion::origin ( ) const
inline

Gets the origin of this Frame.

Returns
the Pose which is the origin within this frame's parent, or, a Pose within this own frame, with all zeros for coordinates, if this frame has no parent.

Definition at line 526 of file ReferenceFrame.h.

◆ origin_frame()

ReferenceFrame gams::pose::ReferenceFrameVersion::origin_frame ( ) const
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.

◆ pose() [1/2]

ReferenceFrame gams::pose::ReferenceFrameVersion::pose ( const Pose new_origin,
uint64_t  timestamp 
) const
inline

Creates a new ReferenceFrame with modified origin and timestamp.

Parameters
new_originthe new origin
timestampthe new timestamp
Returns
the new ReferenceFrame with new origin and timestamp

Definition at line 578 of file ReferenceFrame.h.

◆ pose() [2/2]

ReferenceFrame gams::pose::ReferenceFrameVersion::pose ( Pose  new_origin) const
inline

Creates a new ReferenceFrame with modified origin.

Parameters
new_originthe new origin
Returns
the new ReferenceFrame with new origin

Definition at line 547 of file ReferenceFrame.h.

◆ save() [1/2]

void gams::pose::ReferenceFrameVersion::save ( madara::knowledge::KnowledgeBase &  kb,
const FrameEvalSettings settings = FrameEvalSettings::DEFAULT 
) const
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.

Parameters
kbthe KnowledgeBase to store into

Definition at line 763 of file ReferenceFrame.h.

◆ save() [2/2]

void gams::pose::ReferenceFrameVersion::save ( madara::knowledge::KnowledgeBase &  kb,
uint64_t  expiry,
const FrameEvalSettings settings = FrameEvalSettings::DEFAULT 
) const
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.

Parameters
kbthe KnowledgeBase to store into
expiryuse this expiry time instead of the one set on this ID

Definition at line 748 of file ReferenceFrame.h.

◆ save_as() [1/2]

void gams::pose::ReferenceFrameVersion::save_as ( madara::knowledge::KnowledgeBase &  kb,
std::string  key,
const FrameEvalSettings settings = FrameEvalSettings::DEFAULT 
) const
inline

Save this ReferenceFrame to the knowledge base, with a specific key value.

Parameters
kbthe KnowledgeBase to save to
keya key prefix to save with

Definition at line 1053 of file ReferenceFrame.h.

◆ save_as() [2/2]

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.

Parameters
kbthe KnowledgeBase to save to
keya key prefix to save with
expiryuse this expiry time instead of the one set on this ID

◆ temp()

bool gams::pose::ReferenceFrameVersion::temp ( ) const
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.

◆ throw_if_not_connected()

static void gams::pose::ReferenceFrameVersion::throw_if_not_connected ( const std::vector< ReferenceFrame > &  frames)
static

◆ timestamp() [1/2]

uint64_t gams::pose::ReferenceFrameVersion::timestamp ( ) const
inline

Get the timestamp assigned to this frame.

Definition at line 695 of file ReferenceFrame.h.

◆ timestamp() [2/2]

ReferenceFrame gams::pose::ReferenceFrameVersion::timestamp ( uint64_t  timestamp) const
inline

Clone the this frame, but with new timestamp.

Returns
the new frame object

Definition at line 704 of file ReferenceFrame.h.

◆ type()

const ReferenceFrameType* gams::pose::ReferenceFrameVersion::type ( ) const
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.

Returns
a pointer to this frames ReferenceFrameType

Definition at line 517 of file ReferenceFrame.h.

Friends And Related Function Documentation

◆ Coordinate

template<typename CoordType >
friend class Coordinate
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.

Member Data Documentation

◆ ETERNAL

const uint64_t gams::pose::ReferenceFrameVersion::ETERNAL = ReferenceFrameIdentity::ETERNAL
static

Definition at line 358 of file ReferenceFrame.h.

◆ ident_

std::shared_ptr<ReferenceFrameIdentity> gams::pose::ReferenceFrameVersion::ident_
mutableprivate

Definition at line 339 of file ReferenceFrame.h.

◆ interpolated_

bool gams::pose::ReferenceFrameVersion::interpolated_ = false
mutableprivate

Definition at line 343 of file ReferenceFrame.h.

◆ origin_

Pose gams::pose::ReferenceFrameVersion::origin_
private

Definition at line 342 of file ReferenceFrame.h.

◆ TEMP

const uint64_t gams::pose::ReferenceFrameVersion::TEMP = ReferenceFrameIdentity::TEMP
static

Definition at line 359 of file ReferenceFrame.h.

◆ temp_

bool gams::pose::ReferenceFrameVersion::temp_ = false
private

Definition at line 344 of file ReferenceFrame.h.

◆ timestamp_

uint64_t gams::pose::ReferenceFrameVersion::timestamp_ = ETERNAL
private

Definition at line 341 of file ReferenceFrame.h.

◆ type_

const ReferenceFrameType* gams::pose::ReferenceFrameVersion::type_
private

Definition at line 340 of file ReferenceFrame.h.


The documentation for this class was generated from the following file: