SMACC
Loading...
Searching...
No Matches
smacc_default_events.h
Go to the documentation of this file.
1#pragma once
2
3#include <boost/statechart/state.hpp>
4#include <boost/statechart/event.hpp>
5
6#include <smacc/smacc_types.h>
7
8namespace smacc
9{
10namespace default_events
11{
12using namespace smacc::introspection;
13using namespace smacc::default_transition_tags;
14
15template <typename ActionFeedback, typename TOrthogonal>
16struct EvActionFeedback : sc::event<EvActionFeedback<ActionFeedback, TOrthogonal>>
17{
19 ActionFeedback feedbackMessage;
20 //boost::any feedbackMessage;
21};
22
23template <typename TSource, typename TOrthogonal>
24struct EvActionResult : sc::event<EvActionResult<TSource, TOrthogonal>>
25{
26 typename TSource::Result resultMessage;
27};
28
29//--------------------------------
30template <typename TSource, typename TOrthogonal>
31struct EvActionSucceeded : sc::event<EvActionSucceeded<TSource, TOrthogonal>>
32{
33 typename TSource::Result resultMessage;
34
35 static std::string getEventLabel()
36 {
37 // show ros message type
38 std::string label;
39 EventLabel<TSource>(label);
40 return label;
41 }
42
43 static std::string getDefaultTransitionTag()
44 {
45 return demangledTypeName<SUCCESS>();
46 }
47
48 static std::string getDefaultTransitionType()
49 {
50 return demangledTypeName<SUCCESS>();
51 }
52};
53
54template <typename TSource, typename TOrthogonal>
55struct EvActionAborted : sc::event<EvActionAborted<TSource, TOrthogonal>>
56{
57 typename TSource::Result resultMessage;
58
59 static std::string getEventLabel()
60 {
61 // show ros message type
62 std::string label;
63 EventLabel<TSource>(label);
64 return label;
65 }
66
67 static std::string getDefaultTransitionTag()
68 {
69 return demangledTypeName<ABORT>();
70 }
71
72 static std::string getDefaultTransitionType()
73 {
74 return demangledTypeName<ABORT>();
75 }
76};
77
78template <typename TSource, typename TOrthogonal>
79struct EvActionPreempted : sc::event<EvActionPreempted<TSource, TOrthogonal>>
80{
81 typename TSource::Result resultMessage;
82
83 static std::string getEventLabel()
84 {
85 // show ros message type
86 std::string label;
87 EventLabel<TSource>(label);
88 return label;
89 }
90
91 static std::string getDefaultTransitionTag()
92 {
93 return demangledTypeName<PREEMPT>();
94 }
95
96 static std::string getDefaultTransitionType()
97 {
98 return demangledTypeName<PREEMPT>();
99 }
100};
101
102template <typename TSource, typename TOrthogonal>
103struct EvActionRejected : sc::event<EvActionRejected<TSource, TOrthogonal>>
104{
105 typename TSource::Result resultMessage;
106
107 static std::string getEventLabel()
108 {
109 // show ros message type
110 std::string label;
111 EventLabel<TSource>(label);
112 return label;
113 }
114
115 static std::string getDefaultTransitionTag()
116 {
117 return demangledTypeName<REJECT>();
118 }
119
120 static std::string getDefaultTransitionType()
121 {
122 return demangledTypeName<REJECT>();
123 }
124};
125
126template <typename StateType>
127struct EvSequenceFinished : sc::event<EvSequenceFinished<StateType>>
128{
129
130};
131
132template <typename TSource>
133struct EvLoopContinue : sc::event<EvLoopContinue<TSource>>
134{
135 static std::string getDefaultTransitionTag()
136 {
137 return demangledTypeName<CONTINUELOOP>();
138 }
139
140 static std::string getDefaultTransitionType()
141 {
142 return demangledTypeName<CONTINUELOOP>();
143 }
144};
145
146template <typename TSource>
147struct EvLoopEnd : sc::event<EvLoopEnd<TSource>>
148{
149 static std::string getDefaultTransitionTag()
150 {
151 return demangledTypeName<ENDLOOP>();
152 }
153
154 static std::string getDefaultTransitionType()
155 {
156 return demangledTypeName<ENDLOOP>();
157 }
158};
159
160template <typename TSource, typename TOrthogonal>
161struct EvTopicInitialMessage : sc::event<EvTopicInitialMessage<TSource, TOrthogonal>>
162{
163 //typename EvTopicInitialMessage<SensorBehaviorType>::TMessageType msgData;
164 static std::string getEventLabel()
165 {
166 auto typeinfo = TypeInfo::getTypeInfoFromType<typename TSource::TMessageType>();
167
168 std::string label = typeinfo->getNonTemplatedTypeName();
169 return label;
170 }
171
172 typename TSource::TMessageType msgData;
173};
174
175template <typename TSource, typename TOrthogonal>
176struct EvTopicMessage : sc::event<EvTopicMessage<TSource, TOrthogonal>>
177{
178 static std::string getEventLabel()
179 {
180 auto typeinfo = TypeInfo::getTypeInfoFromType<typename TSource::TMessageType>();
181
182 std::string label = typeinfo->getNonTemplatedTypeName();
183 return label;
184 }
185
186 typename TSource::TMessageType msgData;
187};
188} // namespace default_events
189} // namespace smacc
smacc::client_bases::ISmaccActionClient * client
static std::string getDefaultTransitionType()
static std::string getDefaultTransitionTag()