3 #include <dmp/representation/dmp/umitsmp.h>
4 #include <VirtualRobot/MathTools.h>
11 std::map<double, DMP::DVec> traj_map;
13 for(
auto element : dto.taskSpace.steps){
15 pose.push_back(element.pose(0,3));
16 pose.push_back(element.pose(1,3));
17 pose.push_back(element.pose(2,3));
19 pose.push_back(quat.w);
20 pose.push_back(quat.x);
21 pose.push_back(quat.y);
22 pose.push_back(quat.z);
23 traj_map.insert(std::make_pair(element.timestep, pose));
27 for(
auto element : dto.jointSpace.steps){
29 for(
auto angle: element.jointValues){
30 jointvalues.push_back(
double(
angle));
32 traj_map.insert(std::make_pair(element.timestep, jointvalues));
37 void toAron(
arondto::Trajectory &dto,
const DMP::SampledTrajectoryV2 &bo_taskspace,
const DMP::SampledTrajectoryV2 &bo_jointspace,
const std::string name)
40 std::map<std::string, std::vector<float>> mapJointSpace;
43 std::map<double, DMP::DVec> ts_map = bo_taskspace.getPositionData();
44 for(std::pair<double, DMP::DVec> element: ts_map){
45 Eigen::Vector3f vec(element.second.at(0), element.second.at(1), element.second.at(2));
46 Eigen::Matrix<float, 4, 4> poseMatrix = VirtualRobot::MathTools::quat2eigen4f(element.second.at(4), element.second.at(5), element.second.at(6), element.second.at(3));
47 poseMatrix.block<3, 1>(0, 3) = vec;
48 arondto::TSElement tselement;
49 tselement.timestep = element.first;
50 tselement.pose = poseMatrix;
51 dto.taskSpace.steps.push_back(tselement);
56 std::map<double, DMP::DVec> js_map = bo_jointspace.getPositionData();
57 for(std::pair<double, DMP::DVec> element: js_map){
58 std::vector<float> configvec;
59 for(
double el: element.second){
60 configvec.push_back(
float(el));
62 arondto::JSElement jselement;
63 jselement.timestep = element.first;
64 jselement.jointValues = configvec;
65 dto.jointSpace.steps.push_back(jselement);