24 #include <unordered_set>
27 using namespace PlayMMMFile;
43 std::unordered_set<std::string> jointsBlacklist;
44 if (in.isblacklistSet())
46 std::string
s = in.getblacklist();
47 std::string delimiter =
",";
50 while ((pos =
s.find(delimiter)) != std::string::npos)
52 token =
s.substr(0, pos);
53 jointsBlacklist.insert(token);
54 s.erase(0, pos + delimiter.length());
56 jointsBlacklist.insert(
s);
60 this->getMmmPlayer()->loadMMMFile(in.getmmmFile(),
"");
61 if (this->getMmmPlayer()->isMotionLoaded())
63 this->getTrajectoryPlayer()->setIsVelocityControl(
true);
64 TrajectoryPtr trajectory = TrajectoryPtr::dynamicCast(this->getMmmPlayer()->getJointTraj());
65 float start = in.isStartTimeSet() ? in.getStartTime() : trajectory->begin()->timestamp;
66 float end = in.isEndTimeSet() ? in.getEndTime() : trajectory->rbegin()->timestamp;
67 ARMARX_INFO <<
"StartTime of Traj: " << trajectory->begin()->timestamp;
68 ARMARX_INFO <<
"EndTime of Traj: " << trajectory->rbegin()->timestamp;
69 ARMARX_INFO <<
"names: " << trajectory->getDimensionNames();
71 ARMARX_INFO <<
"StartTime of Traj: " << trajPart->begin()->timestamp;
72 ARMARX_INFO <<
"EndTime of Traj: " << trajPart->rbegin()->timestamp;
73 ARMARX_INFO <<
" amplitude: " << trajPart->getAmplitude(0, 0, start, end);
74 ARMARX_INFO <<
"names: " << trajPart->getDimensionNames();
75 this->getTrajectoryPlayer()->loadJointTraj(trajPart);
76 this->getTrajectoryPlayer()->loadBasePoseTraj(this->getMmmPlayer()->getBasePoseTraj());
79 auto map = trajPart->getStatesMap<
float>(trajPart->begin()->timestamp);
80 for (
auto it = map.begin(); it != map.end();)
82 if (!this->getKinematicUnitObserver()->existsDataField(
"jointangles", it->first))
92 Ice::StringSeq jointNames = this->getMmmPlayer()->getJointNames();
93 for (
size_t i = 0; i < jointNames.size(); ++i)
96 bool enabled = !jointsBlacklist.count(jointNames.at(i));
100 this->getTrajectoryPlayer()->setJointsInUse(jointNames.at(i),
true);
104 ARMARX_LOG << jointNames.at(i) <<
" disabled";
105 this->getTrajectoryPlayer()->setJointsInUse(jointNames.at(i),
false);
106 map.erase(jointNames.at(i));
111 this->getTrajectoryPlayer()->setEndTime(this->getTrajectoryPlayer()->getTrajEndTime() / in.getspeed());
114 local.setinitialJointValues(map);
147 this->getTrajectoryPlayer()->stopTrajectoryPlayer();