Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking API change in py_trees causes experiment to fail #104

Open
b0guslaw opened this issue Mar 28, 2023 · 6 comments
Open

Breaking API change in py_trees causes experiment to fail #104

b0guslaw opened this issue Mar 28, 2023 · 6 comments

Comments

@b0guslaw
Copy link

In January 2023 a breaking change in py_trees API was introduced that changed the base class of behaviours, decorators and composites. The functionality of tree_units.py silently fails and the output of run_experiments is just "Start Sim" and "Finished all experiments" with the sim_data folder being empty. Adding "memory" and "policy" arguments to composites and parallel nodes respectively should fix this issue.

@b0guslaw
Copy link
Author

b0guslaw commented Mar 28, 2023

Example of change that fixes this issue (but unsure if this is the intended policies of the experiments, thus no PR)

diff --git a/DataSim/tree_units.py b/DataSim/tree_units.py
index 7400fc9..350f7d3 100644
--- a/DataSim/tree_units.py
+++ b/DataSim/tree_units.py
@@ -117,7 +117,7 @@ class Tree_Basic(Tree):
             else:
                 name = "Selector_" + name
             name = "Selector"  # hardcoded for analysis
-        return pt.composites.Selector(name=name)
+        return pt.composites.Selector(name=name, memory=False)
 
     def create_sequence_node(self, name):
         if "Sequence" not in name:
@@ -126,16 +126,16 @@ class Tree_Basic(Tree):
             else:
                 name = "Sequence_" + name
             name = "Sequence"  # hardcoded for analysis
-        return pt.composites.Sequence(name=name)
+        return pt.composites.Sequence(name=name, memory=False)
 
     def create_parallel_node(self, name):
         if "||" not in name:
             name = "||_" + name
         name = "||"  # hardcoded for analysis
-        return pt.composites.Parallel(name=name)
+        return pt.composites.Parallel(name=name, policy=common.ParallelPolicy.SuccessOnAll())
 
     def create_repeater_node(self, name):
         return Repeater(num_repeats=3, name="Repeat<>")  # configurable
 
     def create_par_sel_node(self, name):
-        return pt.composites.Parallel(name="|| / Selector")
+        return pt.composites.Parallel(name="|| / Selector", policy=common.ParallelPolicy.SuccessOnOne())

@tgroechel
Copy link
Member

Feel free to fix, this is not intended. I do not currently have bandwidth to support this repo but am happy to answer questions.

@b0guslaw
Copy link
Author

b0guslaw commented Mar 30, 2023

Congratulations on finishing your PhD! Do you happen to know in the original design, are the composite nodes supposed to retain memory and what your intended policies of parallel nodes were?

@tgroechel
Copy link
Member

Thanks!

As a preface, most of this tool is predicated as a proof of concept for our ICRA paper. You may or may not get more out of the concepts in the paper than the code (I personally get more out of code so that is why the repo is public).

From what I recall:

  • we formulated the BT as using a generic blackboard approach, more out of convenience than anything. So, if I'm understanding correctly, no extra memory retention inside composites outside of what is needed for "normal" function e.g., sequence nodes remembering what node would be next.
  • parallel nodes can have really any policy you would like. There are only 2 possible places for parallel nodes in our approach:
    1. the top of the tree: this facilitates all the subtree behavior so depends on what your tree structure design/actions require
    2. actions that happen under the same condition (referred to as parallel/selector composites within the paper). Again, this would depend on the design of your actions (i.e., given the set of conditions are true, would the behaviors normally act in || or not)

Hopefully this is helpful!

@shailendrasekhar
Copy link

@b0guslaw Thank you so much for that heads up. After I made all the changes throughout the code, I see that the data and behavior trees are generated. However, NOT all trees are generated. Can you please detail all the changes you made to make this work?

@b0guslaw
Copy link
Author

b0guslaw commented Aug 6, 2024

I have abandoned this effort and opted for a different approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants