Skip to content
Snippets Groups Projects
Commit bdc4d9cd authored by Philip Scherer's avatar Philip Scherer
Browse files

Add documentation to `getSnapshotsInRange`

parent c6816666
No related branches found
No related tags found
1 merge request!265Robot state predictions
...@@ -32,6 +32,10 @@ ...@@ -32,6 +32,10 @@
namespace armarx::armem namespace armarx::armem
{ {
/**
* Holds info on snapshot data extracted from a time range.
* Used for performing predictions.
*/
template <typename DataType, typename LatestType> template <typename DataType, typename LatestType>
struct LatestSnapshotInfo struct LatestSnapshotInfo
{ {
...@@ -43,9 +47,29 @@ namespace armarx::armem ...@@ -43,9 +47,29 @@ namespace armarx::armem
LatestType latestValue; LatestType latestValue;
}; };
/*!
* @brief Get data points for the snapshots of an entity in a given time range.
*
* The resulting `LatestSnapshotInfo` is useful for performing predictions.
* Data from the individual snapshots is given to the conversion functions
* before being stored in the result.
* Timestamps in the `timestampsSec` vector are relative to the endTime parameter
* to this function.
* Data from a snapshot is always retrieved from the instance with index 0.
* If some data cannot be retrieved, `success` is set to `false`
* and the `errorMessage` in the return value is set accordingly.
*
* @param segment the segment to get the snapshot data from
* @param entityID the entity to get the data for
* @param startTime the beginning of the time range
* @param endTime the end of the time range. Timestamps are relative to this value
* @param dictToData the conversion function from `DictPtr` to `DataType`
* @param dictToLatest the conversion function from `DictPtr` to `LatestType`
* @return the corresponding `LatestSnapshotInfo`
*/
template <typename SegmentType, typename DataType, typename LatestType> template <typename SegmentType, typename DataType, typename LatestType>
LatestSnapshotInfo<DataType, LatestType> LatestSnapshotInfo<DataType, LatestType>
getLatestSnapshots(const SegmentType* segment, getSnapshotsInRange(const SegmentType* segment,
const MemoryID& entityID, const MemoryID& entityID,
const DateTime& startTime, const DateTime& startTime,
const DateTime& endTime, const DateTime& endTime,
......
...@@ -214,7 +214,7 @@ namespace armarx::armem::server::robot_state::localization ...@@ -214,7 +214,7 @@ namespace armarx::armem::server::robot_state::localization
doLocked( doLocked(
[&, this]() [&, this]()
{ {
info = getLatestSnapshots<server::wm::CoreSegment, info = getSnapshotsInRange<server::wm::CoreSegment,
Eigen::Vector3d, Eigen::Vector3d,
arondto::Transform>( arondto::Transform>(
segmentPtr, segmentPtr,
......
...@@ -231,7 +231,7 @@ namespace armarx::armem::server::robot_state::proprioception ...@@ -231,7 +231,7 @@ namespace armarx::armem::server::robot_state::proprioception
// Default capture because the number of variables was getting out of hand // Default capture because the number of variables was getting out of hand
[&, this]() [&, this]()
{ {
info = getLatestSnapshots<server::wm::CoreSegment, info = getSnapshotsInRange<server::wm::CoreSegment,
Eigen::VectorXd, Eigen::VectorXd,
aron::data::DictPtr>( aron::data::DictPtr>(
segmentPtr, segmentPtr,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment