Changing mass properties "online"

View: New views
14 Messages — Rating Filter:   Alert me  

Changing mass properties "online"

by epajarre-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I have a problem with way ODE handles mass.

I have an object which consists for example of
4 parts, which have been connected with joints.

Unfortunately I have to change the mass properties
of the parts during the simulation. I guess just changing
the total mass might be manageable, but changing the
mass distribution seems to really cause me problems.

As the mass in ODE must be centered it seems that I have
to sort of rebuild my parts around their new positions, while
keeping the joints happy. Usually this doesn't quite work and
the joints cause rather violent movements in the system.


  Eero

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "ode-users" group.
To post to this group, send email to ode-users@...
To unsubscribe from this group, send email to ode-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ode-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Changing mass properties "online"

by epajarre-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message




On Oct 12, 10:49 pm, epajarre <epaja...@...> wrote:
> I have a problem with way ODE handles mass.
>

Of course the description above was, as usual, meant to
be a request for help or ideas how to avoid the problem.

      Eero

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "ode-users" group.
To post to this group, send email to ode-users@...
To unsubscribe from this group, send email to ode-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ode-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Changing mass properties "online"

by Nguyen Binh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Changing mass during simulation breaks many assumptions made around
ODE (and almost all physics engines). For exaple, Newton second law:

f = d(mv)/dt

if m is constant then f=ma which is what everybody is using. If m is
not a constant then you should have:

f = ma+v*d(m)/dt

So if there is no rotational terms, you may only need to add the term
v*d(m)/dt to the right hand side like external forces. But with fully
3D rotation, it may become ugly.

So in conclusion, you may not get the right result for your problem
with (unmodified) ODE.


--------------------------------------------------
Binh Nguyen
Computer Science Department
Rensselaer Polytechnic Institute
Troy, NY, 12180
--------------------------------------------------



On Mon, Oct 12, 2009 at 3:49 PM, epajarre <epajarre@...> wrote:

>
> I have a problem with way ODE handles mass.
>
> I have an object which consists for example of
> 4 parts, which have been connected with joints.
>
> Unfortunately I have to change the mass properties
> of the parts during the simulation. I guess just changing
> the total mass might be manageable, but changing the
> mass distribution seems to really cause me problems.
>
> As the mass in ODE must be centered it seems that I have
> to sort of rebuild my parts around their new positions, while
> keeping the joints happy. Usually this doesn't quite work and
> the joints cause rather violent movements in the system.
>
>
>  Eero
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "ode-users" group.
To post to this group, send email to ode-users@...
To unsubscribe from this group, send email to ode-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ode-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Changing mass properties "online"

by epajarre-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message




On Oct 12, 11:03 pm, Nguyen Binh <ngb...@...> wrote:
> Changing mass during simulation breaks many assumptions made around
> ODE (and almost all physics engines). For exaple, Newton second law:
>
> f = d(mv)/dt
>
> if m is constant then f=ma which is what everybody is using. If m is
> not a constant then you should have:
>
> f = ma+v*d(m)/dt

At the moment, I am not worried about these problems. For example if
the
mass increase slows the object, or not, is not (at the moment)
significant.

Actually most often the mass changes happen in a situation when there
is
very little or no movement. Still, if I need to change the mass
distribution the
need the "rebuild" my objects does make them drift apart a little,
which then
causes joint violence.

    Eero
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "ode-users" group.
To post to this group, send email to ode-users@...
To unsubscribe from this group, send email to ode-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ode-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Changing mass properties "online"

by Nguyen Binh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> Actually most often the mass changes happen in a situation when there
> is
> very little or no movement. Still, if I need to change the mass
> distribution the
> need the "rebuild" my objects does make them drift apart a little,
> which then
> causes joint violence.
>

 ODE's constraint is in the form :
Jv = c with J is the Jacobian. Note that J is dependent on m and
moment of inertia tensor. So if you changed m and inertia tensor, you
also invalidate those constraints. There may not be an easy way to fix
it as ODE is NOT made to deal with such situation. I can only think of
a way around for your problem is to properly consider changing masses
(read my previous email).

hth.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "ode-users" group.
To post to this group, send email to ode-users@...
To unsubscribe from this group, send email to ode-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ode-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Changing mass properties "online"

by Daniel K. O.-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


2009/10/12 epajarre <epajarre@...>:
> As the mass in ODE must be centered it seems that I have
> to sort of rebuild my parts around their new positions, while
> keeping the joints happy. Usually this doesn't quite work and
> the joints cause rather violent movements in the system.

The body's point of reference is its center of mass. So if you want
your body to change its center of mass, you actually have to change
the mass distribution, move the body to the new center, adjust all the
joint anchors, and offset the geoms. But as Nguyen pointed out, you
might have to compensate the velocities, or you'll arbitrarily change
the kinetic energy of the system. It all comes down to what you are
trying to achieve; maybe just some smaller changes + damping + ERP and
CFM tweaks can be enough for your case.

If the gradual drifting of the joints is undesirable you can always
try to write your own attachment code, and make sure it's always
consistent.

--
Daniel K. O.
"The only way to succeed is to build success yourself"

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "ode-users" group.
To post to this group, send email to ode-users@...
To unsubscribe from this group, send email to ode-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ode-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Changing mass properties "online"

by Jon Watte (ODE)-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


epajarre wrote:
> Unfortunately I have to change the mass properties
> of the parts during the simulation. I guess just changing
> the total mass might be manageable, but changing the
> mass distribution seems to really cause me problems.
>  

How would you physically construct the contraption you're trying to
simulate? Using springs, levers, etc?

Sincerely,

jw



--

  Revenge is the most pointless and damaging of human desires.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "ode-users" group.
To post to this group, send email to ode-users@...
To unsubscribe from this group, send email to ode-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ode-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Changing mass properties "online"

by Jon Watte (ODE)-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Daniel K. O. wrote:
> If the gradual drifting of the joints is undesirable you can always
> try to write your own attachment code, and make sure it's always
> consistent.
>
>  

Or, if changing is instantaneous, you can just destroy the current
bodies/geoms, and create new bodies/geoms in the positions you want
them, and restore the angular/linear velocities you want them to have.

Sincerely,

jw



--

  Revenge is the most pointless and damaging of human desires.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "ode-users" group.
To post to this group, send email to ode-users@...
To unsubscribe from this group, send email to ode-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ode-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Changing mass properties "online"

by epajarre-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message




On Oct 13, 2:01 am, Jon Watte <jwa...@...> wrote:
>
> How would you physically construct the contraption you're trying to
> simulate? Using springs, levers, etc?

Physically it is a vehicle, where the cargo is added or changed.

Keeping with the real world situation, it is typical that this happens
when the vehicle is stopped :-) Thus the dynamic equations are not
my main problem.

             Eero
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "ode-users" group.
To post to this group, send email to ode-users@...
To unsubscribe from this group, send email to ode-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ode-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Changing mass properties "online"

by epajarre-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message




On Oct 13, 2:03 am, Jon Watte <jwa...@...> wrote:
>
> Or, if changing is instantaneous, you can just destroy the current
> bodies/geoms, and create new bodies/geoms in the positions you want
> them, and restore the angular/linear velocities you want them to have.


This is basically what I do now. I just seem to have problems in
recreating the  bodies to match their new properties, and still
precisely
keep their positions/orientations.
(I don't use the ODE geometry/collision stuff so I don't directly
have that problem, but of course I also have to keep track of the
bodies offsets to the related structures)

I have thought about delegating the changeable mass to a separate
body which would be attached with a fixed joint to the main body,
but I am not actually sure how much this would help, and ODE
documents don't seem to like fixed joints.

          Eero


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "ode-users" group.
To post to this group, send email to ode-users@...
To unsubscribe from this group, send email to ode-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ode-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Changing mass properties "online"

by Jon Watte (ODE)-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


epajarre wrote:

>
> On Oct 13, 2:01 am, Jon Watte <jwa...@...> wrote:
>  
>> How would you physically construct the contraption you're trying to
>> simulate? Using springs, levers, etc?
>>    
>
> Physically it is a vehicle, where the cargo is added or changed.
>
> Keeping with the real world situation, it is typical that this happens
> when the vehicle is stopped :-) Thus the dynamic equations are not
> my main problem.
>  


So why wouldn't you build the vehicle out of bodies and joints, and then
add the load as a body connected to the chassis with a fixed joint? That
should be easy to detach/re-attach as appropriate (with whatever center
of mass you want).

Sincerely,

jw



--

  Revenge is the most pointless and damaging of human desires.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "ode-users" group.
To post to this group, send email to ode-users@...
To unsubscribe from this group, send email to ode-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ode-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Changing mass properties "online"

by epajarre-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message




On Oct 13, 8:20 am, Jon Watte <jwa...@...> wrote:

> So why wouldn't you build the vehicle out of bodies and joints, and then
> add the load as a body connected to the chassis with a fixed joint? That
> should be easy to detach/re-attach as appropriate (with whatever center
> of mass you want).

I will try this. As mentioned in my earlier message, I had thought
about
this, but I was worried if it would cause other problems. (partly
because
ODE documents don't really encourage using fixed joints).

 thank you for your comments!


         Eero

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "ode-users" group.
To post to this group, send email to ode-users@...
To unsubscribe from this group, send email to ode-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ode-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Changing mass properties "online"

by Daniel K. O.-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


2009/10/13 epajarre <epajarre@...>:
> I have thought about delegating the changeable mass to a separate
> body which would be attached with a fixed joint to the main body,
> but I am not actually sure how much this would help, and ODE
> documents don't seem to like fixed joints.

It's recommended to avoid fixed joints because people would use it
when they could just as easily use a single body with multiple geoms
(and added masses.)

Less bodies + less joints = smaller system = faster + more stable

--
Daniel K. O.
"The only way to succeed is to build success yourself"

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "ode-users" group.
To post to this group, send email to ode-users@...
To unsubscribe from this group, send email to ode-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ode-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Changing mass properties "online"

by epajarre-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message




On Oct 13, 7:39 am, "Daniel K. O." <danielko.lis...@...> wrote:

> It's recommended to avoid fixed joints because people would use it
> when they could just as easily use a single body with multiple geoms
> (and added masses.)
>
> Less bodies + less joints = smaller system = faster + more stable
>


I am still working on this (among other issues)...

So far my results are:

Adding two extra bodies to a system consisting of originally 4 bodies,
created a system where the mass properties can be changed smoothly.
(Only 2 of the 4 original bodies needed adjustable mass)

However, the overall program speed (where ODE is just a part) dropped
by approximately 10%, which can become a real issue.

I have also made advances in changing the mass in the original "merged
mass" system, while keeping the system behavior "smooth".

In the end, the traditional ODE way, of merging all the masses and not
using fixed joints, may win.


          Eero



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "ode-users" group.
To post to this group, send email to ode-users@...
To unsubscribe from this group, send email to ode-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ode-users?hl=en
-~----------~----~----~----~------~----~------~--~---