sympy.physics.mechanics #24620
Replies: 8 comments 2 replies
-
In general, you have to add every constraint (holonomic and nonholomic) as algebraic equations to your ordinary differential equations to get the DAE system. During integration your integrator routine must reduce the drift each time step for the constraints. B.2.2 here https://underactuated.csail.mit.edu/multibody.html shows the general form and mentions Baumgarte's stabilization technique that is one method of dealing with the drift. But, nonholonomic constraints are linear in the generalized speeds and you can analytically solve the equations for some speeds. (opposed to holonomic constraints which typically can't be analytically solved for). If you solve for some of the generalized speeds with the nonholonomic constraint equations you can eliminate the need to include these algebraic equations and manage their drift. That's what I do here: https://moorepants.github.io/learn-multibody-dynamics/nonholonomic-eom.html |
Beta Was this translation helpful? Give feedback.
-
Thanks!
1.
If I understood Baumgarte's idea correctly, he adds a force, and possibly
dampening, which 'pulls' the body which should meet the configuration
constraint towards meeting this constraint.
If I understood correctly, I tried this with a 3D four link pendulum, by
simply putting a spring between the 4th body and the location it should be
at. This worked really well.
2.
I know this lecture, and I enjoyed it.
If I understood correctly, what you describe there is equivalent to
using *velocity
constraints* in sympy.physics.mechanics Kane's method.
I did this in my example, but in my example, I also, additionally so to
speak, used the solutions of the velocity constraints in every step of the
numerical integration.
This seemed to help the integration.
Thanks again!
On Sat 28. Jan 2023 at 15:22 Jason K. Moore ***@***.***> wrote:
In general, you have to add every constraint (holonomic and nonholomic) as
algebraic equations to your ordinary differential equations to get the DAE
system. During integration your integrator routine must reduce the drift
each time step for the constraints. B.2.2 here
https://underactuated.csail.mit.edu/multibody.html shows the general form
and mentions Baumgarte's stabilization technique that is one method of
dealing with the drift.
But, nonholonomic constraints are linear in the generalized speeds and you
can analytically solve the equations for some speeds. (opposed to holonomic
constraints which typically can't be analytically solved for). If you solve
for some of the generalized speeds with the nonholonomic constraint
equations you can eliminate the need to include these algebraic equations
and manage their drift. That's what I do here:
https://moorepants.github.io/learn-multibody-dynamics/nonholonomic-eom.html
—
Reply to this email directly, view it on GitHub
<#24620 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AT5MQUU76VABYVUEG3LPP6LWUTJKZANCNFSM6AAAAAAUJNJ35I>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Best regards,
Peter Stahlecker
|
Beta Was this translation helpful? Give feedback.
-
I don't think this is the same and would result in just a stiff system (because you have to make that spring super stiff to work). The Baumgarte correction doesn't introduce such a stiffness. If I remember correctly, you linearize the constraint equations about the current state (at each time step) and find the effective force which pushes the states back towards a satisfied constraint. For holonomic constraints this requires an interative process and for nonholonomic, which are linear already you can calculate the needed force directly. |
Beta Was this translation helpful? Give feedback.
-
Yes, my spring had to be mighty stiff!
However, the configuration cnstraints were kept pretty well, while without
the spring they drifted away quickly.
I found an understandable explanation of Baumgarte's method here:
https://www.researchgate.net/publication/227225246_Investigation_on_the_Baumgarte_Stabilization_Method_for_Dynamic_Analysis_of_Constrained_Multibody_Systems
I think, I will play around with this a bit.
On Sat 28. Jan 2023 at 18:02 Jason K. Moore ***@***.***> wrote:
If I understood correctly, I tried this with a 3D four link pendulum, by
simply putting a spring between the 4th body and the location it should be
at. This worked really well.
I don't think this is the same and would result in just a stiff system
(because you have to make that spring super stiff to work). The Baumgarte
correction doesn't introduce such a stiffness. If I remember correctly, you
linearize the constraint equations about the current state (at each time
step) and find the effective force which pushes the states back towards a
satisfied constraint. For holonomic constraints this requires an interative
process and for nonholonomic, which are linear already you can calculate
the needed force directly.
—
Reply to this email directly, view it on GitHub
<#24620 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AT5MQUQFAZFIEJIJKE66RR3WUT4FXANCNFSM6AAAAAAUJNJ35I>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Best regards,
Peter Stahlecker
|
Beta Was this translation helpful? Give feedback.
-
Maybe understandable, but still requires to solve a DAE system....
I read some other place, that this can be converted to an ODE system, but
it is unstable.
On Sun 29. Jan 2023 at 10:19 Peter Stahlecker ***@***.***>
wrote:
Yes, my spring had to be mighty stiff!
However, the configuration cnstraints were kept pretty well, while without
the spring they drifted away quickly.
I found an understandable explanation of Baumgarte's method here:
https://www.researchgate.net/publication/227225246_Investigation_on_the_Baumgarte_Stabilization_Method_for_Dynamic_Analysis_of_Constrained_Multibody_Systems
I think, I will play around with this a bit.
On Sat 28. Jan 2023 at 18:02 Jason K. Moore ***@***.***>
wrote:
> If I understood correctly, I tried this with a 3D four link pendulum, by
> simply putting a spring between the 4th body and the location it should be
> at. This worked really well.
>
> I don't think this is the same and would result in just a stiff system
> (because you have to make that spring super stiff to work). The Baumgarte
> correction doesn't introduce such a stiffness. If I remember correctly, you
> linearize the constraint equations about the current state (at each time
> step) and find the effective force which pushes the states back towards a
> satisfied constraint. For holonomic constraints this requires an interative
> process and for nonholonomic, which are linear already you can calculate
> the needed force directly.
>
> —
> Reply to this email directly, view it on GitHub
> <#24620 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AT5MQUQFAZFIEJIJKE66RR3WUT4FXANCNFSM6AAAAAAUJNJ35I>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
--
Best regards,
Peter Stahlecker
--
Best regards,
Peter Stahlecker
|
Beta Was this translation helpful? Give feedback.
-
You can convert DAE systems to ODE's. That's what I do in the snakeboard example. The "index" of the DAE can be changed with algebraic manipulation. But I don't think you can always convert to an ODE (e.g. holonomic constraint with no analytic solution). |
Beta Was this translation helpful? Give feedback.
-
This discusses that a bit: https://en.wikipedia.org/wiki/Differential-algebraic_system_of_equations |
Beta Was this translation helpful? Give feedback.
-
It sure does slow down the integration. Also it seems, that if the
configuration constraint is kept well without a spring added (like in a 2d
five link pendulum I did some time ago) the spring seems to hurt, rather
than help. Of course only an empirical finding.
On Mon 30. Jan 2023 at 13:50 Jason K. Moore ***@***.***> wrote:
Would this indicate, that my spring does not affect the motion of the
system much?
A stiff spring is perfectly fine to use instead of algebraic constraints.
It usually just comes with the price of slowing down integration or causing
numerical issues due to the very tiny time steps needed.
—
Reply to this email directly, view it on GitHub
<#24620 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AT5MQUQRXG6IGLDBAFNG34DWU5QB3ANCNFSM6AAAAAAUJNJ35I>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Best regards,
Peter Stahlecker
|
Beta Was this translation helpful? Give feedback.
-
I recently tried to set up Kanes equations for this: two discs are attached to an axle. They can rotate independently. This rolls on an uneven street. The result has about 50 mio operations in the force vector and about 3.5 mio operations in the mass matrix.
I learned from Jason Moore's lecture that forcing the configuration constraint to be met at each step helps the numerical integration.
Here in addition I had to force the resulting speed comstraints to be met at every step of the numerical integration, else it did not work at all.
My question: is forcing the speed constraints to be met at every step of the integration a valid thing to do, or am I making a mistake here?
Thanks for any help / clarification!
Beta Was this translation helpful? Give feedback.
All reactions