moorepants / learn-multibody-dynamics

Interactive computational book on multibody dynamics
https://moorepants.github.io/learn-multibody-dynamics/
Other
123 stars 29 forks source link

Subs during vel and acc calcs #87

Open moorepants opened 2 years ago

moorepants commented 2 years ago

Something like B.ang_vel_in(N, subs=qd_repl) could be helpful instead of B.set_ang_vel(N, B.ang_vel_in(N).xreplace(qd_repl)).

tjstienstra commented 1 year ago

Not sure if this is behaviour we should want. The task of ang_vel_in is not to store the velocity, but to compute it. Personally I would keep this explicit, also because this would create loops in the angular velocity graph. Loops are allowed in the angular velocity (loops are only checked in _dcm). However if a user want to create a loop, which I do myself often enough, I would like to to it explicitly and not almost magically. This would also create a loop, while just requesting the angular velocity with the subs specified for ease.

moorepants commented 1 year ago

I see. ang_vel_in would be computing and setting if we included the subs kwarg...but doesn't it already compute and set?

tjstienstra commented 1 year ago

It would be an option to set it, when subs is specified. Currently it does not save it, see #23741. Personally, I do also have a bit of a preference to keeping it explicit. It is nice if you use it a lot, but it is an extra feature that can be confusing.