File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,9 @@ class LoopPopNode : public DecoratorNode
71
71
{
72
72
// if the port is static, any_ref is empty, otherwise it will keep access to
73
73
// port locked for thread-safety
74
- AnyWriteRef any_ref = static_queue_ ? AnyWriteRef () : getPortAny (" queue" );
74
+ AnyWriteRef any_ref = static_queue_ ?
75
+ AnyWriteRef () :
76
+ getLockedPortContent (" queue" );
75
77
if (any_ref)
76
78
{
77
79
current_queue_ = any_ref.get ()->cast <SharedQueue<T>>();
@@ -98,6 +100,11 @@ class LoopPopNode : public DecoratorNode
98
100
NodeStatus child_state = child_node_->executeTick ();
99
101
child_running_ = (child_state == NodeStatus::RUNNING);
100
102
103
+ if (isStatusCompleted (child_state))
104
+ {
105
+ resetChild ();
106
+ }
107
+
101
108
if (child_state == NodeStatus::FAILURE)
102
109
{
103
110
return NodeStatus::FAILURE;
Original file line number Diff line number Diff line change @@ -241,7 +241,7 @@ class TreeNode
241
241
Result setOutput (const std::string& key, const T& value);
242
242
243
243
/* *
244
- * @brief getPortAny should be used when:
244
+ * @brief getLockedPortContent should be used when:
245
245
*
246
246
* - your port contains an object with reference semantic (usually a smart pointer)
247
247
* - you want to modify the object we are pointing to.
@@ -255,7 +255,7 @@ class TreeNode
255
255
*
256
256
* What you must do, instead, to guaranty thread-safety, is:
257
257
*
258
- * if(auto any_ref = getPortAny ("port_name")) {
258
+ * if(auto any_ref = getLockedPortContent ("port_name")) {
259
259
* Any* any = any_ref.get();
260
260
* auto foo_ptr = any->cast<std::shared_ptr<Foo>>();
261
261
* // modifying the content of foo_ptr inside this scope IS thread-safe
@@ -270,7 +270,7 @@ class TreeNode
270
270
* @return empty AnyWriteRef if the blackboard entry doesn't exist or the content
271
271
* of the port was a static string.
272
272
*/
273
- AnyWriteRef getPortAny (const std::string& key);
273
+ AnyWriteRef getLockedPortContent (const std::string& key);
274
274
275
275
// function provided mostly for debugging purpose to see the raw value
276
276
// in the port (no remapping and no conversion to a type)
Original file line number Diff line number Diff line change @@ -411,7 +411,7 @@ std::string toStr<PostCond>(PostCond pre)
411
411
}
412
412
}
413
413
414
- AnyWriteRef BT::TreeNode::getPortAny (const std::string &key)
414
+ AnyWriteRef BT::TreeNode::getLockedPortContent (const std::string &key)
415
415
{
416
416
if (auto remapped_key = getRemappedKey (key, getRawPortValue (key)))
417
417
{
You can’t perform that action at this time.
0 commit comments