EventSenderOverview.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::Gui
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 #include "EventSenderConfig.h"
26 
27 #include "EventSenderComponent.h"
28 
30 
31 // Qt
32 #include <QWidget>
33 
34 /** ArmarX Headers */
35 
36 
37 namespace Ui
38 {
39  class EventSenderOverview;
40 }
41 namespace armarx
42 {
43  /*!
44  \page ArmarXGui-GuiPlugins-EventSender EventSender
45  \brief This widget allows the user to create event senders.
46  \image html EventSender.png
47  For an event the user can specify the receiving state and parameters.
48  Every state that is added to a RemoteStateOfferer and instantiated
49  can be controlled via Ice. <br/>
50  This control is one-way, so you dont get any information back.
51  To make this easier, there is a Gui-Widget that offers
52  a general interface to such states. It is called EventSender.<br/>
53  The control is event based. Like mentioned in \ref Eventprocessing
54  state transitions are caused by events and the exact transitions are
55  specified in a transition table. So to control a state, one has to
56  send events with parameters to it.<br/>
57  Usually such events are automatically send, if condition becomes true,
58  that was installed by a state.<br/>
59  But e.g. for debugging purposes or loading a new robot-program it is needed
60  to send this events manually.
61  To do this, you have to load the EventSender-Widget. In this widget,
62  you can specify control-configurations. These configurations contain:
63  - a name of the control-action
64  - a description of the control-action
65  - the receiving state
66  - the event
67  - a dictionary of event parameters
68  \image html EventSenderGui.png "EventSenderGui"
69 
70  In details these mean:
71  - The name and description are arbitrary and should only be a
72  human readable description
73  - The receiving state is the state that has the transition table
74  with this event. In the field Component Names you have to enter
75  the name of the component where the state is located in. If you
76  want to load a robot-program into the robot-mainstatechart this is
77  'RobotStatechart'. Next press the update-button besides
78  the label 'Receiving State'. Now all found RemoteStateOfferers
79  appear in the ComboBox next to this button. These
80  RemoteStateOfferers contain 2 lists of states: 'Base instances'
81  and 'Requested instances'. The base instances are the initial
82  instances of states from which the requsted instances are copied
83  from. They are only display to show the structure of the states
84  and one cannot communicate with them.
85  The requested instances are the important ones. These instances
86  are created, if a state is called/entered. So in the beginning
87  there are none, except for the robot-mainstatechart. The RobotStatechart
88  creates automatically an instance, that is usable ("Requested Instance").
89  In the tree under "Requested Instances" one can selected the desired instance
90  and then the state to which the event should be sent. Once a state
91  is selected, the event-combobox beneath is updated with corresponding
92  events.
93  \image html EventSenderGui-ComboBoxOpen.png "EventSenderGui-ComboBoxOpen"
94  - In the event-combobox the user can selected the specific event,
95  that should be sent to the statechart.
96  - In the tableview the dictionary, that should be sent with the event,
97  can be specified. The user can add an arbitrary number of parameters here.
98 
99  \subsection LoadingRobotProgram How to load a robot program
100  To load a robot program (i.e. a statechart offered with a
101  RemoteStateOfferer) into the running robot main statechart
102  configure an EventSender like this:
103  \image html RobotProgramLoading.png "RobotProgramLoading"
104  The RobotStatechart must be in the states RobotStatechart->Functional->RobotInitialized
105  (it is automatically in this state after scenario start, but you can re-enter
106  this state by restarting the statechart, see below). <br/>
107  The parameter field 'proxyName' has to contain the component-name
108  of the RemoteStateOfferer, where the state resides in.<br/>
109  The parameter field 'stateName' has to be the name of the state,
110  that should be loaded into the Robot-main-statechart. This state is
111  then automatically entered, when the event was sent.
112 
113  \subsection RestartingRobotStatechart How to restart the RobotStatechart
114  To restart the RobotStatechart send an Event EvStopRobot (see image below) and an Event EvStartRobot respectively.
115  \image html EvStopRobot.png "EvStopRobot"
116 
117  For detailed explanations see the class-documentations themself.
118 
119 
120 
121  \see \ref EventSenderOverview
122  \see \ref ArmarXGui-GuiPlugins-StatechartViewer
123  */
124  /*!
125  * \class EventSenderOverview
126  * \see StatechartEventSenderPlugin
127  */
129  public ArmarXComponentWidgetControllerTemplate<EventSenderOverview>
130 
131  {
132  Q_OBJECT
133  int lastRowInsertion;
134  int lastColumnInsertion;
135  public:
136  explicit EventSenderOverview();
137  ~EventSenderOverview() override;
138 
139  //inherited from ArmarXWidget
140  static QString GetWidgetName()
141  {
142  return "Statecharts.EventSender";
143  }
144 
145  void loadSettings(QSettings* settings) override;
146  void saveSettings(QSettings* settings) override;
147  // inherited from Component
148  void onInitComponent() override;
149  void onConnectComponent() override {}
150  // end of inherited from Component
151  // end of inherited from Component
153  public slots:
154  void addEventSender();
155  void sendEvent(const EventSenderConfig& config);
156  private:
157  Ui::EventSenderOverview* ui;
158 
159  // std::vector<EventSenderComponent*> eventSenders;
160  };
161 }
armarx::EventSenderOverview::GetWidgetName
static QString GetWidgetName()
Definition: EventSenderOverview.h:140
armarx::EventSenderOverview::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: EventSenderOverview.h:149
armarx::EventSenderOverview::sendEvent
void sendEvent(const EventSenderConfig &config)
Definition: EventSenderOverview.cpp:151
armarx::EventSenderOverview::EventSenderOverview
EventSenderOverview()
Definition: EventSenderOverview.cpp:34
armarx::ArmarXComponentWidgetControllerTemplate
Definition: ArmarXComponentWidgetController.h:69
armarx::EventSenderConfig
Definition: EventSenderConfig.h:52
armarx::EventSenderComponent
Definition: EventSenderComponent.h:36
armarx::EventSenderOverview::saveSettings
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
Definition: EventSenderOverview.cpp:64
EventSenderComponent.h
armarx::EventSenderOverview::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: EventSenderOverview.cpp:88
ArmarXComponentWidgetController.h
Ui
ArmarX Headers.
Definition: ArmarXMainWindow.h:54
armarx::EventSenderOverview::addEventSender
void addEventSender()
Definition: EventSenderOverview.cpp:144
armarx::EventSenderOverview::loadSettings
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
Definition: EventSenderOverview.cpp:49
EventSenderConfig.h
armarx::EventSenderOverview
Definition: EventSenderOverview.h:128
armarx::EventSenderOverview::~EventSenderOverview
~EventSenderOverview() override
Definition: EventSenderOverview.cpp:44
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28