24 #include <SimoxUtility/json.h>
27 #include <ArmarXCore/interface/core/BasicTypes.h>
28 #include <ArmarXCore/interface/serialization/Eigen.h>
30 #include <armarx/control/common/mp/aron/MPConfig.aron.generated.h>
32 #include <mplib/factories/AbstractMPFactory.h>
33 #include <mplib/factories/MPFactoryCreator.h>
34 #include <mplib/factories/VMPFactory.h>
35 #include <mplib/representation/vmp/PrincipalComponentVMP.h>
36 #include <mplib/representation/vmp/TaskSpacePrincipalComponentVMP.h>
37 #include <mplib/representation/vmp/VMP.h>
41 using namespace arondto;
42 using VMPPtr = std::shared_ptr<mplib::representation::vmp::PrincipalComponentVMP>;
46 using DVec = Ice::DoubleSeq;
70 MP(
const MPConfig&
c);
71 virtual ~
MP() =
default;
73 const std::string& getMPName()
const;
74 const std::string& getClassName()
const;
75 const std::string& getNodeSetName()
const;
76 const std::string& getRole()
const;
80 void start(
const DVec& goals);
83 void start(
const DVec& goals,
const DVec& starts);
96 void learnFromCSV(
const Ice::StringSeq& fileNames = std::vector<std::string>());
98 void trainMPFromTraj(std::vector<mplib::core::SampledTrajectory>& trajs);
102 void setGoal(
const DVec& goals);
103 void setStart(
const DVec& starts);
104 std::vector<double> getStartVec();
105 void setStartAndGoal(
const DVec& starts,
const DVec& goals);
107 void removeAllViaPoint();
112 void setWeight(
const DVecVec& weights);
113 void setTranslationWeights(
const DVecVec& weights);
114 void setRotationWeights(
const DVecVec& weights);
116 std::string serialize(
const std::string& mode =
"string");
117 DVec deserialize(
const std::string&,
const std::string& mode =
"string");
120 double getCanonicalValue();
125 resetVMPType(
const std::string& mpTypeString)
127 if (mpTypeString !=
"")
129 vmpType = mplib::representation::VMPType::_from_string_nocase(mpTypeString.c_str());
136 bool isDisturbance =
false;
140 mplib::representation::VMPType vmpType = mplib::representation::VMPType::PrincipalComponent;
145 double canonicalValue = 1.0;
146 std::atomic_bool firstRun =
true;
148 std::atomic_bool goalSetByUser{
false};
151 std::atomic_bool mpTrained{
false};