Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project!

## Re: [Pyode-user] Questions about inertia tensors

 Re: [Pyode-user] Questions about inertia tensors From: Bill Call - 2012-05-22 05:05:01 ```On 5/21/2012 1:32 PM, Will Bosworth wrote: > Hi Bill, > > I do not understand your initial assumption not to use joints. Fixed > joints are very straightforward to implement, and I believe are stiff > to the extent that the global ERP and CFM integrator parameters are > stiff. What documentation suggests not to use joints? I'd like to see > it. > > Based on what I know about your problem and ODE, if in your shoes i > would stick to a one-to-one mass and body implementation and use fixed > joints to sew the complex body together. I am pretty sure that bodies > can be rotated with body.setRotation(r), for instance as in > http://monsterden.net/software/ragdoll-pyode-tutorial (string search > setRotation there). > > best, > Will > > > > On Sat, May 19, 2012 at 8:23 PM, Bill Call wrote: >> Hi : >> >> I'm trying to build a rigid-body simulation using PyODE/PyOpenGL. Since >> I'm just doing rigid-body, it is my understanding that I have no need >> for joints; I just need to add masses to my body at the appropriate >> translations/rotations. >> >> I have a number of cylindrical masses in my body. These cylinders have >> fixed positions and rotations within the body, but are not necessarily >> aligned with the X, Y or Z axis. PyODE does not bind the rotateMass() >> function from ODE; it only allows me to specify an X, Y or Z orientation >> for cylindrical mass (at creation time). This means that I am unable to >> rotate my cylindrical masses to the correct orientation. >> >> My guess is that this would not be a problem if each of these masses had >> their own Body; I could just rotate the body after the mass was bound. >> Doing doing it that way might work, but it would mean connecting the >> cylinders to the main body via joints, and what little documentation >> there is seems to contraindicate the use of joints for rigid-body >> simulations. >> >> My questions are as follows: >> >> 1) Am I correct in my assumption that I must rotate/translate the mass >> tensor to reflect the true location/orientation of my cylindrical masses >> within the containing body? It seems (to me) to be intuitively obvious >> that I do, but I don't put much stock in my intuition regarding this >> subject. >> >> 2) If the answer to (1) is "yes", then can anybody point me a rotation >> implementation? If "no", then would someone be willing to explain why not? >> >> I have already spent a lot of time Googling about for this information, >> but I am not sufficiently grounded in the subject to really understand >> the answers I have been able to find on my own; not well enough to write >> a function to rotate inertial tensors, anyway. >> >> Thanks in Advance, >> >> >> Bill Call >> >> >> >> >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Pyode-user mailing list >> Pyode-user@... >> https://lists.sourceforge.net/lists/listinfo/pyode-user Will: Following up on the whole "why not use fixed joints?" question, I was able to find the original data. The most telling comment comes from the ODE Wiki itself: http://ode-wiki.org/wiki/index.php?title=Manual:_Joint_Types_and_Functions#Fixed and reads as follows: "The fixed joint maintains a fixed relative position and orientation between two bodies, or between a body and the static environment. Using this joint is almost never a good idea in practice, except when debugging. If you need two bodies to be glued together it is better to represent that as a single body." I can understand the point: the ERP and CFM parameters are always going to leave some wiggle room. If you want it rigid, make it a single body. I can testify that this works quite well. In my case, though I am trying to simulate a quad-copter, and I just want to apply torque to the motor bodies and let ODE compute the net effect. I don't see how I can do that with a single body unless I want to do the math myself. Regards, Bill C. ```

 [Pyode-user] Questions about inertia tensors From: Bill Call - 2012-05-20 00:23:28 ```Hi : I'm trying to build a rigid-body simulation using PyODE/PyOpenGL. Since I'm just doing rigid-body, it is my understanding that I have no need for joints; I just need to add masses to my body at the appropriate translations/rotations. I have a number of cylindrical masses in my body. These cylinders have fixed positions and rotations within the body, but are not necessarily aligned with the X, Y or Z axis. PyODE does not bind the rotateMass() function from ODE; it only allows me to specify an X, Y or Z orientation for cylindrical mass (at creation time). This means that I am unable to rotate my cylindrical masses to the correct orientation. My guess is that this would not be a problem if each of these masses had their own Body; I could just rotate the body after the mass was bound. Doing doing it that way might work, but it would mean connecting the cylinders to the main body via joints, and what little documentation there is seems to contraindicate the use of joints for rigid-body simulations. My questions are as follows: 1) Am I correct in my assumption that I must rotate/translate the mass tensor to reflect the true location/orientation of my cylindrical masses within the containing body? It seems (to me) to be intuitively obvious that I do, but I don't put much stock in my intuition regarding this subject. 2) If the answer to (1) is "yes", then can anybody point me a rotation implementation? If "no", then would someone be willing to explain why not? I have already spent a lot of time Googling about for this information, but I am not sufficiently grounded in the subject to really understand the answers I have been able to find on my own; not well enough to write a function to rotate inertial tensors, anyway. Thanks in Advance, Bill Call ```
 Re: [Pyode-user] Questions about inertia tensors From: James Thomas - 2012-05-21 15:14:33 Attachments: Message as HTML ```In my experience there is a limitation which prevents summing masses except at their cg. In general, in order to make a single body with a complex mass you need to use transform geoms. Unfortunately I'm not sure whether applying the rotation to the transform geom solves your problem. Looking at my code I have a comment that I need to use mass.rotate() but then I don't. I may have just punted and left it as a loose end. My code is using the Ode implementation in Panda3d which is based on a different version of ODE and does not use transform geoms so I can't really help you with code specifics. JT On Sat, May 19, 2012 at 5:23 PM, Bill Call wrote: > Hi : > > I'm trying to build a rigid-body simulation using PyODE/PyOpenGL. Since > I'm just doing rigid-body, it is my understanding that I have no need > for joints; I just need to add masses to my body at the appropriate > translations/rotations. > > I have a number of cylindrical masses in my body. These cylinders have > fixed positions and rotations within the body, but are not necessarily > aligned with the X, Y or Z axis. PyODE does not bind the rotateMass() > function from ODE; it only allows me to specify an X, Y or Z orientation > for cylindrical mass (at creation time). This means that I am unable to > rotate my cylindrical masses to the correct orientation. > > My guess is that this would not be a problem if each of these masses had > their own Body; I could just rotate the body after the mass was bound. > Doing doing it that way might work, but it would mean connecting the > cylinders to the main body via joints, and what little documentation > there is seems to contraindicate the use of joints for rigid-body > simulations. > > My questions are as follows: > > 1) Am I correct in my assumption that I must rotate/translate the mass > tensor to reflect the true location/orientation of my cylindrical masses > within the containing body? It seems (to me) to be intuitively obvious > that I do, but I don't put much stock in my intuition regarding this > subject. > > 2) If the answer to (1) is "yes", then can anybody point me a rotation > implementation? If "no", then would someone be willing to explain why not? > > I have already spent a lot of time Googling about for this information, > but I am not sufficiently grounded in the subject to really understand > the answers I have been able to find on my own; not well enough to write > a function to rotate inertial tensors, anyway. > > Thanks in Advance, > > > Bill Call > > > > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Pyode-user mailing list > Pyode-user@... > https://lists.sourceforge.net/lists/listinfo/pyode-user > ```
 Re: [Pyode-user] Questions about inertia tensors From: Bill Call - 2012-05-21 18:16:19 Attachments: Message as HTML ```On 5/21/2012 9:50 AM, James Thomas wrote: > In my experience there is a limitation which prevents summing masses > except at their cg. In general, in order to make a single body with a > complex mass you need to use transform geoms. Unfortunately I'm not > sure whether applying the rotation to the transform geom solves your > problem. Looking at my code I have a comment that I need to use > mass.rotate() but then I don't. I may have just punted and left it as > a loose end. My code is using the Ode implementation in Panda3d which > is based on a different version of ODE and does not use transform > geoms so I can't really help you with code specifics. > > JT > > On Sat, May 19, 2012 at 5:23 PM, Bill Call > wrote: > > Hi : > > I'm trying to build a rigid-body simulation using PyODE/PyOpenGL. > Since > I'm just doing rigid-body, it is my understanding that I have no > need > for joints; I just need to add masses to my body at the appropriate > translations/rotations. > > I have a number of cylindrical masses in my body. These cylinders > have > fixed positions and rotations within the body, but are not necessarily > aligned with the X, Y or Z axis. PyODE does not bind the rotateMass() > function from ODE; it only allows me to specify an X, Y or Z > orientation > for cylindrical mass (at creation time). This means that I am > unable to > rotate my cylindrical masses to the correct orientation. > > My guess is that this would not be a problem if each of these > masses had > their own Body; I could just rotate the body after the mass was bound. > Doing doing it that way might work, but it would mean connecting the > cylinders to the main body via joints, and what little documentation > there is seems to contraindicate the use of joints for rigid-body > simulations. > > My questions are as follows: > > 1) Am I correct in my assumption that I must rotate/translate the mass > tensor to reflect the true location/orientation of my cylindrical > masses > within the containing body? It seems (to me) to be intuitively > obvious > that I do, but I don't put much stock in my intuition regarding this > subject. > > 2) If the answer to (1) is "yes", then can anybody point me a rotation > implementation? If "no", then would someone be willing to explain > why not? > > I have already spent a lot of time Googling about for this > information, > but I am not sufficiently grounded in the subject to really understand > the answers I have been able to find on my own; not well enough to > write > a function to rotate inertial tensors, anyway. > > Thanks in Advance, > > > Bill Call > > > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. > Discussions > will include endpoint security, mobile security and the latest in > malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Pyode-user mailing list > Pyode-user@... > > https://lists.sourceforge.net/lists/listinfo/pyode-user > > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > > > _______________________________________________ > Pyode-user mailing list > Pyode-user@... > https://lists.sourceforge.net/lists/listinfo/pyode-user James: Thanks for your reply. I am using transform geoms. As you note I have no choice in this matter as PyODE does not support offsets. The transform geoms seem to be working correctly; all my geoms render in the correct location, even when rotation/translation is applied to the parent body. It is also true the ODE requires that a single body with multiple masses have its CoG at (0, 0, 0); this I have also done. In any event, the transform geoms don't help, because mass is bound to bodies, not geoms. I assume that if each of my geoms had its own body, mass rotation wouldn't be an issue. Interestingly, I did try an experiment in which I created a body with a single cylinder geom and cylinder mass, then rotated the body. Examining the inertia tensor before and after the rotation shows that the tensor did not change. This doesn't really surprise me; I assume it means that the tensor is is terms of the bodies coordinate system, which is presumably constant. I don't know about Panda3d, but the PyODE bindings don't support mass.rotate(); perhaps this is also a problem for Panda3d, and this is why you did not implement? In any event, I cannot imagine how this could not be important. If the tensors for the off-axis masses are not rotated/translated correctly, then the summed inertial tensor for the body will be off, which is not a good thing for my application. I am currently attempting to work around the problem by reverse-engineering the orignal ODE roatate mass code from C++ to python. Since I only have to rotate each affected mass once, at the time I construct my body, the fact that performance will be poor is not a factor. This seems to be working, but I am currently setting up a test to compare the output of my Python dMassRotate() function with that of ODE. Regards, Bill C. ```
 Re: [Pyode-user] Questions about inertia tensors From: Will Bosworth - 2012-05-21 18:32:59 ```Hi Bill, I do not understand your initial assumption not to use joints. Fixed joints are very straightforward to implement, and I believe are stiff to the extent that the global ERP and CFM integrator parameters are stiff. What documentation suggests not to use joints? I'd like to see it. Based on what I know about your problem and ODE, if in your shoes i would stick to a one-to-one mass and body implementation and use fixed joints to sew the complex body together. I am pretty sure that bodies can be rotated with body.setRotation(r), for instance as in http://monsterden.net/software/ragdoll-pyode-tutorial (string search setRotation there). best, Will On Sat, May 19, 2012 at 8:23 PM, Bill Call wrote: > Hi : > > I'm trying to build a rigid-body simulation using PyODE/PyOpenGL. Since > I'm  just doing rigid-body,  it is my understanding that I have no need > for joints; I just need to add masses to my body at the appropriate > translations/rotations. > > I have a number of cylindrical masses in my body.  These cylinders have > fixed positions and rotations within the body, but are not necessarily > aligned with the X, Y or Z axis.  PyODE does not bind the rotateMass() > function from ODE; it only allows me to specify an X, Y or Z orientation > for cylindrical mass (at creation time). This means that I am unable to > rotate my cylindrical masses to the correct orientation. > > My guess is that this would not be a problem if each of these masses had > their own Body; I could just rotate the body after the mass was bound. > Doing doing it that way might work, but it would mean connecting the > cylinders to the main body via joints, and what little documentation > there is seems to contraindicate the use of joints for rigid-body > simulations. > > My questions are as follows: > > 1) Am I correct in my assumption that I must rotate/translate the mass > tensor to reflect the true location/orientation of my cylindrical masses > within the containing body?  It seems (to me) to be intuitively obvious > that I do, but I don't put much stock in my intuition regarding this > subject. > > 2) If the answer to (1) is "yes", then can anybody point me a rotation > implementation?  If "no", then would someone be willing to explain why not? > > I have already spent a lot of time Googling about for this information, > but I am not sufficiently grounded in the subject to really understand > the answers I have been able to find on my own; not well enough to write > a function to rotate inertial tensors, anyway. > > Thanks in Advance, > > > Bill Call > > > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Pyode-user mailing list > Pyode-user@... > https://lists.sourceforge.net/lists/listinfo/pyode-user ```
 Re: [Pyode-user] Questions about inertia tensors From: Bill Call - 2012-05-22 05:05:01 ```On 5/21/2012 1:32 PM, Will Bosworth wrote: > Hi Bill, > > I do not understand your initial assumption not to use joints. Fixed > joints are very straightforward to implement, and I believe are stiff > to the extent that the global ERP and CFM integrator parameters are > stiff. What documentation suggests not to use joints? I'd like to see > it. > > Based on what I know about your problem and ODE, if in your shoes i > would stick to a one-to-one mass and body implementation and use fixed > joints to sew the complex body together. I am pretty sure that bodies > can be rotated with body.setRotation(r), for instance as in > http://monsterden.net/software/ragdoll-pyode-tutorial (string search > setRotation there). > > best, > Will > > > > On Sat, May 19, 2012 at 8:23 PM, Bill Call wrote: >> Hi : >> >> I'm trying to build a rigid-body simulation using PyODE/PyOpenGL. Since >> I'm just doing rigid-body, it is my understanding that I have no need >> for joints; I just need to add masses to my body at the appropriate >> translations/rotations. >> >> I have a number of cylindrical masses in my body. These cylinders have >> fixed positions and rotations within the body, but are not necessarily >> aligned with the X, Y or Z axis. PyODE does not bind the rotateMass() >> function from ODE; it only allows me to specify an X, Y or Z orientation >> for cylindrical mass (at creation time). This means that I am unable to >> rotate my cylindrical masses to the correct orientation. >> >> My guess is that this would not be a problem if each of these masses had >> their own Body; I could just rotate the body after the mass was bound. >> Doing doing it that way might work, but it would mean connecting the >> cylinders to the main body via joints, and what little documentation >> there is seems to contraindicate the use of joints for rigid-body >> simulations. >> >> My questions are as follows: >> >> 1) Am I correct in my assumption that I must rotate/translate the mass >> tensor to reflect the true location/orientation of my cylindrical masses >> within the containing body? It seems (to me) to be intuitively obvious >> that I do, but I don't put much stock in my intuition regarding this >> subject. >> >> 2) If the answer to (1) is "yes", then can anybody point me a rotation >> implementation? If "no", then would someone be willing to explain why not? >> >> I have already spent a lot of time Googling about for this information, >> but I am not sufficiently grounded in the subject to really understand >> the answers I have been able to find on my own; not well enough to write >> a function to rotate inertial tensors, anyway. >> >> Thanks in Advance, >> >> >> Bill Call >> >> >> >> >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Pyode-user mailing list >> Pyode-user@... >> https://lists.sourceforge.net/lists/listinfo/pyode-user Will: Following up on the whole "why not use fixed joints?" question, I was able to find the original data. The most telling comment comes from the ODE Wiki itself: http://ode-wiki.org/wiki/index.php?title=Manual:_Joint_Types_and_Functions#Fixed and reads as follows: "The fixed joint maintains a fixed relative position and orientation between two bodies, or between a body and the static environment. Using this joint is almost never a good idea in practice, except when debugging. If you need two bodies to be glued together it is better to represent that as a single body." I can understand the point: the ERP and CFM parameters are always going to leave some wiggle room. If you want it rigid, make it a single body. I can testify that this works quite well. In my case, though I am trying to simulate a quad-copter, and I just want to apply torque to the motor bodies and let ODE compute the net effect. I don't see how I can do that with a single body unless I want to do the math myself. Regards, Bill C. ```
 Re: [Pyode-user] Questions about inertia tensors From: James Thomas - 2012-05-25 20:24:44 Attachments: Message as HTML ```Turns out Panda3d does implement mass.rotate. I think the reason why I did not use it is because it needs a 3x3 rotation matrix and my code uses quaternions everywhere. So I need to add some glue-code to make it work. What I have noticed is that Panda3d seems to be based on a newer version of ODE than PyODE (or they have altered the API) and the differences are significant when it comes to composite bodies (for example they don't have transform geoms). Unfortunately I think the solution for you is to calculate the inertia tensor yourself for the composite of the mass objects. Then just make a single mass for your body and assign it the inertia tensor you calculated. Maybe that is deeper than you were hoping to dig but it should something that is pretty well covered on the Internet. JT ```