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 "../Controller/AbstractController.h"
27 
28 #include <memory>
29 
30 #include "RobotVisualization.h"
31 #include "../Model/DesignerTrajectory.h"
32 
33 
34 
35 namespace armarx
36 {
37  class DesignerTrajectoryPlayer : public QObject
38  {
39  Q_OBJECT
40 
41  public:
42  /**
43  * @brief DesignerTrajectoryPlayer construct a new DesignerTrajectoryPlayer that can be started to play a Trajectory
44  * @param viewer the viewers to run the player on
45  * @param robot the robot to execute the trajectory on
46  */
48  /**
49  * @brief addTrajectory inserts a trajetory to the DesignerTrajectory player
50  * All added Trajectories will be played when calling the startPlayback method
51  * @param trajectory the trajectory to add
52  */
53  void addTrajectory(DesignerTrajectoryPtr trajectory);
54  /**
55  * @brief startPlayback starts the actual visualization of the trajectory
56  */
57  void startPlayback();
58  /**
59  * @brief setFPS sets the refresh rate of the player (the amount of updates of the visualization) to fps
60  * @param fps the amount of frames that the player shows per second (see Hz)
61  */
62  void setFPS(int fps);
63 
64 
65  private slots:
66  void updateLoop();
67 
68  signals:
69  /**
70  * @brief finishedPlayback tells all relevant controllers that the trajectory playback has stopped
71  */
72  void finishedPlayback();
73 
74  private:
75  std::shared_ptr<QTimer> timer;
77  RobotVisualizationPtr viewer;
78  std::vector<DesignerTrajectoryPtr> trajectories;
79  std::vector<TrajectoryPtr> timeOptimalTrajectories;
80  double currentTime;
81  int fps;
82 
83 
84  };
85  using DesignerTrajectoryPlayerPtr = std::shared_ptr<DesignerTrajectoryPlayer>;
86 }
87 
88 
89 
90 
91 #endif
armarx::DesignerTrajectoryPlayer::finishedPlayback
void finishedPlayback()
finishedPlayback tells all relevant controllers that the trajectory playback has stopped
armarx::DesignerTrajectoryPlayerPtr
std::shared_ptr< DesignerTrajectoryPlayer > DesignerTrajectoryPlayerPtr
Definition: DesignerTrajectoryPlayer.h:85
armarx::DesignerTrajectoryPlayer::DesignerTrajectoryPlayer
DesignerTrajectoryPlayer(RobotVisualizationPtr viewer, VirtualRobot::RobotPtr robot)
DesignerTrajectoryPlayer construct a new DesignerTrajectoryPlayer that can be started to play a Traje...
Definition: DesignerTrajectoryPlayer.cpp:11
armarx::DesignerTrajectoryPlayer::startPlayback
void startPlayback()
startPlayback starts the actual visualization of the trajectory
Definition: DesignerTrajectoryPlayer.cpp:56
armarx::DesignerTrajectoryPlayer
Definition: DesignerTrajectoryPlayer.h:37
armarx::RobotVisualizationPtr
std::shared_ptr< RobotVisualization > RobotVisualizationPtr
Definition: RobotVisualization.h:161
armarx::DesignerTrajectoryPtr
std::shared_ptr< DesignerTrajectory > DesignerTrajectoryPtr
Definition: DesignerTrajectory.h:165
RobotVisualization.h
armarx::DesignerTrajectoryPlayer::setFPS
void setFPS(int fps)
setFPS sets the refresh rate of the player (the amount of updates of the visualization) to fps
Definition: DesignerTrajectoryPlayer.cpp:81
armarx::DesignerTrajectoryPlayer::addTrajectory
void addTrajectory(DesignerTrajectoryPtr trajectory)
addTrajectory inserts a trajetory to the DesignerTrajectory player All added Trajectories will be pla...
Definition: DesignerTrajectoryPlayer.cpp:51
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18