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
26
28#include "EventSenderConfig.h"
29
30// Qt
31#include <QWidget>
32
33/** ArmarX Headers */
34
35
36namespace Ui
37{
38 class EventSenderOverview;
39}
40
41namespace 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
130 {
131 Q_OBJECT
132 int lastRowInsertion;
133 int lastColumnInsertion;
134
135 public:
136 explicit EventSenderOverview();
137 ~EventSenderOverview() override;
138
139 //inherited from ArmarXWidget
140 static QString
142 {
143 return "Statecharts.EventSender";
144 }
145
146 void loadSettings(QSettings* settings) override;
147 void saveSettings(QSettings* settings) override;
148 // inherited from Component
149 void onInitComponent() override;
150
151 void
153 {
154 }
155
156 // end of inherited from Component
157 // end of inherited from Component
159 public slots:
160 void addEventSender();
161 void sendEvent(const EventSenderConfig& config);
162
163 private:
164 Ui::EventSenderOverview* ui;
165
166 // std::vector<EventSenderComponent*> eventSenders;
167 };
168} // namespace armarx
void onInitComponent() override
Pure virtual hook for the subclass.
void sendEvent(const EventSenderConfig &config)
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
void onConnectComponent() override
Pure virtual hook for the subclass.
ArmarX Headers.
This file offers overloads of toIce() and fromIce() functions for STL container types.