Go to the documentation of this file.
29 #include <RobotComponents/interface/components/DMPComponentBase.h>
30 #include <MemoryX/interface/components/WorkingMemoryInterface.h>
31 #include <MemoryX/interface/components/LongtermMemoryInterface.h>
34 #include <MemoryX/interface/memorytypes/MemoryEntities.h>
35 #include <MemoryX/interface/memorytypes/MemorySegments.h>
37 #include <boost/archive/text_oarchive.hpp>
38 #include <boost/archive/text_iarchive.hpp>
40 #include <boost/archive/xml_iarchive.hpp>
41 #include <boost/archive/xml_oarchive.hpp>
43 #include <boost/archive/binary_iarchive.hpp>
44 #include <boost/archive/binary_oarchive.hpp>
46 #include <boost/variant/variant.hpp>
47 #include <boost/variant/get.hpp>
50 #pragma GCC diagnostic ignored "-Wunknown-pragmas"
51 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
52 #include <dmp/representation/dmp/dmpregistration.h>
53 #include <dmp/representation/dmpfactory.h>
54 #pragma GCC diagnostic pop
55 #pragma GCC diagnostic pop
92 defineOptionalProperty<std::string>(
"LongtermMemoryName",
"LongtermMemory",
"Name of the LongtermMemory component");
106 using DMPPair = std::pair<std::string, std::pair<DMPInstancePtr, DMPInstanceBasePrx> >;
107 using DMPMap = std::map<std::string, std::pair<DMPInstancePtr, DMPInstanceBasePrx> >;
115 virtual public DMPComponentBase
131 return "DMPComponent";
145 DMPInstanceBasePrx
getDMP(
const std::string& dmpName,
const Ice::Current& = Ice::emptyCurrent)
override;
148 DMPInstanceBasePrx
getDMPFromDatabase(
const std::string& dmpEntityName,
const std::string& dmpName =
"UNKNOWN",
const Ice::Current& = Ice::emptyCurrent)
override;
150 DMPInstanceBasePrx
getDMPFromFile(
const std::string& fileName,
const std::string& dmpName =
"UNKNOWN",
const Ice::Current& = Ice::emptyCurrent)
override;
152 void storeDMPInFile(
const std::string& fileName,
const std::string& dmpName,
const Ice::Current&)
override;
153 void storeDMPInDatabase(
const std::string& dmpName,
const std::string& name, const ::Ice::Current& = Ice::emptyCurrent)
override;
154 void removeDMPFromDatabase(
const std::string& name, const ::Ice::Current& = Ice::emptyCurrent)
override;
159 DMPInstanceBasePrx
instantiateDMP(
const std::string& dmpName,
const std::string& DMPType,
int kernelSize, const ::Ice::Current& = Ice::emptyCurrent)
override;
161 void setDMPState(
const std::string& dmpName, const ::armarx::cStateVec& state, const ::Ice::Current& = Ice::emptyCurrent)
override;
162 void setGoal(
const std::string& dmpName,
const Ice::DoubleSeq&
value,
const Ice::Current& = Ice::emptyCurrent)
override;
163 void setStartPosition(
const std::string& dmpName,
const Ice::DoubleSeq&
value,
const Ice::Current& = Ice::emptyCurrent)
override;
164 void setCanonicalValues(
const std::string& dmpName,
const Ice::DoubleSeq&
value,
const Ice::Current& = Ice::emptyCurrent)
override;
166 void readTrajectoryFromFile(
const std::string& dmpName,
const std::string& file,
double times = 1, const ::Ice::Current& = Ice::emptyCurrent)
override;
168 void trainDMP(
const std::string& dmpName, const ::Ice::Current& = Ice::emptyCurrent)
override;
169 void setAmpl(
const std::string& dmpName,
int dim,
double value, const ::Ice::Current& = Ice::emptyCurrent)
override;
170 double getAmpl(
const std::string& dmpName,
int dim, const ::Ice::Current& = Ice::emptyCurrent)
override;
173 double getTemporalFactor(
const std::string& dmpName, const ::Ice::Current& = Ice::emptyCurrent)
override;
174 void setTemporalFactor(
const std::string& dmpName,
double tau, const ::Ice::Current& = Ice::emptyCurrent)
override;
177 Vec2D
calcTrajectory(
const std::string& dmpName,
double startTime,
double timeStep,
double endTime,
178 const ::Ice::DoubleSeq& goal,
179 const cStateVec& states,
180 const ::Ice::DoubleSeq& canonicalValues,
double temporalFactor, const ::Ice::Current& = Ice::emptyCurrent)
override;
183 double getTimeStep(const ::Ice::Current& = Ice::emptyCurrent)
override
188 void setTimeStep(
double ts, const ::Ice::Current& = Ice::emptyCurrent)
override;
190 double getCurrentTime(const ::Ice::Current& = Ice::emptyCurrent)
override;
192 void resetTime(const ::Ice::Current& = Ice::emptyCurrent)
override;
197 double getDampingFactor(
const std::string& dmpName, const ::Ice::Current& = Ice::emptyCurrent)
override;
199 double getSpringFactor(
const std::string& dmpName, const ::Ice::Current& = Ice::emptyCurrent)
override;
201 double getForceTerm(
const std::string& dmpName,
const Ice::DoubleSeq& canonicalValues,
int dim,
const Ice::Current& = Ice::emptyCurrent)
override;
204 cStateVec
getNextState(
const std::string& dmpName,
const cStateVec& states, const ::Ice::Current& = Ice::emptyCurrent)
override;
205 cStateVec
getCurrentState(
const std::string& dmpName, const ::Ice::Current& = Ice::emptyCurrent)
override;
206 Ice::DoubleSeq
getCanonicalValues(
const std::string& dmpName, const ::Ice::Current& = Ice::emptyCurrent)
override;
207 Ice::DoubleSeq
getTrajGoal(
const std::string& dmpName, const ::Ice::Current& = Ice::emptyCurrent)
override;
208 ::armarx::cStateVec
getTrajStartState(
const std::string& dmpName, const ::Ice::Current& = Ice::emptyCurrent)
override;
210 std::string
getDMPType(
const std::string& dmpName, const ::Ice::Current& = Ice::emptyCurrent)
override;
212 Ice::DoubleSeq
getStartPosition(
const std::string& dmpName, const ::Ice::Current& = Ice::emptyCurrent)
override;
214 SVector
getDMPNameList(const ::Ice::Current& = Ice::emptyCurrent)
override;
216 void eraseDMP(
const std::string& dmpName, const ::Ice::Current& = Ice::emptyCurrent)
override;
217 bool isDMPExist(
const std::string& dmpName, const ::Ice::Current& = Ice::emptyCurrent)
override;
218 int getDMPDim(
const std::string& dmpName, const ::Ice::Current& = Ice::emptyCurrent)
override;
226 DMPInstanceBasePrx findInstancePrx(std::string name);
::armarx::cStateVec getTrajStartState(const std::string &dmpName, const ::Ice::Current &=Ice::emptyCurrent) override
Vec2D calcTrajectory(const std::string &dmpName, double startTime, double timeStep, double endTime, const ::Ice::DoubleSeq &goal, const cStateVec &states, const ::Ice::DoubleSeq &canonicalValues, double temporalFactor, const ::Ice::Current &=Ice::emptyCurrent) override
std::string getDefaultName() const override
DMPInstanceBasePrx instantiateDMP(const std::string &dmpName, const std::string &DMPType, int kernelSize, const ::Ice::Current &=Ice::emptyCurrent) override
std::string getDMPType(const std::string &dmpName, const ::Ice::Current &=Ice::emptyCurrent) override
std::pair< DMPInstancePtr, DMPInstanceBasePrx > DMPInstancePair
void setTemporalFactor(const std::string &dmpName, double tau, const ::Ice::Current &=Ice::emptyCurrent) override
void setAmpl(const std::string &dmpName, int dim, double value, const ::Ice::Current &=Ice::emptyCurrent) override
DMPInstanceBasePrx getDMPFromDatabaseById(const std::string &dbId, const Ice::Current &) override
bool isDMPExist(const std::string &dmpName, const ::Ice::Current &=Ice::emptyCurrent) override
void storeDMPInFile(const std::string &fileName, const std::string &dmpName, const Ice::Current &) override
void setTimeStep(double ts, const ::Ice::Current &=Ice::emptyCurrent) override
memoryx::LongtermMemoryInterfacePrx longtermMemoryPrx
std::vector< int > usedDimensions
void setGoal(const std::string &dmpName, const Ice::DoubleSeq &value, const Ice::Current &=Ice::emptyCurrent) override
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
void setStartPosition(const std::string &dmpName, const Ice::DoubleSeq &value, const Ice::Current &=Ice::emptyCurrent) override
std::map< std::string, std::pair< DMPInstancePtr, DMPInstanceBasePrx > > DMPMap
void trainDMP(const std::string &dmpName, const ::Ice::Current &=Ice::emptyCurrent) override
void onConnectComponent() override
DMPInstanceBasePrx getDMP(const std::string &dmpName, const Ice::Current &=Ice::emptyCurrent) override
DMPComponentPropertyDefinitions(std::string prefix)
void setCanonicalValues(const std::string &dmpName, const Ice::DoubleSeq &value, const Ice::Current &=Ice::emptyCurrent) override
double getCurrentTime(const ::Ice::Current &=Ice::emptyCurrent) override
std::shared_ptr< Value > value()
void removeDMPFromDatabaseById(const std::string &dbId, const Ice::Current &) override
void onExitComponent() override
memoryx::PersistentDMPDataSegmentBasePrx dmpDataMemoryPrx
double getTimeStep(const ::Ice::Current &=Ice::emptyCurrent) override
DMPInstanceBasePrx getDMPFromFile(const std::string &fileName, const std::string &dmpName="UNKNOWN", const Ice::Current &=Ice::emptyCurrent) override
Ice::DoubleSeq getCanonicalValues(const std::string &dmpName, const ::Ice::Current &=Ice::emptyCurrent) override
void setDMPState(const std::string &dmpName, const ::armarx::cStateVec &state, const ::Ice::Current &=Ice::emptyCurrent) override
double getAmpl(const std::string &dmpName, int dim, const ::Ice::Current &=Ice::emptyCurrent) override
void onDisconnectComponent() override
DMPInstanceBasePrx getDMPFromDatabase(const std::string &dmpEntityName, const std::string &dmpName="UNKNOWN", const Ice::Current &=Ice::emptyCurrent) override
void readTrajectoryFromFile(const std::string &dmpName, const std::string &file, double times=1, const ::Ice::Current &=Ice::emptyCurrent) override
Baseclass for all ArmarX ManagedIceObjects requiring properties.
int getDMPDim(const std::string &dmpName, const ::Ice::Current &=Ice::emptyCurrent) override
std::pair< std::string, std::pair< DMPInstancePtr, DMPInstanceBasePrx > > DMPPair
void onInitComponent() override
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
double getDampingFactor(const std::string &dmpName, const ::Ice::Current &=Ice::emptyCurrent) override
cStateVec getCurrentState(const std::string &dmpName, const ::Ice::Current &=Ice::emptyCurrent) override
void eraseDMP(const std::string &dmpName, const ::Ice::Current &=Ice::emptyCurrent) override
Default component property definition container.
Ice::DoubleSeq getStartPosition(const std::string &dmpName, const ::Ice::Current &=Ice::emptyCurrent) override
void resetCanonicalValues(const ::Ice::Current &=Ice::emptyCurrent) override
void removeDMPFromDatabase(const std::string &name, const ::Ice::Current &=Ice::emptyCurrent) override
double getTemporalFactor(const std::string &dmpName, const ::Ice::Current &=Ice::emptyCurrent) override
void storeDMPInDatabase(const std::string &dmpName, const std::string &name, const ::Ice::Current &=Ice::emptyCurrent) override
double getSpringFactor(const std::string &dmpName, const ::Ice::Current &=Ice::emptyCurrent) override
SVector getDMPNameList(const ::Ice::Current &=Ice::emptyCurrent) override
cStateVec getNextState(const std::string &dmpName, const cStateVec &states, const ::Ice::Current &=Ice::emptyCurrent) override
Ice::DoubleSeq getTrajGoal(const std::string &dmpName, const ::Ice::Current &=Ice::emptyCurrent) override
This file offers overloads of toIce() and fromIce() functions for STL container types.
void resetTime(const ::Ice::Current &=Ice::emptyCurrent) override
double getForceTerm(const std::string &dmpName, const Ice::DoubleSeq &canonicalValues, int dim, const Ice::Current &=Ice::emptyCurrent) override