Go to the documentation of this file.
25 #include <MMM/MMMCore.h>
27 #include <dmp/representation/dmp/dmpregistration.h>
29 #include <RobotComponents/interface/components/DMPComponentBase.h>
35 #include "dmp/representation/dmp/dmpinterface.h"
36 #include "dmp/representation/dmp/basicdmp.h"
37 #include "dmp/representation/dmp/dmp3rdorder.h"
38 #include "dmp/representation/dmp/quaterniondmp.h"
39 #include "dmp/representation/dmp/endvelodmp.h"
40 #include "dmp/representation/dmp/dmp3rdorderforcefield.h"
41 #include "dmp/representation/dmp/forcefielddmp.h"
42 #include "dmp/representation/dmp/adaptive3rdorderdmp.h"
43 #include "dmp/representation/dmp/simpleendvelodmp.h"
44 #include "dmp/representation/dmp/endveloforcefielddmp.h"
45 #include "dmp/representation/dmp/endveloforcefieldwithobjrepulsiondmp.h"
46 #include "dmp/representation/dmp/periodicdmp.h"
47 #include "dmp/representation/dmp/taskspacedmp.h"
53 #define ARMARX_DMPTYPE_BASICDMP boost::serialization::guid<DMP::BasicDMP>()
54 #define ARMARX_DMPTYPE_ENDVELODMP boost::serialization::guid<DMP::EndVeloDMP>()
55 #define ARMARX_DMPTYPE_SIMPLEENDVELODMP boost::serialization::guid<DMP::SimpleEndVeloDMP>()
56 #define ARMARX_DMPTYPE_FORCEFIELDDMP boost::serialization::guid<DMP::ForceFieldDMP>()
57 #define ARMARX_DMPTYPE_ENDVELFORCEFILELDDMP boost::serialization::guid<DMP::EndVeloForceFieldDMP>()
58 #define ARMARX_DMPTYPE_DMP3RDORDER boost::serialization::guid<DMP::DMP3rdOrder>()
59 #define ARMARX_DMPTYPE_DMP3RDORDERFORCEFIELD boost::serialization::guid<DMP::DMP3rdOrderForceField>()
60 #define ARMARX_DMPTYPE_ADAPTIVEGOAL3RDORDERDMP boost::serialization::guid<DMP::AdaptiveGoal3rdOrderDMP>()
61 #define ARMARX_DMPTYPE_QUATERNIONDMP boost::serialization::guid<DMP::QuaternionDMP>()
62 #define ARMARX_DMPTYPE_PERIODICDMP boost::serialization::guid<DMP::PeriodicDMP>()
63 #define ARMARX_DMPTYPE_TASKSPACEDMP boost::serialization::guid<DMP::TaskSpaceDMP>()
66 using paraType = boost::variant<double, DMP::DVec, Eigen::Quaternionf>;
69 using TrajVec = DMP::Vec<DMP::SampledTrajectoryV2>;
84 virtual public DMPInstanceBase
93 dmp(new DMP::BasicDMP()),
112 DMPInstance(DMP::DMPInterfacePtr dmpInter, std::string DMPType);
120 void setParameter(
const std::string& paraId,
const Ice::DoubleSeq&
value, const ::Ice::Current& = Ice::emptyCurrent)
override;
126 void setGoal(
const Ice::DoubleSeq&
value, const ::Ice::Current& = Ice::emptyCurrent)
override;
132 void setStartPosition(
const Ice::DoubleSeq&
value, const ::Ice::Current& = Ice::emptyCurrent)
override;
138 void setDMPState(
const cStateVec& state, const ::Ice::Current& = Ice::emptyCurrent)
override;
162 void setAmpl(
int dim,
double value, const ::Ice::Current& = Ice::emptyCurrent)
override;
170 double getAmpl(
int dim, const ::Ice::Current& = Ice::emptyCurrent)
override;
177 double getForceTerm(
const Ice::DoubleSeq& canVal,
int dim, const ::Ice::Current& = Ice::emptyCurrent)
override;
197 return dmp->getDampingFactor();
205 return dmp->getSpringFactor();
211 std::string
getDMPType(const ::Ice::Current& = Ice::emptyCurrent)
override
213 return dmp->getDMPType();
219 int getDMPDim(const ::Ice::Current& = Ice::emptyCurrent)
override
229 return dmp->getStartPositions();
235 Ice::DoubleSeq
getTrajGoal(const ::Ice::Current& = Ice::emptyCurrent)
override;
242 Ice::DoubleSeq
getGoal(
const Ice::Current& = Ice::emptyCurrent);
246 void trainDMP(const ::Ice::Current& = Ice::emptyCurrent)
override;
248 void readTrajectoryFromFile(
const std::string& file,
double times = 1, const ::Ice::Current& = Ice::emptyCurrent)
override;
263 cStateVec
getNextState(
const cStateVec& states, const ::Ice::Current& = Ice::emptyCurrent)
override;
286 const ::Ice::DoubleSeq& goal,
const cStateVec& initStates, const ::Ice::DoubleSeq&
canonicalValues,
double temporalFactor,
const Ice::Current& = Ice::emptyCurrent)
override;
315 nStateValues
calcNextState(
double t,
const Ice::DoubleSeq& goal,
double currentT,
const Vec2D& currentStates,
const Ice::DoubleSeq&
canonicalValues,
double temporalFactor, const::Ice::Current& = Ice::emptyCurrent)
override;
316 Vec2D
calcTrajectoryV2(
const Ice::DoubleSeq& timestamps,
const Ice::DoubleSeq& goal,
const Vec2D& initStates,
const Ice::DoubleSeq&
canonicalValues,
double temporalFactor,
const Ice::Current& = Ice::emptyCurrent)
override;
void trainDMP(const ::Ice::Current &=Ice::emptyCurrent) override
std::pair< std::string, paraType > configPair
Ice::DoubleSeq getStartPosition(const ::Ice::Current &=Ice::emptyCurrent) override
getStartPosition: get start position of dmp
DMP::DMPInterfacePtr getDMP()
Vec2D calcTrajectoryFromConfig(const Ice::DoubleSeq ×tamps, const Vec2D &initStates, const Ice::DoubleSeq &canonicalValues, const Ice::Current &=Ice::emptyCurrent) override
Vec2D calcTrajectoryV2(const Ice::DoubleSeq ×tamps, const Ice::DoubleSeq &goal, const Vec2D &initStates, const Ice::DoubleSeq &canonicalValues, double temporalFactor, const Ice::Current &=Ice::emptyCurrent) override
double getAmpl(int dim, const ::Ice::Current &=Ice::emptyCurrent) override
getAmpl: get current amplitude of a dimension
void setDMPState(const cStateVec &state, const ::Ice::Current &=Ice::emptyCurrent) override
setDMPState set current state for dmp
double getDampingFactor(const ::Ice::Current &=Ice::emptyCurrent) override
getDampingFactor: get dmp's damping factor
cStateVec getCurrentState(const ::Ice::Current &=Ice::emptyCurrent) override
getCurrentState: get current state in dmp
int getDMPDim(const ::Ice::Current &=Ice::emptyCurrent) override
getDMPDim: get dimesions of dmp
void setParameter(const std::string ¶Id, const Ice::DoubleSeq &value, const ::Ice::Current &=Ice::emptyCurrent) override
setParameter set parameters for
boost::variant< double, DMP::DVec, Eigen::Quaternionf > paraType
void setTemporalFactor(double value, const ::Ice::Current &=Ice::emptyCurrent) override
setTemporalFactor: set dmp temporal factor
void setStartPosition(const Ice::DoubleSeq &value, const ::Ice::Current &=Ice::emptyCurrent) override
setStartPosition set the start position for dmp
cStateVec getTrajStartState(const ::Ice::Current &=Ice::emptyCurrent) override
getTrajStartState: get the start state of the training trajectory
void setConfigurationMap(const DMPConfigMap &value, const ::Ice::Current &=Ice::emptyCurrent) override
setConfigurationMap set dmp configurations using configMap
std::map< std::string, paraType > configMap
void readTrajectoryFromFile(const std::string &file, double times=1, const ::Ice::Current &=Ice::emptyCurrent) override
double getSpringFactor(const ::Ice::Current &=Ice::emptyCurrent) override
getSpringFactor: get dmp's spring factor
std::shared_ptr< Value > value()
void setTimeStep(double ts)
nStateValues calcNextState(double t, const Ice::DoubleSeq &goal, double currentT, const Vec2D ¤tStates, const Ice::DoubleSeq &canonicalValues, double temporalFactor, const ::Ice::Current &=Ice::emptyCurrent) override
Ice::DoubleSeq getTrajGoal(const ::Ice::Current &=Ice::emptyCurrent) override
getTrajGoal: get the goal of the training trajectory
cStateVec getNextStateWithCurrentState(const ::Ice::Current &=Ice::emptyCurrent) override
getNextState: get next state according to the state given
Vec2D calcTrajectory(double startTime, double timestep, double endTime, const ::Ice::DoubleSeq &goal, const cStateVec &initStates, const ::Ice::DoubleSeq &canonicalValues, double temporalFactor, const Ice::Current &=Ice::emptyCurrent) override
calcTrajectory solves the DMP for all Timesteps
Ice::DoubleSeq getGoal(const Ice::Current &=Ice::emptyCurrent)
DMP::DVec canonicalValues
void setCurrentTime(double t)
Ice::DoubleSeq getCanonicalValues(const ::Ice::Current &=Ice::emptyCurrent) override
getCanonicalValues: get current canonical values
cStateVec getNextState(const cStateVec &states, const ::Ice::Current &=Ice::emptyCurrent) override
getNextState: get next state according to the state given
DMP::Vec< DMP::SampledTrajectoryV2 > TrajVec
void setGoal(const Ice::DoubleSeq &value, const ::Ice::Current &=Ice::emptyCurrent) override
setGoal set the goal for dmp
#define ARMARX_DMPTYPE_BASICDMP
Base Class for all Logging classes.
nStateValues calcNextStateFromConfig(double t, double currentT, const Vec2D ¤tStates, const Ice::DoubleSeq &canonicalValues, const Ice::Current &=Ice::emptyCurrent) override
double getForceTerm(const Ice::DoubleSeq &canVal, int dim, const ::Ice::Current &=Ice::emptyCurrent) override
getForceTerm: get force termf for one dimension at a specified canonical values
std::string getDMPType(const ::Ice::Current &=Ice::emptyCurrent) override
getDMPType: get dmp type
configMap createConfigMap(DMP::Vec< std::string > paraIDs, DMP::Vec< paraType > paraVals)
void setAmpl(int dim, double value, const ::Ice::Current &=Ice::emptyCurrent) override
setAmpl: set amplitude for dmp
DMPInstance()
DMPInstance constructs an empty instance of a basicDMP.
double getTemporalFactor(const ::Ice::Current &=Ice::emptyCurrent) override
getTemporalFactor: get current temporal factor
DMPInstance(DMP::DMPInterfacePtr dmpInter)
void setCanonicalValues(const Ice::DoubleSeq &value, const ::Ice::Current &=Ice::emptyCurrent) override
setCanonicalValues: set dmp canonicalValues to control the dmp's state
This file offers overloads of toIce() and fromIce() functions for STL container types.