13 this->viewer = viewer;
15 this->currentTime = 0;
17 this->trajectories = std::vector<DesignerTrajectoryPtr>();
18 this->timeOptimalTrajectories = std::vector<TrajectoryPtr>();
21 void DesignerTrajectoryPlayer::updateLoop()
23 bool endReached =
true;
26 for (
TrajectoryPtr currentTrajectory : this->timeOptimalTrajectories)
28 if (!currentTrajectory)
32 if (currentTime < currentTrajectory->getTimeLength() * 1000)
34 Ice::DoubleSeq ice_JA = currentTrajectory->getStates(currentTime / 1000, 0);
36 std::vector<float> jA = std::vector<float>(ice_JA.begin(), ice_JA.end());
37 robot->getRobotNodeSet(trajectories[i]->getRns()->getName())->setJointValues(jA);
42 viewer->updateRobotVisualization();
43 currentTime = currentTime + (1000.0 / fps);
46 emit finishedPlayback();
53 this->trajectories.push_back(trajectory);
59 timer = std::shared_ptr<QTimer>(
new QTimer(
this));
60 connect(timer.get(), SIGNAL(timeout()),
this, SLOT(updateLoop()));
61 connect(
this, SIGNAL(finishedPlayback()), timer.get(), SLOT(stop()));
66 if (current && current->getNrOfUserWaypoints() != 1)
69 timeOptimalTrajectories.push_back(traj);
78 timer->start(1000.0 / fps);