Go to the documentation of this file.
26 #include <MMM/Motion/Legacy/LegacyMotionReaderXML.h>
27 #include <MMM/Model/ModelReaderXML.h>
34 #include <ArmarXCore/interface/observers/VariantBase.h>
37 #include <VirtualRobot/MathTools.h>
43 #include <Ice/ObjectAdapter.h>
58 std::string armarxProjects = getProperty<std::string>(
"ArmarXProjects").getValue();
60 if (!armarxProjects.empty())
62 std::vector<std::string> projects =
armarx::Split(armarxProjects,
",;",
true,
true);
64 for (std::string& p : projects)
71 ARMARX_WARNING <<
"ArmarX Package " << p <<
" has not been found!";
81 std::string motionDefault = getProperty<std::string>(
"MMMFile").getValue();
83 if (!motionDefault.empty())
85 load(motionDefault,
"Armar4");
95 void MMMPlayer::load(
const std::string& MMMFile,
const std::string& projects)
97 std::unique_lock lock(mmmMutex);
99 if (!projects.empty())
101 std::vector<std::string> proj =
armarx::Split(projects,
",;",
true,
true);
103 for (std::string& p : proj)
108 if (!finder.packageFound())
110 ARMARX_WARNING <<
"ArmarX Package " << p <<
" has not been found!";
114 ARMARX_INFO <<
"Adding to datapaths: " << finder.getDataDir();
122 motionWrapper =
MotionFileWrapper::create(motionPath, getProperty<bool>(
"ApplyButterworthFilter").
getValue() ? getProperty<float>(
"ButterworthFilterCutOffFreq") : 0);
126 motionData =
nullptr;
130 motionData = motionWrapper->getFirstMotionData();
136 load(MMMFile, projects);
137 return motionData !=
nullptr;
142 motionData = motionWrapper->getMotionData(motionName);
143 return motionData !=
nullptr;
148 return (
int) motionData->numberOfFrames;
158 return motionData->modelPath;
163 return motionData->jointNames;
170 return Ice::StringSeq();
172 return motionWrapper->getMotionNames();
177 return motionData !=
nullptr;
192 return motionData->getJointTrajectory();
197 return motionData->getPoseTrajectory();
void onConnectComponent() override
int getNumberOfFrames(const Ice::Current &) override
bool packageFound() const
Returns whether or not this package was found with cmake.
bool loadMMMFile(const std::string &filename, const std::string &projects, const Ice::Current &) override
void onDisconnectComponent() override
bool setMotionData(const std::string &motionName, const Ice::Current &) override
std::vector< std::string > Split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
The CMakePackageFinder class provides an interface to the CMake Package finder capabilities.
PropertyDefinitionsPtr createPropertyDefinitions() override
void onExitComponent() override
Ice::StringSeq getMotionNames(const Ice::Current &) override
void onInitComponent() override
TrajectoryBasePtr getBasePoseTraj(const Ice::Current &) override
std::string getDataDir() const
void terminate(const Process &p)
TrajectoryBasePtr getJointTraj(const Ice::Current &) override
std::string getModelPath(const Ice::Current &) override
T getValue(nlohmann::json &userConfig, nlohmann::json &defaultConfig, const std::string &entryName)
static void addDataPaths(const std::string &dataPathList)
static bool getAbsolutePath(const std::string &relativeFilename, std::string &storeAbsoluteFilename, const std::vector< std::string > &additionalSearchPaths={}, bool verbose=true)
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Ice::StringSeq getJointNames(const Ice::Current &) override
bool isMotionLoaded(const Ice::Current &) override
void load(const mongocxx::database &db, armem::wm::Memory &m)
This file offers overloads of toIce() and fromIce() functions for STL container types.
static MotionFileWrapperPtr create(const std::string &motionFilePath, double butterworthFilterCutOffFreq=0.0, const std::string relativeModelRoot="mmm")
std::string getMotionPath(const Ice::Current &) override