SimpleEventHandler.cpp
Go to the documentation of this file.
1 #include "SimpleEventHandler.h"
2 
5 
7 {
8 
9  void
11  {
12  subscriptions.goalReachedCallbacks.push_back(callback);
13  }
14 
15  void
17  {
18  subscriptions.waypointReachedCallbacks.push_back(callback);
19  }
20 
21  void
24  {
25  subscriptions.safetyThrottlingTriggeredCallbacks.push_back(callback);
26  }
27 
28  void
30  {
31  subscriptions.safetyStopTriggeredCallbacks.push_back(callback);
32  }
33 
34  void
36  {
37  subscriptions.userAbortTriggeredCallbacks.push_back(callback);
38  }
39 
40  void
42  {
43  subscriptions.internalErrorCallbacks.push_back(callback);
44  }
45 
46  void
47  SimpleEventHandler::SimpleEventHandler::onMovementStarted(
48  const OnMovementStartedCallback& callback)
49  {
50  subscriptions.movementStartedCallbacks.push_back(callback);
51  }
52 
53  void
55  {
56  subscriptions.globalPlanningFailedCallbacks.push_back(callback);
57  }
58 
59  void
61  {
62  subscriptions.localPlanningFailedCallbacks.push_back(callback);
63  }
64 
65  void
67  {
68  subscriptions.globalTrajectoryUpdatedCallbacks.push_back(callback);
69  }
70 
71  void
73  {
74  subscriptions.localTrajectoryUpdatedCallbacks.push_back(callback);
75  }
76 
77  void
79  {
80  for (const auto& callback : subscriptions.goalReachedCallbacks)
81  {
82  callback(event);
83  }
84  }
85 
86  void
88  {
89  for (const auto& callback : subscriptions.waypointReachedCallbacks)
90  {
91  callback(event);
92  }
93  }
94 
95  void
97  {
98  for (const auto& callback : subscriptions.safetyThrottlingTriggeredCallbacks)
99  {
100  callback(event);
101  }
102  }
103 
104  void
106  {
107  for (const auto& callback : subscriptions.safetyStopTriggeredCallbacks)
108  {
109  callback(event);
110  }
111  }
112 
113  void
115  {
116  for (const auto& callback : subscriptions.userAbortTriggeredCallbacks)
117  {
118  callback(event);
119  }
120  }
121 
122  void
124  {
125  for (const auto& callback : subscriptions.internalErrorCallbacks)
126  {
127  callback(event);
128  }
129  }
130 
131  void
133  {
134  for (const auto& callback : subscriptions.globalTrajectoryUpdatedCallbacks)
135  {
136  callback(event);
137  }
138  }
139 
140  void
142  {
143  for (const auto& callback : subscriptions.localTrajectoryUpdatedCallbacks)
144  {
145  callback(event);
146  }
147  }
148 
149  // void
150  // SimpleEventHandler::trajectoryControllerUpdated(
151  // const traj_ctrl::local::TrajectoryControllerResult& event)
152  // {
153  // for (const auto& callback : subscriptions.trajectoryControllerUpdatedCallbacks)
154  // {
155  // callback(event);
156  // }
157  // }
158 
159  void
161  {
162  for (const auto& callback : subscriptions.globalPlanningFailedCallbacks)
163  {
164  callback(event);
165  }
166  }
167 
168  void
170  {
171  for (const auto& callback : subscriptions.localPlanningFailedCallbacks)
172  {
173  callback(event);
174  }
175  }
176 
177  void
179  {
180  for (const auto& callback : subscriptions.movementStartedCallbacks)
181  {
182  callback(event);
183  }
184  }
185 
186 
187 } // namespace armarx::navigation::client
armarx::navigation::client::SimpleEventHandler::safetyStopTriggered
void safetyStopTriggered(const core::SafetyStopTriggeredEvent &event) override
Will be called whenever a safety stop is triggered.
Definition: SimpleEventHandler.cpp:105
armarx::navigation::client::OnWaypointReachedCallback
std::function< void(const core::WaypointReachedEvent &)> OnWaypointReachedCallback
Definition: EventSubscriptionInterface.h:25
armarx::navigation::client::GlobalPlanningFailedCallback
std::function< void(const core::GlobalPlanningFailedEvent &)> GlobalPlanningFailedCallback
Definition: EventSubscriptionInterface.h:18
armarx::navigation::client::SimpleEventHandler::movementStarted
void movementStarted(const core::MovementStartedEvent &event) override
Definition: SimpleEventHandler.cpp:178
armarx::navigation::client::SimpleEventHandler::safetyThrottlingTriggered
void safetyThrottlingTriggered(const core::SafetyThrottlingTriggeredEvent &event) override
Will be called whenever safety throttling is triggered to a certain degree (configurable).
Definition: SimpleEventHandler.cpp:96
armarx::navigation::core::InternalErrorEvent
Event describing the occurance of an internal unhandled error.
Definition: events.h:104
armarx::navigation::core::SafetyThrottlingTriggeredEvent
Event desciribing that a significant safety throttling factor was reached.
Definition: events.h:71
armarx::navigation::client::SimpleEventHandler::onSafetyThrottlingTriggered
void onSafetyThrottlingTriggered(const OnSafetyThrottlingTriggeredCallback &callback) override
Definition: SimpleEventHandler.cpp:22
armarx::navigation::client::SimpleEventHandler::globalPlanningFailed
void globalPlanningFailed(const core::GlobalPlanningFailedEvent &event) override
Definition: SimpleEventHandler.cpp:160
armarx::navigation::client::SimpleEventHandler::internalError
void internalError(const core::InternalErrorEvent &event) override
Will be called whenever an internal error occurs.
Definition: SimpleEventHandler.cpp:123
armarx::navigation::client
This file is part of ArmarX.
Definition: ComponentPlugin.cpp:21
EventSubscriptionInterface.h
armarx::navigation::client::SimpleEventHandler::localTrajectoryUpdated
void localTrajectoryUpdated(const core::LocalTrajectoryUpdatedEvent &event) override
Definition: SimpleEventHandler.cpp:141
armarx::navigation::client::LocalPlanningFailedCallback
std::function< void(const core::LocalPlanningFailedEvent &)> LocalPlanningFailedCallback
Definition: EventSubscriptionInterface.h:20
armarx::navigation::client::GlobalTrajectoryUpdatedCallback
std::function< void(const core::GlobalTrajectoryUpdatedEvent &)> GlobalTrajectoryUpdatedCallback
Definition: EventSubscriptionInterface.h:12
events.h
armarx::navigation::client::SimpleEventHandler::localPlanningFailed
void localPlanningFailed(const core::LocalPlanningFailedEvent &event) override
Definition: SimpleEventHandler.cpp:169
armarx::navigation::client::SimpleEventHandler::onInternalError
void onInternalError(const OnInternalErrorCallback &callback) override
Definition: SimpleEventHandler.cpp:41
armarx::navigation::client::SimpleEventHandler::userAbortTriggered
void userAbortTriggered(const core::UserAbortTriggeredEvent &event) override
Will be called whenever the user aborts the current navigation.
Definition: SimpleEventHandler.cpp:114
armarx::navigation::client::SimpleEventHandler::onGoalReached
void onGoalReached(const OnGoalReachedCallback &callback) override
Definition: SimpleEventHandler.cpp:10
armarx::navigation::core::SafetyStopTriggeredEvent
Event describing that for security reasons, the robot was stopped completely.
Definition: events.h:87
armarx::navigation::client::OnUserAbortTriggeredCallback
std::function< void(const core::UserAbortTriggeredEvent &)> OnUserAbortTriggeredCallback
Definition: EventSubscriptionInterface.h:30
armarx::navigation::client::OnSafetyThrottlingTriggeredCallback
std::function< void(const core::SafetyThrottlingTriggeredEvent &)> OnSafetyThrottlingTriggeredCallback
Definition: EventSubscriptionInterface.h:27
armarx::navigation::client::SimpleEventHandler::onWaypointReached
void onWaypointReached(const OnWaypointReachedCallback &callback) override
Definition: SimpleEventHandler.cpp:16
armarx::navigation::core::UserAbortTriggeredEvent
Event describing that the user aborted the current execution.
Definition: events.h:96
armarx::navigation::client::LocalTrajectoryUpdatedCallback
std::function< void(const core::LocalTrajectoryUpdatedEvent &)> LocalTrajectoryUpdatedCallback
Definition: EventSubscriptionInterface.h:14
SimpleEventHandler.h
armarx::navigation::core::LocalTrajectoryUpdatedEvent
Event describing that the local trajectory was updated.
Definition: events.h:121
armarx::navigation::core::GlobalPlanningFailedEvent
Definition: events.h:34
armarx::navigation::client::SimpleEventHandler::onLocalTrajectoryUpdated
void onLocalTrajectoryUpdated(const LocalTrajectoryUpdatedCallback &callback) override
Definition: SimpleEventHandler.cpp:72
armarx::navigation::core::GoalReachedEvent
Event describing that the targeted goal was successfully reached.
Definition: events.h:52
armarx::navigation::client::SimpleEventHandler::onUserAbortTriggered
void onUserAbortTriggered(const OnUserAbortTriggeredCallback &callback) override
Definition: SimpleEventHandler.cpp:35
armarx::navigation::client::SimpleEventHandler::onGlobalPlanningFailed
void onGlobalPlanningFailed(const GlobalPlanningFailedCallback &callback) override
Definition: SimpleEventHandler.cpp:54
armarx::navigation::client::SimpleEventHandler::onSafetyStopTriggered
void onSafetyStopTriggered(const OnSafetyStopTriggeredCallback &callback) override
Definition: SimpleEventHandler.cpp:29
armarx::navigation::client::SimpleEventHandler::goalReached
void goalReached(const core::GoalReachedEvent &event) override
Will be called whenever the navigator reached the goal.
Definition: SimpleEventHandler.cpp:78
armarx::navigation::client::OnMovementStartedCallback
std::function< void(const core::MovementStartedEvent &)> OnMovementStartedCallback
Definition: EventSubscriptionInterface.h:22
armarx::navigation::core::GlobalTrajectoryUpdatedEvent
Event describing that the global trajectory was updated.
Definition: events.h:113
armarx::navigation::client::SimpleEventHandler::waypointReached
void waypointReached(const core::WaypointReachedEvent &event) override
Will be called whenever the navigator reached a user-defined waypoint.
Definition: SimpleEventHandler.cpp:87
armarx::navigation::client::SimpleEventHandler::globalTrajectoryUpdated
void globalTrajectoryUpdated(const core::GlobalTrajectoryUpdatedEvent &event) override
Definition: SimpleEventHandler.cpp:132
armarx::navigation::core::WaypointReachedEvent
Event describing that a user-defined waypoint was successfully reached.
Definition: events.h:60
armarx::navigation::client::OnInternalErrorCallback
std::function< void(const core::InternalErrorEvent &)> OnInternalErrorCallback
Definition: EventSubscriptionInterface.h:31
armarx::navigation::client::OnSafetyStopTriggeredCallback
std::function< void(const core::SafetyStopTriggeredEvent &)> OnSafetyStopTriggeredCallback
Definition: EventSubscriptionInterface.h:29
armarx::navigation::core::LocalPlanningFailedEvent
Definition: events.h:39
armarx::navigation::client::SimpleEventHandler::onLocalPlanningFailed
void onLocalPlanningFailed(const LocalPlanningFailedCallback &callback) override
Definition: SimpleEventHandler.cpp:60
armarx::navigation::client::OnGoalReachedCallback
std::function< void(const core::GoalReachedEvent &)> OnGoalReachedCallback
Definition: EventSubscriptionInterface.h:24
armarx::navigation::core::MovementStartedEvent
Definition: events.h:44
armarx::navigation::client::SimpleEventHandler::onGlobalTrajectoryUpdated
void onGlobalTrajectoryUpdated(const GlobalTrajectoryUpdatedCallback &callback) override
Definition: SimpleEventHandler.cpp:66