SkillStatusUpdate.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 
8 
9 #include <RobotAPI/interface/skills/SkillProviderInterface.h>
11 
12 #include "SkillExecutionID.h"
13 #include "SkillID.h"
14 #include "SkillParameterization.h"
15 
16 namespace armarx
17 {
18  namespace skills
19  {
20  enum class SkillStatus
21  {
22  Constructing = 0,
23  Initializing = 1,
24  Preparing = 2,
25  Running = 4,
26  Failed = 8,
27  Succeeded = 16,
28  Aborted = 32
29  };
30 
32  {
33  Running = 2,
34  Failed = 4,
35  Succeeded = 8,
36  Aborted = 16
37  };
38 
40  {
41  Failed = 4,
42  Succeeded = 8,
43  Aborted = 16
44  };
45 
48 
49  void toIce(core::dto::Execution::Status& ret, const SkillStatus& status);
50  void toIce(core::dto::Execution::Status& ret, const ActiveOrTerminatedSkillStatus& status);
51  void toIce(core::dto::Execution::Status& ret, const TerminatedSkillStatus& status);
52 
53  void fromIce(const core::dto::Execution::Status& status, TerminatedSkillStatus& ret);
54  void fromIce(const core::dto::Execution::Status& status,
56  void fromIce(const core::dto::Execution::Status& status, SkillStatus& ret);
57 
59  const TerminatedSkillStatus t2);
62 
64  {
65  // header
68  callback::dti::SkillProviderCallbackInterfacePrx callbackInterface;
69 
70  // data
72 
73  manager::dto::SkillStatusUpdate toManagerIce() const;
74 
75  provider::dto::SkillStatusUpdate toProviderIce() const;
76  };
77 
78  // Will be returned after the execution of a skill
80  {
82 
83  bool
85  {
86  return true;
87  }
88 
89  bool
91  {
93  }
94 
95  manager::dto::SkillStatusUpdate toManagerIce() const;
96 
97  provider::dto::SkillStatusUpdate toProviderIce() const;
98 
100  FromIce(const provider::dto::SkillStatusUpdate& update,
101  const std::optional<skills::ProviderID>& providerId = std::nullopt);
102 
104  FromIce(const manager::dto::SkillStatusUpdate& update);
105  };
106 
107  // Will be returned from periodic skills which can still run
109  {
111 
112  bool
114  {
118  }
119 
120  bool
122  {
124  }
125 
126  manager::dto::SkillStatusUpdate toManagerIce() const;
127 
128  provider::dto::SkillStatusUpdate toProviderIce() const;
129 
131  FromIce(const provider::dto::SkillStatusUpdate& update,
132  const std::optional<skills::ProviderID>& providerId = std::nullopt);
133 
135  FromIce(const manager::dto::SkillStatusUpdate& update);
136  };
137 
138  // Will be used as status updates from skills to the callback interface
140  {
142 
143  bool
144  operator<(const SkillStatusUpdate& o) const
145  {
146  if (!hasBeenConstructed() and o.hasBeenConstructed())
147  {
148  return true;
149  }
150  if (!hasBeenInitialized() and o.hasBeenInitialized())
151  {
152  return true;
153  }
154  if (!hasBeenPrepared() and o.hasBeenPrepared())
155  {
156  return true;
157  }
158  if (!hasBeenRunning() and o.hasBeenRunning())
159  {
160  return true;
161  }
162  if (!hasBeenTerminated() and o.hasBeenTerminated())
163  {
164  return true;
165  }
166  return false;
167  }
168 
169  bool
171  {
172  if (status == o.status)
173  {
174  return true;
175  }
176  return *this < o;
177  }
178 
179  bool
181  {
183  }
184 
185  bool
187  {
189  }
190 
191  bool
193  {
195  }
196 
197  bool
199  {
201  }
202 
203  bool
205  {
208  }
209 
210  bool
212  {
213  return status == SkillStatus::Succeeded;
214  }
215 
216  manager::dto::SkillStatusUpdate toManagerIce() const;
217 
218  provider::dto::SkillStatusUpdate toProviderIce() const;
219 
220  static SkillStatusUpdate
221  FromIce(const provider::dto::SkillStatusUpdate& update,
222  const std::optional<skills::ProviderID>& providerId = std::nullopt);
223 
224  static SkillStatusUpdate FromIce(const manager::dto::SkillStatusUpdate& update);
225  };
226  } // namespace skills
227 } // namespace armarx
armarx::skills::SkillStatusUpdate::operator<
bool operator<(const SkillStatusUpdate &o) const
Definition: SkillStatusUpdate.h:144
armarx::skills::TerminatedSkillStatus
TerminatedSkillStatus
Definition: SkillStatusUpdate.h:39
armarx::skills::SkillExecutionID
Definition: SkillExecutionID.h:19
armarx::skills::TerminatedSkillStatusUpdate::FromIce
static TerminatedSkillStatusUpdate FromIce(const provider::dto::SkillStatusUpdate &update, const std::optional< skills::ProviderID > &providerId=std::nullopt)
Definition: SkillStatusUpdate.cpp:341
armarx::aron::ret
ReaderT::InputType T & ret
Definition: rw.h:21
armarx::skills::SkillStatusUpdateBase::toManagerIce
manager::dto::SkillStatusUpdate toManagerIce() const
Definition: SkillStatusUpdate.cpp:243
armarx::skills::TerminatedSkillStatus::Succeeded
@ Succeeded
skills
This file is part of ArmarX.
armarx::skills::SkillStatusUpdate::toManagerIce
manager::dto::SkillStatusUpdate toManagerIce() const
Definition: SkillStatusUpdate.cpp:287
armarx::skills::TerminatedSkillStatus::Aborted
@ Aborted
armarx::skills::SkillStatus::Aborted
@ Aborted
armarx::skills::SkillStatusUpdate::FromIce
static SkillStatusUpdate FromIce(const provider::dto::SkillStatusUpdate &update, const std::optional< skills::ProviderID > &providerId=std::nullopt)
Definition: SkillStatusUpdate.cpp:367
armarx::skills::ActiveOrTerminatedSkillStatus::Succeeded
@ Succeeded
SkillID.h
armarx::skills::ActiveOrTerminatedSkillStatus::Failed
@ Failed
armarx::skills::SkillStatusUpdate::hasBeenRunning
bool hasBeenRunning() const
Definition: SkillStatusUpdate.h:198
DateTime.h
armarx::skills::mergeSkillStatuseses
TerminatedSkillStatus mergeSkillStatuseses(const TerminatedSkillStatus t1, const TerminatedSkillStatus t2)
Definition: SkillStatusUpdate.cpp:40
armarx::skills::TerminatedSkillStatusUpdate::hasBeenSucceeded
bool hasBeenSucceeded() const
Definition: SkillStatusUpdate.h:90
armarx::skills::SkillStatusUpdate::status
SkillStatus status
Definition: SkillStatusUpdate.h:141
armarx::skills::TerminatedSkillStatusUpdate::toManagerIce
manager::dto::SkillStatusUpdate toManagerIce() const
Definition: SkillStatusUpdate.cpp:271
armarx::skills::SkillStatusUpdateBase::callbackInterface
callback::dti::SkillProviderCallbackInterfacePrx callbackInterface
Definition: SkillStatusUpdate.h:68
SkillExecutionID.h
ice_conversions.h
SkillParameterization.h
armarx::skills::SkillStatusUpdateBase::executionId
SkillExecutionID executionId
Definition: SkillStatusUpdate.h:66
Dict.h
armarx::skills::SkillStatusUpdateBase::result
aron::data::DictPtr result
Definition: SkillStatusUpdate.h:71
armarx::skills::SkillStatusUpdate::operator<=
bool operator<=(const SkillStatusUpdate &o) const
Definition: SkillStatusUpdate.h:170
armarx::skills::ActiveOrTerminatedSkillStatusUpdate::FromIce
static ActiveOrTerminatedSkillStatusUpdate FromIce(const provider::dto::SkillStatusUpdate &update, const std::optional< skills::ProviderID > &providerId=std::nullopt)
Definition: SkillStatusUpdate.cpp:394
armarx::skills::SkillStatusUpdate::hasBeenSucceeded
bool hasBeenSucceeded() const
Definition: SkillStatusUpdate.h:211
armarx::skills::ActiveOrTerminatedSkillStatusUpdate::toProviderIce
provider::dto::SkillStatusUpdate toProviderIce() const
Definition: SkillStatusUpdate.cpp:311
armarx::skills::ActiveOrTerminatedSkillStatus
ActiveOrTerminatedSkillStatus
Definition: SkillStatusUpdate.h:31
armarx::status
status
Definition: FiniteStateMachine.h:259
armarx::skills::SkillStatusUpdate
Definition: SkillStatusUpdate.h:139
armarx::skills::TerminatedSkillStatusUpdate::toProviderIce
provider::dto::SkillStatusUpdate toProviderIce() const
Definition: SkillStatusUpdate.cpp:279
armarx::skills::SkillStatusUpdate::toProviderIce
provider::dto::SkillStatusUpdate toProviderIce() const
Definition: SkillStatusUpdate.cpp:295
armarx::skills::ActiveOrTerminatedSkillStatusUpdate::hasBeenTerminated
bool hasBeenTerminated() const
Definition: SkillStatusUpdate.h:113
armarx::skills::ActiveOrTerminatedSkillStatusUpdate::hasBeenSucceeded
bool hasBeenSucceeded() const
Definition: SkillStatusUpdate.h:121
armarx::skills::SkillStatus::Preparing
@ Preparing
armarx::skills::ActiveOrTerminatedSkillStatus::Aborted
@ Aborted
armarx::skills::toIce
void toIce(core::dto::Execution::Status &ret, const SkillStatus &status)
Definition: SkillStatusUpdate.cpp:87
armarx::skills::SkillStatusUpdate::hasBeenPrepared
bool hasBeenPrepared() const
Definition: SkillStatusUpdate.h:192
armarx::skills::SkillStatusUpdate::hasBeenConstructed
bool hasBeenConstructed() const
Definition: SkillStatusUpdate.h:180
armarx::armem::server::ltm::util::mongodb::detail::update
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
Definition: mongodb.cpp:67
armarx::skills::ActiveOrTerminatedSkillStatus::Running
@ Running
armarx::skills::SkillStatusUpdateBase::toProviderIce
provider::dto::SkillStatusUpdate toProviderIce() const
Definition: SkillStatusUpdate.cpp:257
armarx::skills::TerminatedSkillStatusUpdate
Definition: SkillStatusUpdate.h:79
armarx::skills::TerminatedSkillStatusUpdate::hasBeenTerminated
bool hasBeenTerminated() const
Definition: SkillStatusUpdate.h:84
armarx::aron::data::DictPtr
std::shared_ptr< Dict > DictPtr
Definition: Dict.h:41
armarx::skills::SkillStatus::Initializing
@ Initializing
armarx::skills::TerminatedSkillStatus::Failed
@ Failed
armarx::skills::ActiveOrTerminatedSkillStatusUpdate::toManagerIce
manager::dto::SkillStatusUpdate toManagerIce() const
Definition: SkillStatusUpdate.cpp:303
armarx::skills::SkillStatusUpdateBase::parameters
aron::data::DictPtr parameters
Definition: SkillStatusUpdate.h:67
armarx::skills::SkillStatus::Running
@ Running
armarx::skills::toSkillStatus
SkillStatus toSkillStatus(const ActiveOrTerminatedSkillStatus &d)
Definition: SkillStatusUpdate.cpp:8
armarx::skills::ActiveOrTerminatedSkillStatusUpdate
Definition: SkillStatusUpdate.h:108
armarx::skills::SkillStatusUpdateBase
Definition: SkillStatusUpdate.h:63
armarx::skills::fromIce
void fromIce(const core::dto::Execution::Status &status, TerminatedSkillStatus &ret)
Definition: SkillStatusUpdate.cpp:156
armarx::skills::SkillStatus::Constructing
@ Constructing
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::skills::SkillStatusUpdate::hasBeenTerminated
bool hasBeenTerminated() const
Definition: SkillStatusUpdate.h:204
armarx::skills::SkillStatus
SkillStatus
Definition: SkillStatusUpdate.h:20
armarx::skills::SkillStatus::Succeeded
@ Succeeded
armarx::skills::SkillStatusUpdate::hasBeenInitialized
bool hasBeenInitialized() const
Definition: SkillStatusUpdate.h:186
armarx::skills::SkillStatus::Failed
@ Failed