05Robot 3.0

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

UR3Workspace.h
Go to the documentation of this file.
1 #ifndef UR3WORKSPACE_H
2 #define UR3WORKSPACE_H
3
4 #include <QObject>
5 #include <QMatrix4x4>
6 #include <QVector3D>
7 #include <cmath>
8 #include "UR3Intermediator.h"
9 #include "cxmlio.h"
10 #include "common.h"
11
12
19 struct BinDescriptor
20 {
24 QString name;
28 int id;
32 QVector<double> position;
33
38 QString toString();
43 void fromString(QString str);
44 };
45
50 class UR3Workspace : public cXmlIO
51 {
52 Q_OBJECT
53 public:
57 UR3Workspace();
58 ~UR3Workspace();
59
64 QMap<int, BinDescriptor> getBinDescriptors() { return binDescriptors_; }
69 QVector<double> getArrayStartPosition() { return arrayStartPosition_; }
74 QVector<double> getArrayEndPosition() { return arrayEndPosition_; }
79 QVector<double> getHomePosition() { return homePosition_; }
84 QVector<double> getBoardPosition() { return boardPosition_; }
89 QVector<double> getOverBinPosition() { return overBinPosition_; }
94 QMap<int, QVector<double> > getCalibrationPoints() { return calibrationPoints_; }
95
100 bool getEnableBinArrayMode() { return enableBinArrayMode_(); }
105 int getBinArraySize() { return binArraySize_(); }
106
112 void setBinPosition(int key, QVector<double> cartesianData);
117 void setArrayStartPosition(QVector<double> cartesianData);
122 void setArrayEndPosition(QVector<double> cartesianData);
127 void setHomePosition(QVector<double> jointData);
132 void setOverBinPosition(QVector<double> jointData);
137 void setBoardPosition(QVector<double> jointData);
143 void setCalibrationPoint(int key, QVector<double> cartesianData);
144
148 void recalculateCalibration();
152 void recalculateBinArray();
153
157 void setCalibrationTCP();
161 void setWorkingTCP();
162
167 virtual void writeXml(QXmlStreamWriter& stream);
172 virtual void readXml(QXmlStreamReader& stream);
173
177 int getRobotPort() const { return UR3Intermediator_->Port; }
181 void setRobotPort(const int& port) { UR3Intermediator_->Port = port; }
182
186 QString getRobotIP() const { return UR3Intermediator_->IpAddress;}
190 void setRobotIP(const QString& IP) { UR3Intermediator_->IpAddress = IP; }
191
195 int getAckServerPort() const { return UR3Intermediator_->ackServerPort; }
199 void setAckServerPort(const int& port) { UR3Intermediator_->ackServerPort = port; }
200
201 public slots:
205 void connectToRobot();
209 void disconnectFromRobot();
213 void moveToWorkspaceHome();
217 void moveOverBoard();
221 void moveOverBin();
229 void pickObject(QVector3D pointInMeters, float objectHeightInMeters, float angle, int bin);
230
231
232 signals:
238 void newPose(QVector<double> data, char type);
242 void commandStarted();
246 void commandExecuted();
251 void connectedToRobot(bool connected);
255 void disconnectedFromRobot();
259 void robotEmergencyStopped();
260
261 private:
262 UR3Intermediator* UR3Intermediator_;
263
264 QMap<int, BinDescriptor> binDescriptors_;
265 QVector<double> homePosition_;
266 QVector<double> boardPosition_;
267 QVector<double> overBinPosition_;
268 QMap<int, QVector<double> > calibrationPoints_;
269
270 QVector<double> arrayStartPosition_;
271 QVector<double> arrayEndPosition_;
272
273 QMatrix4x4 calibMatrix_;
274 double pickArrayRotAngle_ = 0;
275
276 QVector<double> calibrationTCP_;
277 QVector<double> workingTCP_;
278
279 QVector<double> getBoardPointInBaseCoordinates(QVector3D point, float angle);
280
281 void setToolOutput(int output, bool state);
282
286 Q_PROPERTY(int robotPort READ getRobotPort WRITE setRobotPort DESIGNABLE true USER true)
287
288
291 Q_PROPERTY(QString robotIP READ getRobotIP WRITE setRobotIP DESIGNABLE true USER true)
292
296 Q_PROPERTY(int ackServerPort READ getAckServerPort WRITE setAckServerPort DESIGNABLE true USER true)
297
301 ADD_PROPERTY(enableBinArrayMode_, bool)
305 ADD_PROPERTY(binArraySize_, int)
306
310 ADD_PROPERTY(pickingObjectOffsetInMM_, int)
314 ADD_PROPERTY(puttingObjectOffsetInMM_, int)
318 ADD_PROPERTY(approachOffsetInMM_, int)
319
323 ADD_PROPERTY(jMoveAcceleration_, double)
327 ADD_PROPERTY(jMoveSpeed_, double)
331 ADD_PROPERTY(lMoveToolAcceleration_, double)
335 ADD_PROPERTY(lMoveToolSpeed_, double)
336
337
338 private slots:
339 void newPoseFromRobot(QVector<double> data, char type);
340 void robotStarted();
341 void robotFinished();
342
343 void onRobotDisconnected();
344 void onRobotEmergencyStopped();
345 };
347 #endif // UR3WORKSPACE_H
348
UR3Workspace::getArrayEndPosition
QVector< double > getArrayEndPosition()
UR3CalibWidget interface.
Definition: UR3Workspace.h:74
UR3Workspace
Wraper over UR3Intermediator class. Represents a robot working space. Enables robot connection and ro...
Definition: UR3Workspace.h:50
ADD_PROPERTY
#define ADD_PROPERTY(member, _type)
Definition: common.h:14
cxmlio.h
BinDescriptor::name
QString name
displayed in user interface
Definition: UR3Workspace.h:24
BinDescriptor
struct representing definition of a physical bucket for object sorting
Definition: UR3Workspace.h:19
BinDescriptor::id
int id
bin identification number
Definition: UR3Workspace.h:28
UR3Workspace::getEnableBinArrayMode
bool getEnableBinArrayMode()
UR3CalibWidget interface.
Definition: UR3Workspace.h:100
UR3Workspace::getCalibrationPoints
QMap< int, QVector< double > > getCalibrationPoints()
UR3CalibWidget interface.
Definition: UR3Workspace.h:94
UR3Workspace::getRobotPort
int getRobotPort() const
Gets robotPort property value.
Definition: UR3Workspace.h:177
UR3Workspace::setRobotPort
void setRobotPort(const int &port)
Sets robotPort property value.
Definition: UR3Workspace.h:181
UR3Intermediator
Base class for communication with UR robot using TCP/IP interface.
Definition: UR3Intermediator.h:28
UR3Workspace::getBoardPosition
QVector< double > getBoardPosition()
UR3CalibWidget interface.
Definition: UR3Workspace.h:84
BinDescriptor::position
QVector< double > position
6 element vector containing joint configuration describing bucket position
Definition: UR3Workspace.h:32
UR3Workspace::getHomePosition
QVector< double > getHomePosition()
UR3CalibWidget interface.
Definition: UR3Workspace.h:79
BinDescriptor::toString
QString toString()
converts binDescriptor to QString for XML write
UR3Workspace::getBinDescriptors
QMap< int, BinDescriptor > getBinDescriptors()
UR3CalibWidget interface.
Definition: UR3Workspace.h:64
UR3Workspace::getOverBinPosition
QVector< double > getOverBinPosition()
UR3CalibWidget interface.
Definition: UR3Workspace.h:89
UR3Workspace::setRobotIP
void setRobotIP(const QString &IP)
Sets robotIP property value.
Definition: UR3Workspace.h:190
cXmlIO
Delivers XML file serialisation and deserialisation methods for modules.
Definition: cxmlio.h:22
UR3Workspace::getBinArraySize
int getBinArraySize()
UR3CalibWidget interface.
Definition: UR3Workspace.h:105
common.h
UR3Workspace::getRobotIP
QString getRobotIP() const
Gets robotIP property value.
Definition: UR3Workspace.h:186
UR3Workspace::setAckServerPort
void setAckServerPort(const int &port)
Sets ackServerPort property value.
Definition: UR3Workspace.h:199
UR3Workspace::getArrayStartPosition
QVector< double > getArrayStartPosition()
UR3CalibWidget interface.
Definition: UR3Workspace.h:69
UR3Workspace::getAckServerPort
int getAckServerPort() const
Gets ackServerPort property value.
Definition: UR3Workspace.h:195
UR3Intermediator.h
BinDescriptor::fromString
void fromString(QString str)
parse XML entry