Skip to content

Commit 56cf0b2

Browse files
authored
Merge pull request FlexBE#18 from fmessmer/feature/sync_flexbe
Feature/sync flexbe
2 parents eff8d3f + 8cf826d commit 56cf0b2

File tree

7 files changed

+25
-25
lines changed

7 files changed

+25
-25
lines changed

CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22
Changelog for package flexbe_app
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
2.4.0 (2023-05-18)
5+
------------------
6+
* Merge develop branch
7+
* Updates for Melodic and Noetic releases on github.com/FlexBE
48

59
2.3.0 (2020-11-19)
610
------------------

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2017,
3+
Copyright (c) 2017-2023,
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

README.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ User interface (editor + runtime control) for the FlexBE behavior engine.
66

77
Clone the following repos into your ROS workspace:
88

9-
git clone https://github.com/team-vigir/flexbe_behavior_engine.git # if not already present
9+
git clone https://github.com/FlexBE/flexbe_behavior_engine.git # if not already present
1010
git clone https://github.com/FlexBE/flexbe_app.git
1111

1212
Build you workspace:
@@ -49,15 +49,7 @@ Use the following launch file to run both of the above for local behavior execut
4949

5050
## Backwards Compatibility
5151

52-
The FlexBE App in this repository replaces the previous *flexbe_chrome_app*. Please refer to the following announcement for an overview of the most important changes: [Future of the FlexBE Chrome App](https://github.com/pschillinger/flexbe_chrome_app/issues/11)
53-
54-
If you have been using FlexBE already with the old Chrome app, you can convert the content of your repository according to the structure defined below. Besides adding the export statement to your state packages, you can automate this conversion by running the FlexBE App. If no behavior package is detected, it will suggest you to initialize one.
55-
56-
---
57-
58-
Deprecated Chrome App branch: **deprecated/chrome_app**
59-
60-
*Please checkout the above branch on all repos if available for a best-effort support of the deprecated Chrome app. However, please consider to update as soon as possible according to the instructions below to ensure that the system will remain working in the future and to receive all updates.*
52+
The FlexBE App in this repository replaces the previous *flexbe_chrome_app*.
6153

6254
---
6355

@@ -77,7 +69,7 @@ A package is a state package for FlexBE if its `package.xml` declares the export
7769
...
7870
</package>
7971

80-
It is then expected to provide Python class definitions as described in [Developing Basic States](http://wiki.ros.org/flexbe/Tutorials/Developing%20Basic%20States). Example: [flexbe_states](https://github.com/team-vigir/flexbe_behavior_engine/tree/feature/flexbe_app/flexbe_states). Adding the above export statement is the only change to previous versions.
72+
It is then expected to provide Python class definitions as described in [Developing Basic States](http://wiki.ros.org/flexbe/Tutorials/Developing%20Basic%20States). Example: [flexbe_states](https://github.com/FlexBE/flexbe_behavior_engine/tree/feature/flexbe_app/flexbe_states). Adding the above export statement is the only change to previous versions.
8173

8274
### Behavior packages
8375

package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<package format="2">
22
<name>flexbe_app</name>
3-
<version>2.3.0</version>
3+
<version>2.4.0</version>
44
<description>
55
flexbe_app provides a user interface (editor + runtime control) for the FlexBE behavior engine.
66
</description>

src/io/io_codegenerator.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,11 @@ IO.CodeGenerator = new (function() {
220220
}
221221
code += ws+ws+"# " + pos.join(", ") + "\n";
222222
if (sm.isConcurrent()) {
223-
code += ws+ws+ sm_name + " = ConcurrencyContainer(outcomes=['" + sm.getOutcomes().join("', '") + "']";
223+
code += ws+ws+ sm_name + " = ConcurrencyContainer(outcomes=[" + sm.getOutcomes().map(x => "'" + x + "'").join(", ") + "]";
224224
} else if (sm.isPriority()) {
225-
code += ws+ws+ sm_name + " = PriorityContainer(outcomes=['" + sm.getOutcomes().join("', '") + "']";
225+
code += ws+ws+ sm_name + " = PriorityContainer(outcomes=[" + sm.getOutcomes().map(x => "'" + x + "'").join(", ") + "]";
226226
} else {
227-
code += ws+ws+ sm_name + " = OperatableStateMachine(outcomes=['" + sm.getOutcomes().join("', '") + "']";
227+
code += ws+ws+ sm_name + " = OperatableStateMachine(outcomes=[" + sm.getOutcomes().map(x => "'" + x + "'").join(", ") + "]";
228228
}
229229
if (sm.getInputKeys().length > 0) {
230230
code += ", input_keys=['" + sm.getInputKeys().join("', '") + "']";

src/io/io_codeparser.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ IO.CodeParser = new (function() {
264264
}
265265

266266

267-
var parseCreateSection = function(code, only_interface) {
267+
var parseCreateSection = function(code, only_interface, state_type_imports) {
268268
// get root sm var name
269269
var root_sm_name_result = code.match(return_sm_pattern);
270270
if (root_sm_name_result == null) throw "could not identify root state machine";
@@ -344,7 +344,7 @@ IO.CodeParser = new (function() {
344344
var idx = i * 2 + 1;
345345
sm_states.push({
346346
sm_name: sm_parts[idx],
347-
sm_states: parseStates(sm_parts[idx+1])
347+
sm_states: parseStates(sm_parts[idx+1], state_type_imports)
348348
});
349349
}
350350

@@ -434,14 +434,14 @@ IO.CodeParser = new (function() {
434434
}
435435

436436

437-
var parseStates = function(code) {
437+
var parseStates = function(code, state_type_imports) {
438438
var code_splitted = code.split(state_begin_pattern);
439439
if (code_splitted.length == 1) throw "a container does not contain any states"
440440

441441
var state_list = [];
442442

443443
for (var i=4; i<code_splitted.length; i+=4) {
444-
var state_param_result = parseStateParams(helper_splitOnTopCommas(code_splitted[i]));
444+
var state_param_result = parseStateParams(helper_splitOnTopCommas(code_splitted[i]), state_type_imports);
445445
if (code_splitted[i-3] != undefined)
446446
state_param_result.state_pos_x = parseInt(code_splitted[i-3]);
447447
if (code_splitted[i-2] != undefined)
@@ -460,7 +460,7 @@ IO.CodeParser = new (function() {
460460
return state_list;
461461
}
462462

463-
var parseStateParams = function(params) {
463+
var parseStateParams = function(params, state_type_imports) {
464464
// get name
465465
var state_name = helper_removeQuotes(params[0]);
466466
var state_class = "";
@@ -474,7 +474,9 @@ IO.CodeParser = new (function() {
474474
var class_result = params[1].match(state_class_pattern);
475475
if (class_result != null) {
476476
state_class = class_result[1];
477-
var params_split = helper_splitOnTopCommas(params[1].replace(state_class, ""));
477+
if (!state_class.includes("__") && state_type_imports != undefined && state_type_imports[state_class] != undefined)
478+
state_class = state_type_imports[state_class] + "__" + state_class;
479+
var params_split = helper_splitOnTopCommas(params[1].replace(class_result[1], ""));
478480
params_split.forEach(function(element, i) {
479481
var keyvalue = helper_splitKeyValue(element, "=");
480482
if (keyvalue != undefined && !element.startsWith("lambda")) {
@@ -626,7 +628,7 @@ IO.CodeParser = new (function() {
626628
var init_result = parseInitSection(code_init);
627629

628630
// parse create section
629-
var create_result = parseCreateSection(code_create, false);
631+
var create_result = parseCreateSection(code_create, false, top_result.state_type_imports);
630632

631633
// parse additional functions
632634

src/ros/ros.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,12 @@ rospy.spin()
9393

9494
that.getPackagePythonPath = function(package_name, callback) {
9595
var python_path = undefined;
96+
var temp_package_path = undefined;
9697
that.getPackageList((package_cache) => {
9798
for (var i=0; i<package_cache.length; i++) {
9899
if (package_cache[i]['name'] == package_name) {
99100
python_path = package_cache[i]['python_path'];
101+
temp_package_path = package_cache[i]['path'];
100102
break;
101103
}
102104
}
@@ -105,7 +107,7 @@ rospy.spin()
105107
callback(python_path);
106108
});
107109
} else {
108-
var proc = spawn(python, ['-c', `import importlib; print(importlib.import_module('` + package_name + `').__path__[-1])`]);
110+
var proc = spawn(python, ['-c', `import importlib; temp = importlib.import_module('` + package_name + `').__path__; path_index = next((i for i, x in enumerate(temp) if ('`+ temp_package_path +`' in x)), -1); print(temp[path_index])`]);
109111
var path_data = '';
110112
proc.stdout.on('data', data => {
111113
path_data += data;
@@ -143,4 +145,4 @@ rospy.spin()
143145
// });
144146
// }
145147

146-
}) ();
148+
}) ();

0 commit comments

Comments
 (0)