add new exit flag to gymkhana channel scoring plugin #35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Depends on osrf/vrx#233
Fixes problem:
When boat passes the last set of navigation gates in the gymkhana task, shutdown signal is issued to Gazebo.
A new SDF parameter flag
per_plugin_exit_on_completion
is added.After these two PRs are merged, we will need to test
vrx-docker
withghostship
solution and make sure Gazebo no longer shuts down prematurely.It's a tiny bit hacky, because now we have two flags for "exiting upon completion." One specified from the environment variables, and another from the SDF parameter. This is because we are chaining multiple scoring plugins for a single task.
They are slightly different in that, the env var is for all the plugins in the current shell, and the SDF parameter is just for one specific plugin.
The dilemma is how to resolve the two when one is true, the other is false.
Currently, I have the env var overwrite the SDF parameter.
Alternatively, we can do an AND or OR, but that might make the
vrx-docker
evaluation more complicated, because the evaluationrun_trial.bash
issuesVRX_EXIT_ON_COMPLETION=true
for all tasks. We currently don't say, issue it on all tasks except gymkhana.In the overwrite behavior, we can set
VRX_EXIT_ON_COMPLETION=false
, and explicitly specify the SDF parameter flag in each world xacro file. This I think is the cleanest way, though it adds a few lines of SDF.To test:
Keep this running in a terminal:
For all cases below, once the topic
state
field changes torunning
, move the boat by keyboard / mouse /rostopic pub
straight forward. Observe what happens when it passes the last set of gates.Case 1: Original behavior
Comment out the new line
<per_plugin_exit_on_completion>false</per_plugin_exit_on_completion>
.Expected: When boat passes last gates, gzserver is killed in terminal. gzclient will still be open but no further steps are simulated. No new messages in the rostopic echo above.
Case 2: Added behavior
Uncomment the new line
<per_plugin_exit_on_completion>false</per_plugin_exit_on_completion>
.Expected: When boat passes last gates, Gazebo continues running. The
state
field in rostopic echo above changes tofinished
,score
remains the same for all subsequent messages.Additionally, I tested by echoing the two tasks in two separate terminals
and saw that when the top-level task "finished" with 0 second left, sub-task blackbox "running" with 1 second left (due to small differences in transport maybe), shutdown was still issued to gazebo, by design.
That verifies that the top-level scoring plugin's time is respected (
<per_plugin_exit_on_completion>
is false for the two sub-tasks, true for the top-level task.)Case 3: Original environment variable overwrites added behavior
Uncomment the new line
<per_plugin_exit_on_completion>false</per_plugin_exit_on_completion>
.Expected: Same as case 1.
I hope nothing else is broken, but more thorough tests to find bugs are welcome.