Newbie questions
Hi!
I'm new to Breve and I hope you guys can help me to solve some doubts.
1)I've created 5 mobile bodies connected by 4 revolution joint, a joint connects a pair of bodies.
Without applying any forces or torques (The gravity is setup to zero) the bodies start to move. This happens also if I setup all torques and force, velocity to zero during the whole iteration.
If I print out the torques, I can see that there is a torque different from zero applied to the bodies..how is it possible? How can I remove?
2)Differently from ODE if I apply a Force/Torque to a body, it is still present after one step of simulation, is not reset to zero, right?
3)Differently from ODE if I want to apply more than one force/torque to a body, I've to sum the forces and than apply just once through the setForce()/setTorque() function, is it correct?
Thanks

Ok I post also the example
Ok I post also the example code that give me torque without I've not set any of them related to the question 1)
import breve
from math import *
NUM_LINK=10
class Test( breve.PhysicalControl ):
def __init__(self):
breve.PhysicalControl.__init__( self )
self.zeroGravity()
self.setErp(0.8)
self.setIntegrationStep(0.0005)
self.setIterationStep(0.0005)
self.setBackgroundColor( breve.vector( 0.0, 0.0, 0.0 ) )
"""Create Shape for the links"""
self.linkShape=breve.createInstances( breve.Cube, 1 ).initWith( breve.vector( 0.07, 0.035, 0.055 ) )
self.linkShape.setDensity(1000.0)
"""Create links"""
self.links = breve.createInstances( breve.Link, NUM_LINK )
for i in range(NUM_LINK):
self.links[i].setShape( self.linkShape )
self.links[i].setColor( breve.vector( 0.0, 1.0, 0 ))
self.links[i].offset( breve.vector( -i*0.07, 0.0, 0.0 ))
self.links[i].showBoundingBox()
self.links[i].enablePhysics()
"""Create joints"""
self.joints=breve.createInstances(breve.RevoluteJoint,NUM_LINK-1)
for i in range(NUM_LINK-1):
self.joints[i].link( breve.vector(0.0,0.0,1.0),breve.vector(-0.03500,0.0,0.0),breve.vector(0.03500,0.0,0.0),self.links[i],self.links[i+1])
self.pointCamera( breve.vector( 0.0, 0.0, 0.0 ), breve.vector( 0.0, 0.0, 2.0 ) )
self.watch( self.links[0] )
def iterate( self ):
print "Time", self.getTime()
for i in range(NUM_LINK):
print "Link",i
print "\tPosition", self.links[i].getLocation()
print "\tTorque", self.links[i].getTorque()
print "\tForce",self.links[i].getForce()
breve.PhysicalControl.iterate( self )
Test()
1. This sounds a little
1. This sounds a little fishy. What kind of movement do you see? It's possible that either you have conflicting joint constraints in the model, or that the objects were in conflicting positions when the joints were created so that they bodies "snap" into place by the force of the constraints when the simulation begins.
The "get-torque" method returns the ODE joint feedback torque, not the applied torque, so it would be normal to see non-zero values whenever there's any movement in the system at all. So it gets back to the question of why the system is moving, but I suspect it may be one of the explanations above.
2. This is correct.
3. Also correct -- setForce/setTorque actually *set* (change) the torque/force, as opposed to "apply" torque/force.
- jon
Thanks a lot for the
Thanks a lot for the answers.
The body is spinning around the first mobile link.
When the joint are created in breve are positioned in (0,0,0) of the global coordinate, and to position where you want you have to use the function offset, isn't? So I've created 10 rigid bodies (the problem happens also if there are less) of dimension x= 0.07 y=0.035 z=0.055 and each of them I've shift on the x axis to create a chain of body. Then I've created 9 hinge joints that connect two by two the bodies. Where can it be the conflict constraint?
using MultiBody?
Are you using a MultiBody object?
Objects linked within the same multibody are automatically repositioned to the proper locations when they are linked.
Objects not in a multibody will be left in their original position, which would cause the "snapping" as the constraints are enforced for the first time. If everything is positioned at (0,0,0), then this is what I would expect to see.
This is by design and is the same behavior as in ODE, though ODE does not offer the MultiBody functionality which can be used to work around the issue.
- jon
Solved
Thanks a lot I've solved, it was a constraint problem, as you said. I've switched the parent to the child link and now it works!
My mistake ;-)