Go to the documentation of this file.
6 #include <Eigen/Geometry>
15 #include <RobotAPI/libraries/ArmarXObjects/aron/ObjectPose.aron.generated.h>
23 #include <RobotAPI/libraries/armem_robot_state/aron/Robot.aron.generated.h>
57 memoryNameSystem.
subscribe(
id,
this, &Reader::updateKnownObjects);
73 const std::vector<armem::MemoryID>& snapshotIDs)
98 std::optional<ArticulatedObject>
101 const std::optional<std::string>& providerName)
const
106 ARMARX_CHECK_EQUAL(splits.size(), 3) <<
"`name` must be of form `DATASET/NAME/INSTANCE`";
108 const std::string className = splits.at(0) +
"/" + splits.at(1);
109 const std::string instanceName = splits.at(2);
111 const auto description =
queryDescription(className, timestamp, providerName);
119 return get(*description, timestamp, instanceName, providerName);
125 const std::string& instanceName,
126 const std::optional<std::string>& providerName)
const
131 .instance = instanceName,
133 .timestamp = timestamp};
143 const std::optional<std::string>& providerName)
const
154 << obj.
instance <<
". Provider is `" << providerName.value_or(
"~unset~")
159 obj.
config = std::move(*state);
163 std::vector<robot_state::description::RobotDescription>
165 const std::optional<std::string>& providerName)
const
172 if (providerName.has_value())
199 if (not qResult.success)
207 std::optional<robot_state::description::RobotDescription>
210 const std::optional<std::string>& providerName)
const
217 if (providerName.has_value())
245 if (not qResult.success)
254 std::optional<robot_state::RobotState>
257 const std::optional<std::string>& providerName)
const
264 if (not providerName.has_value())
278 ARMARX_VERBOSE <<
"Provider is `" << providerName.value() <<
"`.";
295 if (not qResult.success)
303 std::optional<robot_state::RobotState>
308 armarx::armem::arondto::ObjectInstance aronObjectInstance;
311 aronObjectInstance.fromAron(instance.
data());
326 .proprioception = std::nullopt};
331 std::optional<robot_state::RobotState>
353 std::optional<robot_state::description::RobotDescription>
362 std::optional<wm::EntityInstance> instance;
365 if (instance.has_value())
374 std::vector<robot_state::description::RobotDescription>
382 std::vector<robot_state::description::RobotDescription> descriptions;
386 if (not entity.
empty())
388 const auto robotDescription =
389 convertRobotDescription(entity.getFirstSnapshot().getInstance(0));
390 if (robotDescription)
392 descriptions.push_back(*robotDescription);
std::optional< robot_state::description::RobotDescription > getRobotDescription(const armarx::armem::wm::Memory &memory) const
EntitySelector & all() override
const std::string CoreInstanceSegmentName
std::optional< ArticulatedObject > get(const std::string &name, const armem::Time ×tamp, const std::optional< std::string > &providerName) const override
std::optional< robot_state::RobotState > queryState(const std::string &instanceName, const armem::Time ×tamp, const std::optional< std::string > &providerName) const
SnapshotSelector & latest()
EntitySelector & entities()
Start specifying entities.
auto & getLatestInstance(int instanceIndex=0)
Retrieve the latest entity instance.
std::vector< robot_state::description::RobotDescription > queryDescriptions(const armem::Time ×tamp, const std::optional< std::string > &providerName) const
Client-side working entity instance.
QueryInput buildQueryInput() const
SnapshotSelector & snapshots()
Start specifying entity snapshots.
const std::string MemoryName
#define ARMARX_CHECK_NOT_EMPTY(c)
bool synchronize(ArticulatedObject &obj, const armem::Time ×tamp, const std::optional< std::string > &providerName) const override
Brief description of class memory.
bool forEachEntity(FunctionT &&func)
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
std::optional< robot_state::description::RobotDescription > convertRobotDescription(const armem::wm::EntityInstance &instance)
CoreSegmentSelector & coreSegments()
Start specifying core segments.
Client-side working memory core segment.
CoreSegmentSelector & withName(const std::string &name) override
Client-side working memory.
Reader useReader(const MemoryID &memoryID)
Use a memory server and get a reader for it.
std::optional< robot_state::RobotState > getArticulatedObjectState(const armarx::armem::wm::Memory &memory) const
SubscriptionHandle subscribe(const MemoryID &subscriptionID, Callback Callback)
Represents a point in time.
void fromAron(const arondto::ObjectAttachmentInfo &dto, ObjectAttachmentInfo &bo)
EntitySelector & withName(const std::string &name) override
ProviderSegmentSelector & withName(const std::string &name) override
const std::string CoreClassSegmentName
Eigen::Matrix4f objectPoseGlobal
The object pose in the global frame.
SnapshotSelector & beforeOrAtTime(Time timestamp)
std::vector< robot_state::description::RobotDescription > getRobotDescriptions(const armarx::armem::wm::Memory &memory) const
bool forEachInstance(InstanceFunctionT &&func)
std::optional< robot_state::RobotState > convertToRobotState(const armem::wm::EntityInstance &instance)
The memory name system (MNS) client.
Indicates that a query to the Memory Name System failed.
The query::Builder class provides a fluent-style specification of hierarchical queries.
ProviderSegmentSelector & providerSegments()
Start specifying provider segments.
std::optional< robot_state::description::RobotDescription > queryDescription(const std::string &name, const armem::Time ×tamp, const std::optional< std::string > &providerName) const
#define ARMARX_CHECK_EQUAL(lhs, rhs)
This macro evaluates whether lhs is equal (==) rhs and if it turns out to be false it will throw an E...
const DataT & data() const
void connect(armem::client::MemoryNameSystem &memoryNameSystem)
std::map< std::string, float > objectJointValues
The object's joint values if it is articulated.
ProviderSegmentSelector & all() override
An object pose as stored by the ObjectPoseStorage.
QueryResult query(const QueryInput &input) const
Perform a query.
description::RobotDescription description
DateTime timestamp
Source timestamp.
std::vector< std::string > split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
const armem::MemoryID MemoryID