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/aron/Robot.aron.generated.h>
29 namespace fs = ::std::filesystem;
59 memoryNameSystem.
subscribe(
id,
this, &Reader::updateKnownObjects);
75 const std::vector<armem::MemoryID>& snapshotIDs)
100 std::optional<ArticulatedObject>
103 const std::optional<std::string>& providerName)
108 ARMARX_CHECK_EQUAL(splits.size(), 3) <<
"`name` must be of form `DATASET/NAME/INSTANCE`";
110 const std::string className = splits.at(0) +
"/" + splits.at(1);
111 const std::string instanceName = splits.at(2);
113 const auto description =
queryDescription(className, timestamp, providerName);
121 return get(*description, timestamp, instanceName, providerName);
127 const std::string& instanceName,
128 const std::optional<std::string>& providerName)
133 .instance = instanceName,
135 .timestamp = timestamp};
145 const std::optional<std::string>& providerName)
156 << obj.
instance <<
". Provider is `" << providerName.value_or(
"~unset~")
161 obj.
config = std::move(*state);
165 std::vector<robot::RobotDescription>
167 const std::optional<std::string>& providerName)
174 if (providerName.has_value())
201 if (not qResult.success)
209 std::optional<robot::RobotDescription>
212 const std::optional<std::string>& providerName)
219 if (providerName.has_value())
247 if (not qResult.success)
256 std::optional<robot::RobotState>
259 const std::optional<std::string>& providerName)
266 if (not providerName.has_value())
280 ARMARX_VERBOSE <<
"Provider is `" << providerName.value() <<
"`.";
297 if (not qResult.success)
305 std::optional<robot::RobotState>
310 armarx::armem::arondto::ObjectInstance aronObjectInstance;
313 aronObjectInstance.fromAron(instance.
data());
327 .proprioception = std::nullopt};
332 std::optional<robot::RobotState>
354 std::optional<robot::RobotDescription>
363 std::optional<wm::EntityInstance> instance;
366 if (instance.has_value())
375 std::vector<robot::RobotDescription>
383 std::vector<robot::RobotDescription> descriptions;
387 if (not entity.
empty())
389 const auto robotDescription =
390 convertRobotDescription(entity.getFirstSnapshot().getInstance(0));
391 if (robotDescription)
393 descriptions.push_back(*robotDescription);
EntitySelector & all() override
const std::string CoreInstanceSegmentName
std::optional< robot::RobotState > getArticulatedObjectState(const armarx::armem::wm::Memory &memory) const
SnapshotSelector & latest()
EntitySelector & entities()
Start specifying entities.
bool synchronize(ArticulatedObject &obj, const armem::Time ×tamp, const std::optional< std::string > &providerName) override
auto & getLatestInstance(int instanceIndex=0)
Retrieve the latest entity instance.
Client-side working entity instance.
QueryInput buildQueryInput() const
SnapshotSelector & snapshots()
Start specifying entity snapshots.
const std::string MemoryName
#define ARMARX_CHECK_NOT_EMPTY(c)
std::vector< robot::RobotDescription > queryDescriptions(const armem::Time ×tamp, const std::optional< std::string > &providerName)
std::optional< robot::RobotState > queryState(const std::string &instanceName, const armem::Time ×tamp, const std::optional< std::string > &providerName)
Brief description of class memory.
bool forEachEntity(FunctionT &&func)
std::optional< ArticulatedObject > get(const std::string &name, const armem::Time ×tamp, const std::optional< std::string > &providerName) override
std::optional< robot::RobotDescription > convertRobotDescription(const armem::wm::EntityInstance &instance)
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
std::optional< robot::RobotState > convertToRobotState(const armem::wm::EntityInstance &instance)
CoreSegmentSelector & coreSegments()
Start specifying core segments.
RobotDescription description
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.
SubscriptionHandle subscribe(const MemoryID &subscriptionID, Callback Callback)
std::vector< robot::RobotDescription > getRobotDescriptions(const armarx::armem::wm::Memory &memory) const
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.
std::optional< robot::RobotDescription > queryDescription(const std::string &name, const armem::Time ×tamp, const std::optional< std::string > &providerName)
SnapshotSelector & beforeOrAtTime(Time timestamp)
bool forEachInstance(InstanceFunctionT &&func)
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.
#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.
std::optional< robot::RobotDescription > getRobotDescription(const armarx::armem::wm::Memory &memory) const
QueryResult query(const QueryInput &input) const
Perform a query.
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