setLinearVelocity Function ?

Youne
Posts: 40
Joined: Sun Jan 27, 2008 2:55 pm

setLinearVelocity Function ?

Post by Youne »

Hi Everybody,

I noticed something which seems a little odd to me and I would really like to have some explications for this. The function setLinearVelocity allows us to apply a linear Velocity to a rigidbody. I did the following tests which entails applying a Velocity to :
1st case: a single object with a mass M
2nd case: to the same object linked by a constraint to another object of any mass M'.

in the 1st case : it's fine
in the 2nd case : I realised that the object does not move with the velocity which we applied on it (and in addition this velocity also depends on the mass of the second object M'.)

My aim in this model is to apply a constant velocity to an object linked to another (like Hydraulic jack). Therefore I would like to know how I should proceed? Because in my opinion the function setLinearVelocity is not the appropriate function to achieve this!

Thank you for your Help

Youne
Youne
Posts: 40
Joined: Sun Jan 27, 2008 2:55 pm

Re: setLinearVelocity Function ?

Post by Youne »

no one can help me !

I want just to know the real function of setLinearVelocity ?

Thanks

Youne
RobW
Posts: 33
Joined: Fri Feb 01, 2008 9:44 am

Re: setLinearVelocity Function ?

Post by RobW »

I'm not sure if I understand your question, but it sounds like you should just call setLinearVelocity on both objects. Would that not work?

Cheers,
Rob
Youne
Posts: 40
Joined: Sun Jan 27, 2008 2:55 pm

Re: setLinearVelocity Function ?

Post by Youne »

!!!!
Last edited by Youne on Tue Apr 22, 2008 6:07 pm, edited 1 time in total.
Youne
Posts: 40
Joined: Sun Jan 27, 2008 2:55 pm

Re: setLinearVelocity Function ?

Post by Youne »

"Can no one help me?" if you want :D
Last edited by Youne on Tue Apr 22, 2008 3:11 pm, edited 1 time in total.
Oogst
Posts: 25
Joined: Thu Apr 10, 2008 11:19 am
Location: Utrecht, Netherlands

Re: setLinearVelocity Function ?

Post by Oogst »

Didn't you mean to ask "Can no one help me?" ;)

Anyway: I still am not sure I understand your question. Is the problem that you want object A get a certain speed, but you want object B to be modified through the constraint instead of doing it directly? That sounds like you need to apply extra speed to A to compensate for the speed that is lost to influence object B through the constraint.

Is that what you mean?
Youne
Posts: 40
Joined: Sun Jan 27, 2008 2:55 pm

Re: setLinearVelocity Function ?

Post by Youne »

Hi Oogst,

Thank you for answering my question but I don’t think you quite understood what I was asking. So let me try to explain one more time. I am in the process of modelling what you can see in the picture below: (a pivoting arm which moves by using a hydraulic jack (Piston)). The hydraulic jack is modelled by two rigid bodies linked by btGeneric6DofConstraint (Slider : Lowerlimit < Upperlimit -> axis it limited ihan tt range)

One end of the hydraulic jack is linked to a static rigid body, and the other end is linked to the arm. The arm has an axis of rotaion (can be seen in red in the picture).
The hydraulic jack works in the following way :
We apply a constant speed to the piston which moves at this constant speed without taking into consideration the mass of the arm.

So now my question is :
what purpose does the following function serve SetLinearVelocity ?


normally from what I have understood the answer to the above question is that the function SetLinearVelocity applies the vector velocity to a rigid body. I was able to confirm this when I applied this function to a single rigid body.

However, what I don’t understand is that why when I apply the same function to one of the two linked rigid bodies (i.e. the piston of the hydraulic jack)with the same speed that I used for a single rigid body, nothing happens.

If you have understood my question and the problem I have to solve in my model, can you please tell me how I can get the piston of the hydraulic jack to move in same way it did when I applied the function SetLinearVelocity to the piston alone.

Thanks

Youne
You do not have the required permissions to view the files attached to this post.
Oogst
Posts: 25
Joined: Thu Apr 10, 2008 11:19 am
Location: Utrecht, Netherlands

Re: setLinearVelocity Function ?

Post by Oogst »

I think I am getting it now. The problem is, I think, that the one object cannot move without the other, so if one is given a speed, then it must propagate part of that speed to the other. I would expect dampened movement because of that, however, not no movement at all.

Have you tried using the applyForce function instead? And what happens if you set the speed to some enormous amount? Does it still not move?
ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway

Re: setLinearVelocity Function ?

Post by ola »

If the two bodies are coupled with constraints then I would suggest that you use a constraint motor instead, to move the body. Applying linear velocity to one of them will probably not work the way you want it to because the constraints apply impulses to the bodies all the time which directly influences the velocity.

If you use the btGeneric6DofConstraint it has got motors that should do the job you're looking for.

Cheers,
Ola
Youne
Posts: 40
Joined: Sun Jan 27, 2008 2:55 pm

Re: setLinearVelocity Function ?

Post by Youne »

Hi Ola,

Actually I think you are right about what you said. To model the slider I use btGeneric6DofConstraint so I looked at the Demo which uses btRotationalLimitMotor but noo Demo which uses btTranslationalLimitMotor. In addition, I found the following comment in the file btGeneric6DofConstraint.h
/*
For Linear limits, use btGeneric6DofConstraint.setLinearUpperLimit, btGeneric6DofConstraint.setLinearLowerLimit. You can set the parameters with the btTranslationalLimitMotor structure accsesible through the btGeneric6DofConstraint.getTranslationalLimitMotor method.
At this moment translational motors are not supported. May be in the future.
*/
This means that this solution has not yet been developped. Am I correct?

Thanks

Youne
ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway

Re: setLinearVelocity Function ?

Post by ola »

Oh, I wasn't aware of that. :-(

In that case I think you should try to apply a force (or an impulse) on the piston part, in the direction that it should move. It might be a bit tricky to find just the correct amount of force that will create the movement that you want, that's sort of what the motor does in the first place...

Ola
User avatar
projectileman
Posts: 109
Joined: Thu Dec 14, 2006 4:27 pm
Location: Colombia

Re: setLinearVelocity Function ?

Post by projectileman »

Code: Select all


Hi Ola,

Actually I think you are right about what you said. To model the slider I use btGeneric6DofConstraint so I looked at the Demo which uses btRotationalLimitMotor but noo Demo which uses btTranslationalLimitMotor. In addition, I found the following comment in the file btGeneric6DofConstraint.h
/*
For Linear limits, use btGeneric6DofConstraint.setLinearUpperLimit, btGeneric6DofConstraint.setLinearLowerLimit. You can set the parameters with the btTranslationalLimitMotor structure accsesible through the btGeneric6DofConstraint.getTranslationalLimitMotor method.
At this moment translational motors are not supported. May be in the future.
*/
This means that this solution has not yet been developped. Am I correct?

Thanks

Youne

That's right, that feature wasn't implemented yet. However, there is an Slider Joint in the new Bullet library. Check it out at Google Code. Now it comes with very interesting features and improvementes (Deformations and new joint types),

Another question, anybody has worked with Rotational motors in btGeneric6DofConstraint? I haven't had time for playing with bullet, sorry.