05robot 1.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> getHomePosition() { return homePosition_; }
74 QVector<double> getBoardPosition() { return boardPosition_; }
79 QMap<int, QVector<double> > getCalibrationPoints() { return calibrationPoints_; }
80
86 void setBinPosition(int key, QVector<double> jointData);
91 void setHomePosition(QVector<double> jointData);
96 void setBoardPosition(QVector<double> jointData);
102 void setCalibrationPoint(int key, QVector<double> cartesianData);
103
107 void recalculateBoardCalibration();
108
112 void setCalibrationTCP();
116 void setWorkingTCP();
117
122 virtual void writeXml(QXmlStreamWriter& stream);
127 virtual void readXml(QXmlStreamReader& stream);
128
132 int getRobotPort() const { return UR3Intermediator_->Port; }
136 void setRobotPort(const int& port) { UR3Intermediator_->Port = port; }
137
141 QString getRobotIP() const { return UR3Intermediator_->IpAddress;}
145 void setRobotIP(const QString& IP) { UR3Intermediator_->IpAddress = IP; }
146
150 int getAckServerPort() const { return UR3Intermediator_->ackServerPort; }
154 void setAckServerPort(const int& port) { UR3Intermediator_->ackServerPort = port; }
155
156 public slots:
160 void connectToRobot();
164 void moveToWorkspaceHome();
168 void moveOverBoard();
175 void pickObject(QVector3D pointInMeters, float angle, int bin);
176
177
178 signals:
184 void newPose(QVector<double> data, char type);
188 void commandStarted();
192 void commandExecuted();
193
194
195 private:
196 UR3Intermediator* UR3Intermediator_;
197
198 QMap<int, BinDescriptor> binDescriptors_;
199 QVector<double> homePosition_;
200 QVector<double> boardPosition_;
201 QMap<int, QVector<double> > calibrationPoints_;
202
203 QMatrix4x4 calibMatrix_;
204
205 QVector<double> calibrationTCP_;
206 QVector<double> workingTCP_;
207
208 QVector<double> getBoardPointInBaseCoordinates(QVector3D point, float angle);
209
210 void setToolOutput(int output, bool state);
211
215 Q_PROPERTY(int robotPort READ getRobotPort WRITE setRobotPort DESIGNABLE true USER true)
216
217
220 Q_PROPERTY(QString robotIP READ getRobotIP WRITE setRobotIP DESIGNABLE true USER true)
221
225 Q_PROPERTY(int ackServerPort READ getAckServerPort WRITE setAckServerPort DESIGNABLE true USER true)
226
230 ADD_PROPERTY(pickingObjectOffsetInMM_, int)
234 ADD_PROPERTY(approachOffsetInMM_, int)
235
239 ADD_PROPERTY(jMoveAcceleration_, double)
243 ADD_PROPERTY(jMoveSpeed_, double)
247 ADD_PROPERTY(lMoveToolAcceleration_, double)
251 ADD_PROPERTY(lMoveToolSpeed_, double)
252
253
254 private slots:
255 void newPoseFromRobot(QVector<double> data, char type);
256 void robotStarted();
257 void robotFinished();
258 };
260 #endif // UR3WORKSPACE_H
261
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:9
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::getCalibrationPoints
QMap< int, QVector< double > > getCalibrationPoints()
UR3CalibWidget interface.
Definition: ur3workspace.h:79
UR3Workspace::getRobotPort
int getRobotPort() const
Gets robotPort property value.
Definition: ur3workspace.h:132
UR3Workspace::setRobotPort
void setRobotPort(const int &port)
Sets robotPort property value.
Definition: ur3workspace.h:136
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:74
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:69
BinDescriptor::toString
QString toString()
converts binDescriptor to QString for XML write
Definition: UR3Workspace.cpp:305
UR3Workspace::getBinDescriptors
QMap< int, BinDescriptor > getBinDescriptors()
UR3CalibWidget interface.
Definition: ur3workspace.h:64
UR3Workspace::setRobotIP
void setRobotIP(const QString &IP)
Sets robotIP property value.
Definition: ur3workspace.h:145
cXmlIO
Delivers XML file serialisation and deserialisation methods for modules.
Definition: cxmlio.h:22
common.h
UR3Workspace::getRobotIP
QString getRobotIP() const
Gets robotIP property value.
Definition: ur3workspace.h:141
UR3Workspace::setAckServerPort
void setAckServerPort(const int &port)
Sets ackServerPort property value.
Definition: ur3workspace.h:154
UR3Workspace::getAckServerPort
int getAckServerPort() const
Gets ackServerPort property value.
Definition: ur3workspace.h:150
UR3Intermediator.h
BinDescriptor::fromString
void fromString(QString str)
parse XML entry
Definition: UR3Workspace.cpp:319