Skip to content
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

[SofaKernel] implement activer's code at CollisionModel. #1259

Merged
merged 5 commits into from
Mar 12, 2020

Conversation

remibessard
Copy link
Contributor

add SphereActiver class in SphereModel so that some controller inheriting from this class can compute sphere(s) de/activation during execution


This PR:

  • builds with SUCCESS for all platforms on the CI.
  • does not generate new warnings.
  • does not generate new unit test failures.
  • does not generate new scene test failures.
  • does not break API compatibility.
  • is more than 1 week old (or has fast-merge label).

Reviewers will merge only if all these checks are true.

…ting from this class can compute sphere(s) de/activation during execution
@remibessard remibessard added enhancement About a possible enhancement pr: status to review To notify reviewers to review this pull-request labels Feb 24, 2020
@damienmarchal
Copy link
Contributor

Hi remi,

Thanks for the PR.
Would it be possible to have that the top of the collision model hierarchy so that the activation filter feature is available for every model instead of Sphere ?

@remibessard
Copy link
Contributor Author

remibessard commented Feb 25, 2020

Actually this feature is already available for PointModel and LineModel. That's why I just added it in the same way for SphereModel.
But you're right, we can try to add it at the top of collision model hierarchy.
One thing is that sometimes when a controller is heritating from this "PrimitiveActiver" we want to implement different behaviours for several type of primitive; I guess that with the generalization approach we would have to implement a controller for each behaviour (not that bad), or you can help me understand how we could avoid doing so ?

@epernod
Copy link
Contributor

epernod commented Feb 25, 2020

Hi, can you explain me in which case you need a contoller to inherite from this class to active or not the sphereModel compare to having a controller that search for the sphereModel and change the Data activate
is it to be able to activate only a set of spheres?

@remibessard
Copy link
Contributor Author

remibessard commented Feb 25, 2020

Indeed epernod, for each sphere/line/point the LocalMinDistance component checks if it is activated or not, not the whole collisionModel component.
Unless I am mistaken this process is/was? used by some BeamAdapter controllers to de/activate a set of points/lines during the execution.
In my case I have a beam and an insertion point through which the beam is sliding. I want the collision spheres/lines on one side of this insertion point to be activated, the other ones deactivated.
If there is another way to achieve the same result, I will be glad to use it instead of using this additionnal code.

protected:
core::behavior::MechanicalState<DataTypes>* mstate;
Data<std::string> SphereActiverPath; ///< path of a component SphereActiver that activate or deactivate collision sphere during execution
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of Datastd::string, use Link for component path and stuff

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I applied the same pattern as it was coded for Point/Line activers.
You probably mean I should correct Sphere Line and Point activers then ? Would not it break some plugin controller code ? Do we care about it ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right about breaking things, but it is for the sake of cleaning 🤽‍♂ (just add breaking flag)
Personally I would bring at least this part (Link) to the other line/point activers ; especially if we suppose that the task #1262 wont be completed before a while...
Just my cent though 🦆

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me, if a feature is duplicated in more than two component...is a strong indication that it is time to re-factor it. I may be wrong but do #1262 task so complex ?

@hugtalbot hugtalbot added pr: status wip Development in the pull-request is still in progress and removed pr: status to review To notify reviewers to review this pull-request labels Feb 26, 2020
@remibessard
Copy link
Contributor Author

[ci-build][with-all-tests]

@remibessard remibessard added the pr: breaking Change possibly inducing a compilation error label Feb 28, 2020
@fredroy
Copy link
Contributor

fredroy commented Feb 28, 2020

👍

@hugtalbot hugtalbot added pr: status ready Approved a pull-request, ready to be squashed pr: status to review To notify reviewers to review this pull-request and removed pr: status wip Development in the pull-request is still in progress pr: status ready Approved a pull-request, ready to be squashed labels Feb 29, 2020
@damienmarchal
Copy link
Contributor

damienmarchal commented Mar 3, 2020

I just gave it a look and it seems easy to move up the whole code at CollisionModel level... so please do so, code will be cleaner, shorter and will offer a more consistent interface to users.

In addition I see no problem in breaking code that does not follows Sofa guidelines. So renaming activated() into isActive() and other stuff like that would be welcome to :)

@guparan guparan added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Mar 11, 2020
@epernod epernod merged commit 57d962f into sofa-framework:master Mar 12, 2020
@damienmarchal damienmarchal changed the title [SofaKernel] add SphereActiver class in SphereModel [SofaKernel] implement activer's code at CollisionModel. Mar 17, 2020
@guparan guparan added this to the v20.06 milestone Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement About a possible enhancement pr: breaking Change possibly inducing a compilation error pr: status ready Approved a pull-request, ready to be squashed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants