DesignerTrajectoryPlayer.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package ArmarXGuiPlugins::RobotTrajectoryDesigner::Visualization
17 * @author Timo Birr
18 * @date 2018
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22#ifndef DESIGNERTRAJECTORYPLAYER_H
23#define DESIGNERTRAJECTORYPLAYER_H
24
25//this include needs to be here so there is not problem with a Q_FOREACH macro
26#include <memory>
27
30#include "RobotVisualization.h"
31
32namespace armarx
33{
34 class DesignerTrajectoryPlayer : public QObject
35 {
36 Q_OBJECT
37
38 public:
39 /**
40 * @brief DesignerTrajectoryPlayer construct a new DesignerTrajectoryPlayer that can be started to play a Trajectory
41 * @param viewer the viewers to run the player on
42 * @param robot the robot to execute the trajectory on
43 */
45 /**
46 * @brief addTrajectory inserts a trajetory to the DesignerTrajectory player
47 * All added Trajectories will be played when calling the startPlayback method
48 * @param trajectory the trajectory to add
49 */
51 /**
52 * @brief startPlayback starts the actual visualization of the trajectory
53 */
54 void startPlayback();
55 /**
56 * @brief setFPS sets the refresh rate of the player (the amount of updates of the visualization) to fps
57 * @param fps the amount of frames that the player shows per second (see Hz)
58 */
59 void setFPS(int fps);
60
61
62 private slots:
63 void updateLoop();
64
65 signals:
66 /**
67 * @brief finishedPlayback tells all relevant controllers that the trajectory playback has stopped
68 */
70
71 private:
72 std::shared_ptr<QTimer> timer;
75 std::vector<DesignerTrajectoryPtr> trajectories;
76 std::vector<TrajectoryPtr> timeOptimalTrajectories;
77 double currentTime;
78 int fps;
79 };
80
81 using DesignerTrajectoryPlayerPtr = std::shared_ptr<DesignerTrajectoryPlayer>;
82} // namespace armarx
83
84
85#endif
void setFPS(int fps)
setFPS sets the refresh rate of the player (the amount of updates of the visualization) to fps
void startPlayback()
startPlayback starts the actual visualization of the trajectory
void finishedPlayback()
finishedPlayback tells all relevant controllers that the trajectory playback has stopped
void addTrajectory(DesignerTrajectoryPtr trajectory)
addTrajectory inserts a trajetory to the DesignerTrajectory player All added Trajectories will be pla...
DesignerTrajectoryPlayer(RobotVisualizationPtr viewer, VirtualRobot::RobotPtr robot)
DesignerTrajectoryPlayer construct a new DesignerTrajectoryPlayer that can be started to play a Traje...
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::shared_ptr< DesignerTrajectoryPlayer > DesignerTrajectoryPlayerPtr
std::shared_ptr< DesignerTrajectory > DesignerTrajectoryPtr
std::shared_ptr< RobotVisualization > RobotVisualizationPtr