YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
sequencewindow.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 */
6
7#ifndef SEQUENCEWINDOW_H
8#define SEQUENCEWINDOW_H
9
10#include <QMainWindow>
11#include <QCloseEvent>
12#include <QTreeWidgetItem>
13#include <QDropEvent>
14#include <QDebug>
15#include <QItemDelegate>
16#include <yarp/conf/compiler.h>
17
19class SequenceItem;
20
21namespace Ui {
22class SequenceWindow;
23}
24
25
26class SequenceWindow : public QMainWindow
27{
28 Q_OBJECT
29
30public:
31 explicit SequenceWindow(QString partName, int count,QWidget *parent = 0);
33 bool checkAndGo();
34 bool checkAndRun();
35 bool checkAndRunTime();
36 bool checkAndCycleSeq();
38 void save(QString global_filename);
39 void loadSequence(QList<SequenceItem>);
40
41protected:
42 void closeEvent(QCloseEvent *event) override;
43
44private:
45 QList<SequenceItem> getValuesFromList();
46 QAction *goAction;
47 QAction *runTimeAction;
48 QAction *saveAction;
49 QAction *openAction;
50 QAction *cycleAllAction;
51 QAction *cycleTimeAction;
52 QAction *stopAction;
53
54 int prevCurrentIndex;
55
56
57private:
58 Ui::SequenceWindow *ui;
59 int jointCount;
60
61signals:
62 void itemDoubleClicked(int sequenceNum);
64 void runTime(QList <SequenceItem>);
65 void run(QList <SequenceItem>);
66 void cycle(QList <SequenceItem>);
67 void cycleTime(QList <SequenceItem>);
68 void saveSequence(QList <SequenceItem>, QString);
71
72public slots:
73 void onReceiveValues(int sequenceNum, QList<double>, QList<double> speeds);
74private slots:
75 void onDoubleClickPositions(QTreeWidgetItem*, int);
76 void onDoubleClickSpeed(QTreeWidgetItem *item,int column);
77 void onGo();
78 void onRunTime();
79 void onCycleTime();
80 void onCycle();
81 void onSave();
82 void onOpen();
83 void onStopSequence();
84
85 void onRunTimeSequence();
86 void onCycleTimeSequence();
87 void onCycleSequence();
88 void onStoppedSequence();
89 void onSetCurrentSequenceIndex(int index);
90 void onDeletePosition(int index);
91 void onMovePositions(int index, int dragIndex);
92
93};
94
95
96
97class SequenceTreeWidget : public QTreeWidget
98{
99 Q_OBJECT
100
101public:
102 SequenceTreeWidget(QWidget * parent = 0);
103
104private:
105 QStringList copyValues;
106
107protected:
108 void dropEvent(QDropEvent *event) override;
109
110signals:
111 void deletedItem(int index);
112 void moveItem(int itemBefore,int item);
113
114
115
116private slots:
117 void onContextMenuRequested(QPoint point);
118
119
120};
121
123{
124
125
126public:
128 sequenceNumber = 0;
129 timing = -1;
130 }
131
132 void setSequenceNumber(int index){
133 this->sequenceNumber = index;
134 }
135
136 void setTiming(double timing){
137 this->timing = timing;
138 }
139
140 void addValue(double pos, double speed){
141 positionsList.append(pos);
142 speedsList.append(speed);
143 }
144 void addPositionValue(double pos){
145 positionsList.append(pos);
146 }
147 void addSpeedValue(double speed){
148 //qDebug() << "speedsList.append(speed);" << speed;
149 speedsList.append(speed);
150 }
151
153 return sequenceNumber;
154 }
155
156 double getTiming(){
157 return timing;
158 }
159
160 QList<double> getPositions(){
161 return positionsList;
162 }
163
164 QList<double> getSpeeds(){
165 return speedsList;
166 }
167
168private:
169
170 int sequenceNumber;
171 double timing;
172 QList<double>positionsList;
173 QList<double>speedsList;
174};
175
176
177
178#endif // SEQUENCEWINDOW_H
void addValue(double pos, double speed)
void addSpeedValue(double speed)
int getSequenceNumber()
void setSequenceNumber(int index)
double getTiming()
void setTiming(double timing)
void addPositionValue(double pos)
QList< double > getPositions()
QList< double > getSpeeds()
void deletedItem(int index)
void moveItem(int itemBefore, int item)
void dropEvent(QDropEvent *event) override
void stopSequence()
void goToPosition(SequenceItem)
void run(QList< SequenceItem >)
void saveSequence(QList< SequenceItem >, QString)
void runTime(QList< SequenceItem >)
void cycleTime(QList< SequenceItem >)
void cycle(QList< SequenceItem >)
void onReceiveValues(int sequenceNum, QList< double >, QList< double > speeds)
void save(QString global_filename)
void closeEvent(QCloseEvent *event) override
void itemDoubleClicked(int sequenceNum)
void loadSequence(QList< SequenceItem >)
void openSequence()
Definition aboutdlg.h:11