Set-up inertial matrix
I would like to add to Breve the possibilities to setup the parameters of the bodies manually as it is possible in ODE in order to write a function like:
setParameters(mass, I11, I22, I33, I12, I13, I23);
Untill now it is possible to set up the mass, but not the inertial matrix.
I've seen in the source file that there is a function called:
void slShape::slMatrixToODEMatrix( const double inM[ 3 ][ 3 ], dReal *outM ) ;
so it should be easy to modify the python class to obtain what I want, without the needs of recompiling breve. Anyone know how to do it?

Shape.pm and Shape.py
I've look around in the code, I think the file to change are Shape.pm and Shape.py for sure..is there something else to modify?
engine change is needed...
An engine change will be required to get this to work -- I'll get it into the next build.
- jon
Workaround
Thanks for the reply and for including my request in the next build.
I don't want to be akward, but I need to finish a project, do you have any idea when the build will be released?
Otherwise can I use a workaround?
Thanks a lot
building from source or using binary?
Have you built breve from the source? I could get a fix into the SVN in the next couple of days.
What platform are you working on?
- jon
Thanks
Yes I've built breve from the source. I'm working on Leopard.
Thanks a lot, really!
fix in the svn
A fix has been added in the svn -- give it a try and let me know if you run into any problems.
- jon
error
I get the following error:
NameError: global name 'shapePointer' is not defined
An error occurred while executing the file "Shape.py
I look in Shape.py and the function is defined as :
breve.breveInternalFunctionFinder.shapeSetInertiaMatrix( shapePointer, newInertia )
thus , I think it should be self.shapePointer .
If I modify I get:
RuntimeError: Internal breve function called for Python object not in breve engine (missing call to __init__ for the parent class?)
An error occurred while executing the file "Shape.py"
How should I solve it?
Sorry...
My fault (I tested with the steve version, not the Python version) -- the correct line should be like this:
breve.breveInternalFunctionFinder.shapeSetInertiaMatrix( self, self.shapePointer, newInertia )
- jon
no problem
I still get an error after I've modified Shape.py as you said:
File "/Users/ste/breve/trunk/breve/lib/classes/breve/Shape.py", line 124, in setInertiaMatrix
breve.breveInternalFunctionFinder.shapeSetInertiaMatrix( self, self.shapePointer, newInertia )
File "/Users/ste/Desktop/Home/workspace/Salamander/src/Breve/__init__.py", line 254, in __call__
RuntimeError: invalid type for argument 1 of internal function "shapeSetInertiaMatrix" (got "data", expected "matrix" )
An error occurred while executing the file "Shape.py"
How are you calling
How are you calling setInertiaMatrix? Are you passing in a breve.matrix object? The following works for me (in the SuperWalker demo):
linkShape.setInertiaMatrix( breve.matrix( 1, 0, 0, 0, 1, 0, 0, 0, 1 ) )
- jon
Ok
yes it works...I was trying to initialize a 2Dmatrix!
Now I'll try to test if everything works fine...
Thanks a lot again
It works!
Ok I've made a few examples tries and it works correctly!