interaction-lab / RE-BT-Espresso

MIT License
4 stars 7 forks source link

Breaking API change in py_trees causes experiment to fail #104

Open b0guslaw opened 1 year ago

b0guslaw commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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:

Hopefully this is helpful!

shailendrasekhar commented 2 months ago

@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 commented 2 months ago

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