-
Notifications
You must be signed in to change notification settings - Fork 361
Allow system plugins to control update affinity in distributed simulation #3214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
srmainwaring
wants to merge
11
commits into
gazebosim:gz-sim10
Choose a base branch
from
srmainwaring:prs/10/distributed-levels
base: gz-sim10
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Allow system plugins to control update affinity in distributed simulation #3214
srmainwaring
wants to merge
11
commits into
gazebosim:gz-sim10
from
srmainwaring:prs/10/distributed-levels
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b5d0571 to
faa5a7c
Compare
Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
- Move CreateEntities to Run, must be available before Step. - Add debug output. Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
dfc726c to
17a2693
Compare
Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
- Add error message if secondary fails to remove parent entity. - Only remove models if performer is assigned to another secondary. - Set the secondary namespace on the update info. - Add debug output. Signed-off-by: Rhys Mainwaring <[email protected]>
- Use update info and performer affinity to control update. - Display model properties. Signed-off-by: Rhys Mainwaring <[email protected]>
- Simplify levels example. - Add LevelDebug system to red vehicle. - Restore levels for red vehicle. Signed-off-by: Rhys Mainwaring <[email protected]>
17a2693 to
37148a0
Compare
- Only check a model is a performer once in configure. Signed-off-by: Rhys Mainwaring <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🎉 New feature
DRAFT: (debug output to be removed etc. currently left to aid discussion of proposed approach) .
Allow systems to access the
NetworkManagerSecondarynamespace in distributed simulations so that model plugins associated with a performer can have the update limited to the secondary assigned to that performer.There are also some bug fixes to ensure that performer parent model is available before the secondary stepping starts, and that models are only unloaded from secondaries that are not assigned.
Summary
The main issue is that presently a model system plugin will be updated on all running
NetworkManagerinstances. This includes the primary, and all secondaries. There are examples where we would like a model system plugin to be only updated by the secondary responsible for updating the performer associated with the model owning the plugin. This is the case if the model is publishing data, or needs to remain in lock-step with some other service (such as a socket or other bridging application in the case of links to flight controller SITL backends such as those available for PX4 or ArduPilot).This can be done by adding the secondary namespace to
UpdateInfoobject which is passed to all Systems when they are updated in theSimulationRunner. The system can elect to compare the namespace with the performer affinity, and decide whether or not to update. An example plugin (LevelDebug) is provided.Test it
Terminal 1
Terminals 2,3,4
Terminal 5
Terminal 6
Example output for a couple of iterations:
Terminal 1: Primary
Terminal 2: Secondary 1
Terminal 3: Secondary 2
Terminal 4: Secondary 3
Here we can see that only secondary 2 (
44e7c996) has detailed output fromLevelDebug, as this is the secondary associated withvehicle_red. In the GUI the rover will advance through the levels, and they will load and unload as expected.Additional notes
SimulationRunner::Runmethod so the parent models are available beforeOnStepis called. The original logic to remove models from performers that are unassigned will remove parent models from secondaries that receive more than one performer affinity for the same performer which may result in a secondary with affinity not having the performer's model in the ECM.Outstanding Tasks
Affinity assignment
There is an issue with multiple performers - needs fixing
The problem is related the performer affinity assignment. These are set in the
NetworkManagerPrimary, and interpreted in theNetworkManagerSecondary.The performer affinity is passed from the primary to the secondary in the
SimulationStepmessage.In the current implementation the entries in the list of performer affinities passed to the secondary are not unique, there may be repeated entries for a given entity to secondary assignment and an entity may be assigned to more than one secondary.
The primary assumes that the last assigned secondary for an entity is used (this is the behaviour coded in NetworkManagerPrimary::SetAffinity).
Suggest that the NetworkManagerPrimary ensures that the list of performer affinities contains a single entry for each performer entity. This will simplify the affinity assignment logic in the secondary.
Checklist
codecheckpassed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-byandGenerated-bymessages.