-
Notifications
You must be signed in to change notification settings - Fork 0
/
taskwidget.h
126 lines (92 loc) · 3.02 KB
/
taskwidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#ifndef TASKWIDGET_H
#define TASKWIDGET_H
#include <QWidget>
#include <QTimer>
#include <ocra-recipes/TaskConnection.h>
#include <ocra/control/TaskState.h>
#include <ocra/util/StringUtilities.h>
#include <yarp/os/all.h>
#include "messagetypes.h"
#include "yarptools.h"
#include "physicstools.h"
namespace Ui {
class TaskWidget;
}
class TaskWidget : public QWidget
{
Q_OBJECT
public:
explicit TaskWidget(const std::string& name, QWidget *parent = 0);
virtual ~TaskWidget();
void refreshParameters();
QString poseToString(const std::vector<double> &poseVector);
bool connectToGazebo();
QString displacementToString(const Eigen::Displacementd &disp);
public slots:
void updateCurrentState();
void updateDesiredState();
void connectPorts();
void disconnectPorts();
void disconnectDesiredStateInput();
void sendAndReconnectDesiredStateInput();
void changeGazeboOffset(const Eigen::Displacementd &newOffset);
private slots:
void on_activateButton_clicked(bool checked);
void on_deactivateButton_clicked(bool checked);
void on_gazeboButton_clicked(bool checked);
void on_weightLineEdit_editingFinished();
void on_levelLineEdit_editingFinished();
void on_kpLineEdit_editingFinished();
void on_kdLineEdit_editingFinished();
void readCurrentStatePort();
void readDesiredStatePort();
private:
void updateParameterValues();
void sendPosesToGazebo();
signals:
void addGazeboFrames(const std::string& name);
void removeGazeboFrames(const std::string& name);
void parameterValuesChanged();
void currentStateUpdated();
void desiredStateUpdated();
void showUserMessage(const std::string& msg, MESSAGE_TYPE type);
void getRobotWorldPose();
private:
Ui::TaskWidget *ui;
ocra_recipes::TaskConnection::Ptr taskCon;
bool currentlyEditing;
std::string m_name;
std::string m_type;
double m_weight;
int m_level;
double m_kp;
double m_kd;
private:
yarp::os::Network yarp;
std::string taskStatePortOutName;
std::string taskStatePortInName;
std::string framePortInName;
std::string framePortOutName;
std::string targetPortInName;
std::string targetPortOutName;
yarp::os::Port framePortOut;
yarp::os::Port targetPortOut;
yarp::os::BufferedPort<yarp::os::Bottle> taskStateInPort;
yarp::os::Bottle* currentStateBottle;
std::string taskDesiredStatePortOutName;
std::string taskDesiredStatePortInName;
yarp::os::BufferedPort<yarp::os::Bottle> taskDesiredStateInPort;
yarp::os::Bottle* desiredStateBottle;
ocra::TaskState currentState;
ocra::TaskState desiredState;
QTimer* m_currentStatePortReadTimer;
QTimer* m_desiredStatePortReadTimer;
yarp::os::Bottle frameOutputBottle;
std::vector<double> framePose;
yarp::os::Bottle targetOutputBottle;
std::vector<double> targetPose;
Eigen::Displacementd gazeboCurrentStateDisp;
Eigen::Displacementd gazeboDesiredStateDisp;
Eigen::Displacementd gazeboOffset;
};
#endif // TASKWIDGET_H