diff --git a/package.xml b/package.xml
index 9296ddc..b51dcbe 100644
--- a/package.xml
+++ b/package.xml
@@ -30,8 +30,6 @@
libnss3-dev
- genpy
-
flexbe_onboard
flexbe_mirror
flexbe_widget
@@ -47,8 +45,4 @@
ament_cmake
-
-
diff --git a/src/io/io_codegenerator.js b/src/io/io_codegenerator.js
index e13507a..9436c4d 100644
--- a/src/io/io_codegenerator.js
+++ b/src/io/io_codegenerator.js
@@ -47,7 +47,12 @@ IO.CodeGenerator = new (function() {
import_list.push("from " + imported_states[i].getStateImport() + " import " + imported_states[i].getStateClass()
+ " as " + imported_states[i].getStatePackage() + "__" + imported_states[i].getStateClass());
}
- state_init_list.push(ws + ws + imported_states[i].getStateClass() + ".initialize_ros(node)")
+
+ if (!imported_states[i].getStateClass().includes("SM") &&
+ !state_init_list.includes(ws + ws + imported_states[i].getStateClass() + ".initialize_ros(node)")) {
+
+ state_init_list.push(ws + ws + imported_states[i].getStateClass() + ".initialize_ros(node)")
+ }
}
// put together
code += "from flexbe_core import Behavior, Autonomy, OperatableStateMachine, ConcurrencyContainer, PriorityContainer, Logger\n";
@@ -107,6 +112,10 @@ IO.CodeGenerator = new (function() {
code += ws+ws+ "PriorityContainer" + ".initialize_ros(node)" + "\n"
code += ws+ws+ "Logger" + ".initialize(node)" + "\n"
code += state_init_list.sort().join("\n");
+ code += "\n";
+
+ // Need to clear state_init_list in case of saving multiple times
+ state_init_list = []
var contained_behaviors = [];
@@ -117,7 +126,7 @@ IO.CodeGenerator = new (function() {
}
contained_behaviors.sort(compareKey(be => be.getStatePath()));
for (var i=0; i