Line |
Branch |
Exec |
Source |
1 |
|
|
// |
2 |
|
|
// Copyright (c) CNRS |
3 |
|
|
// Author: Joseph Mirabel and Heidy Dallard |
4 |
|
|
// |
5 |
|
|
|
6 |
|
|
#ifndef HPP_GUI_PATHPLAYER_HH |
7 |
|
|
#define HPP_GUI_PATHPLAYER_HH |
8 |
|
|
|
9 |
|
|
#include <QWidget> |
10 |
|
|
#include <gepetto/gui/fwd.hh> |
11 |
|
|
|
12 |
|
|
class QDoubleSpinBox; |
13 |
|
|
class QProcess; |
14 |
|
|
class QPushButton; |
15 |
|
|
class QSpinBox; |
16 |
|
|
class QSlider; |
17 |
|
|
class QTextBrowser; |
18 |
|
|
|
19 |
|
|
namespace Ui { |
20 |
|
|
class PathPlayerWidget; |
21 |
|
|
} |
22 |
|
|
|
23 |
|
|
namespace hpp { |
24 |
|
|
namespace gui { |
25 |
|
|
class HppWidgetsPlugin; |
26 |
|
|
|
27 |
|
|
class PathPlayer : public QWidget { |
28 |
|
✗ |
Q_OBJECT |
29 |
|
|
|
30 |
|
|
public: |
31 |
|
|
PathPlayer(HppWidgetsPlugin* plugin, QWidget* parent = 0); |
32 |
|
|
~PathPlayer(); |
33 |
|
|
|
34 |
|
|
public slots: |
35 |
|
|
/// Returns the path currently selected. |
36 |
|
|
int getCurrentPath() const; |
37 |
|
|
|
38 |
|
|
/// Display the waypoints of a joint in the viewer. |
39 |
|
|
/// The waypoints are those of the currently selected path index. |
40 |
|
|
/// \param jointName name of the joint |
41 |
|
|
void displayWaypointsOfPath(const std::string jointName); |
42 |
|
|
|
43 |
|
|
/// Prepare the display of the path of a joint in the viewer. |
44 |
|
|
/// The path is took from the currently selected path index. |
45 |
|
|
/// \param jointName name of the joint |
46 |
|
|
void displayPath(const std::string jointName); |
47 |
|
|
|
48 |
|
|
/// Get the number of paths in hpp and refresh the gui accordingly. |
49 |
|
|
void update(); |
50 |
|
|
|
51 |
|
|
/// Tells the path player to set the robot current velocity. |
52 |
|
|
void setRobotVelocity(bool set); |
53 |
|
|
|
54 |
|
|
/// Distance between two sampling point |
55 |
|
|
double lengthBetweenRefresh() const; |
56 |
|
|
|
57 |
|
|
/// Set the slider position |
58 |
|
|
void setCurrentTime(const double& param); |
59 |
|
|
|
60 |
|
|
protected: |
61 |
|
|
/// Display the path of the jointName in the viewer. |
62 |
|
|
/// The path is took from the currently selected path index. |
63 |
|
|
/// \param jointName name of the joint |
64 |
|
|
virtual void displayPath_impl(const std::string jointName); |
65 |
|
|
signals: |
66 |
|
|
void displayPath_status(int progress); |
67 |
|
|
void appliedConfigAtParam(int pid, double param); |
68 |
|
|
|
69 |
|
|
private slots: |
70 |
|
|
void pathIndexChanged(int i); |
71 |
|
|
void pathSliderChanged(int value); |
72 |
|
|
// void timeChanged (double d); |
73 |
|
|
void playPauseToggled(bool toggled); |
74 |
|
|
void stopClicked(); |
75 |
|
|
void pathPulse(); |
76 |
|
|
void timerEvent(QTimerEvent* event); |
77 |
|
|
|
78 |
|
|
private: |
79 |
|
|
void initSearchActions(); |
80 |
|
|
void updateConfiguration(); |
81 |
|
|
double sliderToLength(int v) const; |
82 |
|
|
int lengthToSlider(double l) const; |
83 |
|
|
double timeToLength(double time) const; |
84 |
|
|
int timeBetweenRefresh() const; |
85 |
|
|
|
86 |
|
|
::Ui::PathPlayerWidget* ui_; |
87 |
|
|
|
88 |
|
|
QDoubleSpinBox* timeSpinBox() const; |
89 |
|
|
QSpinBox* pathIndex() const; |
90 |
|
|
QSlider* pathSlider() const; |
91 |
|
|
QPushButton* playPause() const; |
92 |
|
|
QPushButton* stop() const; |
93 |
|
|
|
94 |
|
|
double pathLength_; |
95 |
|
|
double currentParam_; |
96 |
|
|
int timerId_; |
97 |
|
|
bool velocity_; |
98 |
|
|
|
99 |
|
|
HppWidgetsPlugin* plugin_; |
100 |
|
|
}; |
101 |
|
|
} // namespace gui |
102 |
|
|
} // namespace hpp |
103 |
|
|
|
104 |
|
|
#endif // HPP_GUI_PATHPLAYER_HH |
105 |
|
|
|