TCPMover.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package ArmarX::
17 * @author Mirko Waechter ( mirko.waechter at kit dot edu)
18 * @date 2012
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 #pragma once
24 
25 /** ArmarX headers **/
26 #include "TCPMoverConfigDialog.h"
27 #include <RobotAPI/gui-plugins/SensorActorWidgetsPlugin/ui_TCPMover.h>
28 
29 // ArmarX includes
30 #include <RobotAPI/interface/units/TCPMoverUnitInterface.h>
31 #include <RobotAPI/interface/units/TCPControlUnit.h>
32 /** VirtualRobot headers **/
33 #include <VirtualRobot/Robot.h>
34 #include <VirtualRobot/Nodes/RobotNode.h>
35 #include <VirtualRobot/RobotNodeSet.h>
36 #include <VirtualRobot/IK/DifferentialIK.h>
38 
40 
41 // Qt includes
42 #include <QDialog>
43 
44 #define KINEMATIC_UNIT_FILE_DEFAULT armarx::ArmarXDataPath::getHomePath()+std::string("Armar4/ARMAR_IV_simox.xml")
45 #define KINEMATIC_UNIT_NAME_DEFAULT "RobotKinematicUnit"
46 
47 
48 class QDialogButtonBox;
49 
50 namespace armarx
51 {
52 
53  /*class TCPMoverConfigDialog : public QDialog
54  {
55  Q_OBJECT
56 
57  public:
58  TCPMoverConfigDialog(QWidget *parent = 0);
59 
60  friend class TCPMover;
61  protected:
62  QGridLayout *layout;
63  //QLabel *label;
64  //QLineEdit *editTCPMoverUnitName;
65  IceProxyFinderBase* proxyFinder;
66  QDialogButtonBox *buttonBox;
67 
68  void setupUI(QWidget *parent);
69  };*/
70 
71 
72  /**
73  * \page RobotAPI-GuiPlugins-TCPMover TCPMoverPlugin
74  * @brief The TCPMover widget allows direct control of a TCP.
75  *
76  * \image html TCPMoverGUI.png
77  */
78  class TCPMover :
80  {
81  Q_OBJECT
82 
83  public:
84  TCPMover();
85  ~TCPMover() override;
86  //inherited from ArmarXMdiWidget
87  void loadSettings(QSettings* settings) override;
88  void saveSettings(QSettings* settings) override;
89  static QString GetWidgetName()
90  {
91  return "RobotControl.TCPMover";
92  }
93  static QIcon GetWidgetIcon()
94  {
95  return QIcon("://icons/games.ico");
96  }
97  static QIcon GetWidgetCategoryIcon()
98  {
99  return QIcon("://icons/games.ico");
100  }
101  QPointer<QDialog> getConfigDialog(QWidget* parent = 0) override;
102  void configured() override;
103 
104  // inherited from Component
105  void onInitComponent() override;
106  void onConnectComponent() override;
107  void onExitComponent() override;
108 
109 
110  public slots:
111  void moveUp();
112  void moveDown();
113  void moveZUp();
114  void moveZDown();
115  void moveLeft();
116  void moveRight();
117  void increaseAlpha();
118  void decreaseAlpha();
119  void increaseBeta();
120  void decreaseBeta();
121  void increaseGamma();
122  void decreaseGamma();
123  void stopMoving();
124  void reset();
125  void robotControl(bool request);
126  void selectHand(int index);
127  signals:
128 
129  protected:
130  void execMove();
131 
132  void moveRelative(float x, float y, float z);
133  std::map<std::string, std::vector<float> > tcpData;
134  std::string selectedTCP;
135  std::string refFrame;
136  // float velocities[2][3];
137  // float orientation[2][3];
140  VirtualRobot::RobotNodeSetPtr tcpNodeSet;
141  std::string tcpNodeSetName;
142  VirtualRobot::DifferentialIKPtr ik;
143  Ui::TCPMover ui;
144  std::string kinematicUnitName;
145  std::string kinematicUnitFile;
146  std::string tcpMoverUnitName;
148  TCPControlUnitInterfacePrx tcpMoverUnitPrx;
151  QPointer<TCPMoverConfigDialog> configDialog;
152  };
153 }
154 
armarx::TCPMover::increaseGamma
void increaseGamma()
Definition: TCPMover.cpp:248
armarx::TCPMover::GetWidgetIcon
static QIcon GetWidgetIcon()
Definition: TCPMover.h:93
armarx::TCPMover::robotPrx
SharedRobotInterfacePrx robotPrx
Definition: TCPMover.h:150
armarx::TCPMover::increaseBeta
void increaseBeta()
Definition: TCPMover.cpp:236
armarx::TCPMover::robotControl
void robotControl(bool request)
Definition: TCPMover.cpp:277
armarx::TCPMover::execMove
void execMove()
Definition: TCPMover.cpp:300
armarx::TCPMover::decreaseGamma
void decreaseGamma()
Definition: TCPMover.cpp:254
index
uint8_t index
Definition: EtherCATFrame.h:59
armarx::TCPMover::configured
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
Definition: TCPMover.cpp:102
armarx::TCPMover::increaseAlpha
void increaseAlpha()
Definition: TCPMover.cpp:224
armarx::TCPMover::GetWidgetName
static QString GetWidgetName()
Definition: TCPMover.h:89
armarx::TCPMover::stopMoving
void stopMoving()
Definition: TCPMover.cpp:260
armarx::TCPMover::ik
VirtualRobot::DifferentialIKPtr ik
Definition: TCPMover.h:142
armarx::TCPMover::TCPMover
TCPMover()
Definition: TCPMover.cpp:44
armarx::TCPMover::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: TCPMover.cpp:130
armarx::ArmarXComponentWidgetControllerTemplate
Definition: ArmarXComponentWidgetController.h:69
armarx::TCPMover::tcpMoverUnitName
std::string tcpMoverUnitName
Definition: TCPMover.h:146
armarx::TCPMover::getConfigDialog
QPointer< QDialog > getConfigDialog(QWidget *parent=0) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
Definition: TCPMover.cpp:92
armarx::TCPMover::moveZUp
void moveZUp()
Definition: TCPMover.cpp:196
armarx::TCPMover::decreaseAlpha
void decreaseAlpha()
Definition: TCPMover.cpp:230
armarx::TCPMover::moveRelative
void moveRelative(float x, float y, float z)
Definition: TCPMover.cpp:336
armarx::TCPMover
Definition: TCPMover.h:78
armarx::TCPMover::selectHand
void selectHand(int index)
Definition: TCPMover.cpp:295
armarx::TCPMover::tcpNodeSet
VirtualRobot::RobotNodeSetPtr tcpNodeSet
Definition: TCPMover.h:140
armarx::TCPMover::ui
Ui::TCPMover ui
Definition: TCPMover.h:143
ArmarXComponentWidgetController.h
armarx::TCPMover::tcpMoverUnitPrx
TCPControlUnitInterfacePrx tcpMoverUnitPrx
Definition: TCPMover.h:148
armarx::TCPMover::moveRight
void moveRight()
Definition: TCPMover.cpp:216
armarx::TCPMover::moveDown
void moveDown()
Definition: TCPMover.cpp:189
armarx::TCPMover::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: TCPMover.cpp:110
IceProxyFinder.h
armarx::TCPMover::velocityMap
NameValueMap velocityMap
Definition: TCPMover.h:138
armarx::TCPMover::moveUp
void moveUp()
Definition: TCPMover.cpp:182
armarx::TCPMover::robotStateComponentPrx
RobotStateComponentInterfacePrx robotStateComponentPrx
Definition: TCPMover.h:149
armarx::TCPMover::moveZDown
void moveZDown()
Definition: TCPMover.cpp:202
armarx::TCPMover::~TCPMover
~TCPMover() override
Definition: TCPMover.cpp:75
armarx::control::njoint_controller::platform::platform_follower_controller::NameValueMap
std::map< std::string, float > NameValueMap
Definition: PlatformFollowerController.h:91
armarx::TCPMover::kinematicUnitName
std::string kinematicUnitName
Definition: TCPMover.h:144
armarx::TCPMover::reset
void reset()
Definition: TCPMover.cpp:267
armarx::TCPMover::selectedTCP
std::string selectedTCP
Definition: TCPMover.h:134
armarx::TCPMover::robot
VirtualRobot::RobotPtr robot
Definition: TCPMover.h:147
armarx::TCPMover::tcpNodeSetName
std::string tcpNodeSetName
Definition: TCPMover.h:141
armarx::TCPMover::onExitComponent
void onExitComponent() override
Hook for subclass.
Definition: TCPMover.cpp:175
IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface >
armarx::TCPMover::tcpData
std::map< std::string, std::vector< float > > tcpData
Definition: TCPMover.h:133
armarx::TCPMover::moveLeft
void moveLeft()
Definition: TCPMover.cpp:208
armarx::TCPMover::kinematicUnitFile
std::string kinematicUnitFile
Definition: TCPMover.h:145
armarx::TCPMover::robotRequested
bool robotRequested
Definition: TCPMover.h:139
armarx::TCPMover::decreaseBeta
void decreaseBeta()
Definition: TCPMover.cpp:242
armarx::TCPMover::loadSettings
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
Definition: TCPMover.cpp:82
armarx::TCPMover::saveSettings
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
Definition: TCPMover.cpp:87
armarx::TCPMover::configDialog
QPointer< TCPMoverConfigDialog > configDialog
Definition: TCPMover.h:151
TCPMoverConfigDialog.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::TCPMover::GetWidgetCategoryIcon
static QIcon GetWidgetCategoryIcon()
Definition: TCPMover.h:97
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18
armarx::TCPMover::refFrame
std::string refFrame
Definition: TCPMover.h:135