EtherCAT Graphical User Interface Code 0.0.1
EtherCAT GUI that uses different communication protocols with EtherCAT Master server.
Loading...
Searching...
No Matches
ec_gui_pdo.h
1#ifndef EC_GUI_PDO_H
2#define EC_GUI_PDO_H
3
4#include <QtUiTools>
5#include <QWidget>
6
7#include "ec_gui_slider.h"
8#include "qcustomplot.h"
9
10
11class EcGuiPdo : public QWidget
12{
13 Q_OBJECT
14
15public:
16
17 typedef std::shared_ptr<EcGuiPdo> Ptr;
18
19 EcGuiPdo(EcGuiSlider::Ptr ec_gui_slider,
20 QWidget * parent = 0);
21
22 ~EcGuiPdo();
23
24 void restart_ec_gui_pdo(EcIface::Ptr client,EcLogger::Ptr ec_logger);
25 void restart_receive_timer();
26 void read();
27 void starting_write(int time_ms);
28 void stopping_write();
29 void write();
30 void sync_write();
31 void log();
32
33private:
34 EcIface::Ptr _client;
35 EcLogger::Ptr _ec_logger;
36 EcGuiSlider::Ptr _ec_gui_slider;
37 EcGuiSlider::slider_map_t _slider_map;
38
39 //************************ READ PDO ******************************
40
41 QTreeWidget *_tree_wid;
42 QElapsedTimer *_receive_timer;
43 QElapsedTimer *_send_timer;
44 QCustomPlot *_custom_plot;
45 QPushButton * _stop_plotting_btn;
46 QCheckBox *_auto_scroll;
47 QLabel *_time_pdo;
48 std::map<int,QTreeWidgetItem *> _esc_pdo_map;
49 std::map<int,std::vector<QCPGraph *>> _graph_pdo_map;
50 std::map<int,std::vector<float>> _pdo_v;
51 std::map<int,std::vector<QVector<double>>> _buffer_pdo_map;
52 QVector<double> _buffer_time;
53 bool _update_plot,_first_update;
54 qint64 _ms_receive_time,_ms_send_time;
55 double _s_receive_time,_s_send_time;
56 float _currentHue = 0.0;
57 uint16_t _counter_buffer;
58 uint16_t _buffer_size;
59
60 // last received motor data
61 MotorStatusMap _motor_status_map;
62 MotorReferenceMap _motor_reference_map,_motor_ref_map;
63 // last received ft data
64 FtStatusMap _ft_status_map;
65 // last received pow data
66 PwrStatusMap _pow_status_map;
67 // last received imu data
68 ImuStatusMap _imu_status_map;
69 // last received valve data
70 ValveStatusMap _valve_status_map;
71 ValveReferenceMap _valve_reference_map,_valve_ref_map;
72 // last received pump data
73 PumpStatusMap _pump_status_map;
74 PumpReferenceMap _pump_reference_map,_pump_ref_map;
75
76 QLCDNumber *_battery_level;
77
78 void create_graph(const int &esc_id,const int &index,const std::string &esc_pdo_name);
79 QTreeWidgetItem * retrieve_treewid_item(const int &esc_id,
80 const std::string &esc_type,
81 const std::vector<std::string> &pdo_fields,
82 const std::string direction);
83 void fill_data(const int &esc_id,
84 QTreeWidgetItem * topLevel,
85 const std::vector<std::string> &pdo_fields,
86 const std::vector<float> &pdo);
87 void onStopPlotting();
88
89 void update_plot();
90
91 void read_motor_status();
92 void read_ft_status();
93 void read_pow_status();
94 void read_imu_status();
95 void read_valve_status();
96 void read_pump_status();
97 //************************ READ PDO ******************************
98
99 //************************ WRITE PDO ******************************
100 int _time_ms;
101 bool check_write_device(std::map<int, SliderWidget*> slider_map);
102 void init_write_pdo();
103 void write_motor_pdo();
104 void write_valve_pdo();
105 void write_pump_pdo();
106
107 //************************ WRITE PDO ******************************
108
109 //************************ LOG PDO ******************************
110 bool _motors_selected,_valves_selected,_pumps_selected;
111
112};
113
114#endif // EC_GUI_PDO_H
115
116
Definition ec_gui_pdo.h:12
The central class of the library. This is the QWidget which displays the plot and interacts with the ...
Definition qcustomplot.h:3791
Definition ec_gui_slider.h:17