controllertabs.h 3.14 KB
Newer Older
1
2
3
4
#ifndef CONTROLLERTABS_H
#define CONTROLLERTABS_H

#include <QWidget>
5
#include <QMutex>
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <QVector>

#ifdef CATKIN_MAKE
#include <ros/ros.h>
#include <ros/network.h>
#include <ros/package.h>

// Include the standard message types
//#include "std_msgs/Int32.h"
//#include "std_msgs/Float32.h"
//#include <std_msgs/String.h>

// Include the DFALL message types
//#include "d_fall_pps/IntWithHeader.h"
//#include "d_fall_pps/SetpointWithHeader.h"
#include "d_fall_pps/CrazyflieData.h"
22
#include "d_fall_pps/ViconData.h"
23
24
25
26
27
28
29
30
31
32
33
34

// Include the shared definitions
//#include "nodes/Constants.h"

// SPECIFY THE PACKAGE NAMESPACE
//using namespace d_fall_pps;

#else
// Include the shared definitions
//#include "include/Constants_for_Qt_compile.h"

#endif
35
36
37
38
39
40
41
42
43
44
45
46
47

namespace Ui {
class ControllerTabs;
}

class ControllerTabs : public QWidget
{
    Q_OBJECT

public:
    explicit ControllerTabs(QWidget *parent = 0);
    ~ControllerTabs();

48
    // PUBLIC METHODS FOR TOGGLING THE VISISBLE CONTROLLERS
49
    void showHideController_toggle(QString qstr_label, QWidget * tab_widget_to_toggle);
50
51
52
53
54
    void showHideController_default_changed();
    void showHideController_student_changed();
    void showHideController_picker_changed();
    void showHideController_safe_changed();

55

56
57
58
59
60
public slots:
    void setAgentIDsToCoordinate(QVector<int> agentIDs , bool shouldCoordinateAll);
    void setObjectNameForDisplayingPoseData( QString object_name );


61
signals:
62
    void agentIDsToCoordinateChanged(QVector<int> agentIDs , bool shouldCoordinateAll);
63
    void measuredPoseValueChanged(float x , float y , float z , float roll , float pitch , float yaw , bool occluded);
64
    void poseDataUnavailableSignal();
65
66


67
68
private:
    Ui::ControllerTabs *ui;
69

70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
    // --------------------------------------------------- //
    // PRIVATE VARIABLES

    // The type of this node, i.e., agent or a coordinator,
    // specified as a parameter in the "*.launch" file
    int m_type = 0;

    // The ID  of this node
    int m_ID;

    // For coordinating multiple agents
    std::vector<int> m_vector_of_agentIDs_toCoordinate;
    bool m_shouldCoordinateAll = true;
    QMutex m_agentIDs_toCoordinate_mutex;

85
86
87
88
89
90
91
92
93
    // The object name for which motion capture pose data
    // will be "emitted" using the "measuredPoseValueChanged"
    // signal
    std::string m_object_name_for_emitting_pose_data;

    // Flag for whether pose data should be emitted, this is
    // to save looking through the data when it is unnecessary
    bool m_should_search_pose_data_for_object_name = false;

94
95
96
97
98
99
100

#ifdef CATKIN_MAKE
    // --------------------------------------------------- //
    // PRIVATE VARIABLES FOR ROS

    // SUBSRIBER
    // > For the pose data from a motion capture system
101
102
    ros::Subscriber m_poseDataSubscriber;
#endif
103
104


105
#ifdef CATKIN_MAKE
106
107
108
109
110
    // --------------------------------------------------- //
    // PRIVATE CALLBACKS IN RESPONSE TO ROS MESSAGES

    // > For the controller currently operating, received on
    //   "controllerUsedSubscriber"
111
    void poseDataReceivedCallback(const d_fall_pps::ViconData& viconData);
112

113
114
    // Get the paramters that specify the type and ID
    bool getTypeAndIDParameters();
115
116
117
#endif


118
119
120
};

#endif // CONTROLLERTABS_H