-
Notifications
You must be signed in to change notification settings - Fork 269
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
System plugins keep executing after their model is removed. #2217
Comments
I implemented a simple workaround like this: void WasteBin::PostUpdate(const UpdateInfo & _info, const EntityComponentManager & _ecm)
{
if (_info.paused) return;
if (!this->dataPtr->configured) return;
if (!this->dataPtr->model.Valid(_ecm))
{
gzwarn << "Model <" << this->dataPtr->modelName << "> no longer valid. "
<< "Disabling WasteBin plugin." << std::endl;
this->dataPtr->configured = false;
return;
}
[...]
} While this works well, it has following drawbacks:
So I still feel that model and sensor plugins should be disabled (or removed) automatically upon removal of the corresponding model or sensor. |
Another example:
Result: Flood of error messages:
I 'fixed' this in my local tree with a similar workaround as above, but meh... void JointPositionController::PreUpdate(
const UpdateInfo &_info,
EntityComponentManager &_ecm)
{
GZ_PROFILE("JointPositionController::PreUpdate");
if (kNullEntity == this->dataPtr->model.Entity())
{
return;
}
if (!this->dataPtr->model.Valid(_ecm))
{
gzwarn << "JointPositionController model no longer valid. "
<< "Disabling plugin." << std::endl;
this->dataPtr->model = Model(kNullEntity);
return;
}
[...]
} |
Yes currently the |
This commit tries to address #2217. In particular if a user despawns an entity, the associated plugin gets removed. This should prevent issues like #2165. TBH I'm not sure if this is the right way forward as a system should technically be able to access any entity in a traditional ECS. I also recognize that there may be some performance impact. I will need to quantify this. Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Johan Rutgeerts <[email protected]>
) * Temporary fix for #2165 until #2217 is resolved. Signed-off-by: Johan Rutgeerts <[email protected]> * Added comment to clarify the added code. Signed-off-by: Johan Rutgeerts <[email protected]> --------- Signed-off-by: Johan Rutgeerts <[email protected]>
Latching on to this: I get an |
Yeah. That is expected I'm currently working on a fix for it here: #2232 |
This commit tries to address #2217. In particular if a user despawns an entity, the associated plugin gets removed. This should prevent issues like #2165. TBH I'm not sure if this is the right way forward as a system should technically be able to access any entity in a traditional ECS. I also recognize that there may be some performance impact. I will need to quantify this. Signed-off-by: Arjo Chakravarty <[email protected]>
This commit tries to address #2217. In particular if a user despawns an entity, the associated plugin gets removed. This should prevent issues like #2165. TBH I'm not sure if this is the right way forward as a system should technically be able to access any entity in a traditional ECS. I also recognize that there may be some performance impact. I will need to quantify this. Signed-off-by: Arjo Chakravarty <[email protected]> Signed-off-by: Arjo Chakravarty <[email protected]>
Fixed by #2232 |
Environment
Description
Many system plugins need to be attached to a model (e.g. to access that model's links, collisions, etc).
However, when that model is removed, the plugin keeps running.
Given typically a model plugin needs to access entities of the model (that no longer exist), this leads to crashes.
Expected behavior
When a model is removed, all of its plugins are removed as well, or at the least their pre/update/post methods are no longer called.
Steps to reproduce
Add this plugin to a model.
Start the simulation
Select the model in the Entity Tree, right click + 'remove'
The model is removed, but the
cout
message is still being output to the terminal.The text was updated successfully, but these errors were encountered: