23 Base(memoryToIceAdapter,
32 const std::string& prefix)
36 defs->optional(properties.motionsPackage,
37 prefix +
"MotionsPackage",
38 "Name of the prior knowledge package to load from.");
39 defs->optional(properties.loadFromMotionsPackage,
40 prefix +
"LoadFromMotionsPackage",
41 "If true, load the motions from the motions package on startup.");
49 if (properties.loadFromMotionsPackage)
51 loadByMotionFinder(properties.motionsPackage);
61 MDBMotionSegment::loadByMotionFinder(
const std::string& packageName)
64 int loadedMotions = 0;
66 ARMARX_INFO <<
"Load Motions from package" << std::endl;
69 auto allMotions = motionFinder.findAll(
"mdb");
70 for (
const auto& motionFinderInfo : allMotions)
72 auto pathToInfoJson = motionFinderInfo.getFullPath() / motionFinderInfo.getID() /
73 (motionFinderInfo.getID() +
".json");
77 ss <<
"Found valid instance at: " << pathToInfoJson <<
". The motionID is: ";
78 for (
const auto& [key, attachedFiles] : op->attachedFiles)
80 for (
const auto& attachedFile : attachedFiles)
82 ss <<
"\n" << attachedFile.fileName <<
" (" << key <<
")";
87 auto& snapshot = entity.
addSnapshot(op->createdDate);
94 instance.
data() = op->toAron();
98 ARMARX_WARNING <<
"Found an invalid path to a motion file: " << pathToInfoJson;
102 loadedMotions += allMotions.size();
105 return loadedMotions;
EntitySnapshotT & addSnapshot(const Time ×tamp)
Add a snapshot at the given time.
const DataT & data() const
Helps connecting a Memory server to the Ice interface.
virtual void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="") override
virtual void init() override
MDBMotionSegment(armem::server::MemoryToIceAdapter &iceMemory)
virtual void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="") override
virtual void init() override
server::wm::ProviderSegment * segmentPtr
Entity & addEntity(const std::string &name, Args... args)
Client-side working entity instance.
#define ARMARX_INFO
The normal logging level.
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
std::optional< armarx::motion::mdb::arondto::MDBReference > createFromFile(const std::filesystem::path &pathToInfoJson)
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.