Skip to content

Commit

Permalink
Merge pull request #8 from benmaidel/mojin-devel
Browse files Browse the repository at this point in the history
Merge master into mojin-devel
  • Loading branch information
fmessmer committed Mar 25, 2020
2 parents 6bbfed1 + 41733cb commit d248008
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<run_depend>genpy</run_depend>
<run_depend>actionlib</run_depend>
<run_depend>rospack</run_depend>
<run_depend>rospy_message_converter</run_depend>

<run_depend>flexbe_onboard</run_depend>
<run_depend>flexbe_mirror</run_depend>
Expand Down
19 changes: 13 additions & 6 deletions src/_helper/checking.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ Checking = new (function() {
var that = this;

var python_varname_pattern = /^[a-z_][a-z0-9_]*$/i;
var python_reserved_list = ["and", "assert", "break", "class", "continue", "def", "del", "elif",
"else", "except", "exec", "finally", "for", "from", "global", "if",
"import", "in", "is", "lambda", "not", "or", "pass", "print",
var python_reserved_list = ["and", "assert", "break", "class", "continue", "def", "del", "elif",
"else", "except", "exec", "finally", "for", "from", "global", "if",
"import", "in", "is", "lambda", "not", "or", "pass", "print",
"raise", "return", "try", "while", "yield"];

this.checkBehavior = function() {
Expand Down Expand Up @@ -236,8 +236,15 @@ Checking = new (function() {
available_userdata = available_userdata.concat(Behavior.getDefaultUserdata().map(function(el) { return el.key; }));
}
if (!available_userdata.contains(sm_dataflow[i].getOutcome())) {
if (!UI.Statemachine.isDataflow()) UI.Statemachine.toggleDataflow();
return "input key " + sm_dataflow[i].getOutcome() + " of state " + state.getStatePath() + " could be undefined";
var idx = state.getParameters().indexOf(sm_dataflow[i].getOutcome())
if (idx >= 0 && state.getParameterValues()[idx] != "None") {
T.logWarn("input key " + sm_dataflow[i].getOutcome() + " of state " + state.getStatePath() + " is overwritten by parameter with same name");
continue;
}
else {
if (!UI.Statemachine.isDataflow()) UI.Statemachine.toggleDataflow();
return "input key " + sm_dataflow[i].getOutcome() + " of state " + state.getStatePath() + " could be undefined";
}
}
}

Expand Down Expand Up @@ -277,7 +284,7 @@ Checking = new (function() {

var close_stack = [];
var dot_last = false;

for (var i = 0; i < expr.length; i++) {
var c = expr[i];
if (dot_last && !c.match(/[a-z_0-9]/i)) return false;
Expand Down
6 changes: 3 additions & 3 deletions src/ros/ros_actionclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import yaml
def feedback_cb(msg):
comm = dict()
comm['msg'] = yaml.load(genpy.message.strify_message(msg))
comm['msg'] = yaml.safe_load(genpy.message.strify_message(msg))
comm['type'] = "`+TYPE_FEEDBACK+`"
sys.stdout.write(json.dumps(comm))
sys.stdout.flush()
def result_cb(state, msg):
comm = dict()
comm['msg'] = yaml.load(genpy.message.strify_message(msg))
comm['msg'] = yaml.safe_load(genpy.message.strify_message(msg))
comm['state'] = str(state)
comm['type'] = "`+TYPE_RESULT+`"
sys.stdout.write(json.dumps(comm))
Expand Down Expand Up @@ -142,7 +142,7 @@ while not rospy.is_shutdown():
if (timer != undefined) clearTimeout(timer);
timer = setTimeout(timeout_cb, timeout);
}

}

that.close = function() {
Expand Down
3 changes: 2 additions & 1 deletion src/ros/ros_subscriber.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import importlib
import json
import genpy
import yaml
from rospy_message_converter import json_message_converter
def callback(msg):
sys.stdout.write(json.dumps(yaml.load(genpy.message.strify_message(msg))))
sys.stdout.write(json_message_converter.convert_ros_message_to_json(msg))
sys.stdout.flush()
topic = sys.argv[1]
Expand Down
6 changes: 3 additions & 3 deletions src/ui/ui_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ UI.Settings = new (function() {
'collapse_error': false,
'collapse_hint': false,
'default_package': 'flexbe_behaviors',
'code_indentation': 0,
'code_indentation': 2,
'explicit_states': false,
'editor_command': 'gedit --new-window $FILE +$LINE',
'transition_mode': 1,
Expand Down Expand Up @@ -102,7 +102,7 @@ UI.Settings = new (function() {
document.getElementById("cb_collapse_error").checked = items.collapse_error;
collapse_hint = items.collapse_hint;
document.getElementById("cb_collapse_hint").checked = items.collapse_hint;

default_package = items.default_package;
that.createBehaviorPackageSelect(document.getElementById("select_default_package"));
code_indentation = items.code_indentation;
Expand Down Expand Up @@ -381,7 +381,7 @@ UI.Settings = new (function() {
var content = JSON.stringify(config);
entry.createWriter(function(writer) {
writer.onerror = function(error) { T.logError("Error when exporting configuration: " + error); };
writer.onwriteend = function() {
writer.onwriteend = function() {
if (!truncated) {
truncated = true;
this.truncate(this.position);
Expand Down

0 comments on commit d248008

Please sign in to comment.