How can I stop the Hinge Joint?

143 views
Skip to first unread message

杨洋

unread,
Oct 19, 2012, 11:17:34 AM10/19/12
to ode-...@googlegroups.com
Hi,everybody!
 I used a hinge joint to simulate an arm. 
The function dJointSetHingeParam(g_hingejointID,  dParamVel,  osg::DegreesToRadians(10.0)) and dJointSetHingeParam(g_hingejointID, dParamFMax,  100.0) can make the arm move up and down,but how can I stop the joint? 
Setting the velocity zero seemed  not to work. 
Does ODE have a function to stop a hinge joint?
Thanks for your advice!

Mikko Rasa

unread,
Oct 20, 2012, 3:47:04 AM10/20/12
to ode-...@googlegroups.com
Setting dParamVel to zero should make the connected bodies stop rotating
relative to each other, as long as outside forces are not larger than
dParamFMax. How does the joint behave for you when you set dParamVel to
zero?

--
Mikko

杨洋

unread,
Oct 20, 2012, 6:39:41 AM10/20/12
to ode-...@googlegroups.com
Thanks for your answering! I forgot a thing: there is a cylinder "rope" with a box linked with the end of body2(which belongs to the hinge joint) by a ball joint. 
 When the body2 goes up(body1 stay still), I decrease the box's mass and set the dParamVel very small(almost zero), the hinge joint can stop, but it will descend  slowly.
Do you have any idea to stop it firmly? For this I wish to express my gratitude once again.

2012/10/20 Mikko Rasa <t...@tdb.fi>


--
Mikko

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


Mikko Rasa

unread,
Oct 20, 2012, 10:32:35 AM10/20/12
to ode-...@googlegroups.com
On 20.10.2012 13:39, 杨洋 wrote:
> Thanks for your answering! I forgot a thing: there is a cylinder "rope"
> with a box linked with the end of body2(which belongs to the hinge joint)
> by a ball joint.
> When the body2 goes up(body1 stay still), I decrease the box's mass and
> set the dParamVel very small(almost zero), the hinge joint can stop, but it
> will descend slowly.
> Do you have any idea to stop it firmly? For this I wish to express my
> gratitude once again.

Oh yes, that is actually to be expected. The amotor on the joint will
try to keep the angular velocity as zero, but it won't succeed perfectly
so there will be small creep. To really lock the joint in place, you
can set dParamLoStop and dParamHiStop to the current position of the
joint, obtainable with dJointGetHingeAngle. Remember to reset the stops
to -dInfinity and dInfinity when you want to move the joint again.

--
Mikko

杨洋

unread,
Oct 20, 2012, 9:34:47 PM10/20/12
to ode-...@googlegroups.com
Thanks! Actually I tried that way. Using the angle which is obtainable with dJointGetHingeAngle, I set dParamLoStop and dParamHiStop with the angle. The joint could stop but it went up and down in small scope just like a spring. I've no idea how can I solve the problem. 

2012/10/20 Mikko Rasa <t...@tdb.fi>


--
Mikko

Mikko Rasa

unread,
Oct 21, 2012, 3:30:55 AM10/21/12
to ode-...@googlegroups.com
On 21.10.2012 04:34, 杨洋 wrote:
> Thanks! Actually I tried that way. Using the angle which is obtainable with
> dJointGetHingeAngle, I set dParamLoStop and dParamHiStop with the angle.
> The joint could stop but it went up and down in small scope just like a
> spring. I've no idea how can I solve the problem.

Disabling the amotor by setting dParamFMax to zero might help.

Failing that, you could try making the stop slightly soft by setting
dParamStopCFM to a small positive value. The motor has to be disabled
for this to work properly.

--
Mikko

杨洋

unread,
Oct 21, 2012, 4:59:18 AM10/21/12
to ode-...@googlegroups.com
I'll try that. Many Thanks! You really do me a big favour!

2012/10/21 Mikko Rasa <t...@tdb.fi>


--
Mikko

yangs...@gmail.com

unread,
Oct 22, 2012, 4:06:46 AM10/22/12
to ode-...@googlegroups.com
I notice that the dParamVel has three parameters for option: dParamVel,dParamVel2,dParamVel3. What does that mean?  Do they represent the angular velocity of the three axes x,y,z?

已通过MOTOBLUR™连接


-----原始信息-----
来自: Mikko Rasa <t...@tdb.fi>
收件人:
ode-...@googlegroups.com
已发送:
2012-10-21, 周日, 07:30:57 格林尼治标准时间+0000
主题:
Re: [ode-users] How can I stop the Hinge Joint?

--
You received this message because you are subscribed to the Google Groups "ode-users" group.
To post to this group, send email to ode-...@googlegroups.com.
To unsubscribe from this group, send email to ode-users+...@googlegroups.com.

Dimitris Papavasiliou

unread,
Oct 22, 2012, 2:10:42 PM10/22/12
to ode-...@googlegroups.com
That's for joints that control rotation on three axes.  On a hinge joint only dParamVel is relevant.  If you want to completely brake a hinge joint in the shortest time possible and no matter what simply set its motor with a dParamVel of zero and a dParamFMax of dInfinity which means "aim for a speed of zero rpm and use as much force or rather torque as you need to get there".  dInfinity may be a bad idea in some cases.  If you get instabilities or normalization errors try just setting a "huge" (for you particular setup) value.

Dimitris

杨洋

unread,
Oct 22, 2012, 10:06:28 PM10/22/12
to ode-...@googlegroups.com
Your are right! I tried to set dParamVel2 and dParamVel3 with the hinge joint, it seems not to work. Thanks for your advice! I will give it a shot.

2012/10/23 Dimitris Papavasiliou <dpap...@gmail.com>
To view this discussion on the web visit https://groups.google.com/d/msg/ode-users/-/dtlLRB3jhqkJ.

杨洋

unread,
Oct 23, 2012, 11:47:54 AM10/23/12
to ode-...@googlegroups.com
Sorry for troubling again. I create three bodies - a  cylinder "arm", a cylinder "base" and a box "plane"  and two hinge joints: hinge1 and hinge2. Base and plane are linked by hinge1 whose axis is z. Arm and base are linked by hinge2 whose axis is y. Then the arm can rotate horizontally and vertically. 
There are two cylinder "ropes" which are linked by a slider joint and one of the rope is attached with the end of the arm by a ball joint.The other is attached with a box by a ball joint.
They are showed in SimCrane.png.
When I  make the arm go up then rotate right, the box moves so weirdly.The rope will incline a large angle. Does anybody have an advice to solve this?
Grateful for any advice!

2012/10/23 Dimitris Papavasiliou <dpap...@gmail.com>
To view this discussion on the web visit https://groups.google.com/d/msg/ode-users/-/dtlLRB3jhqkJ.
SimCrane.png
Weird.png

Dimitris Papavasiliou

unread,
Oct 23, 2012, 5:10:14 PM10/23/12
to ode-...@googlegroups.com
Given the fact that this is a crane it'd be safe to bet that the load, the box, is pretty heavy which is probably causing your problems.  This might happen in two ways:

1) If the rope bodies are very light, which probably is the case, you have a two bodies connected which are orders of magnitude apart in mass.  Floating point numbers can't handle calculations of a very wide dynamic range very well.

2) If the mass of the load is very big then the slider might not be, let's say "stiff" enough to hold its alignment properly.  In ODE parlance the CFM and ERP _of the slider joint_ might not be appropriate.  These values roughly translate to a spring and damper.  Check them up in the manual.

Now what I would suggest:

a) Make the load _much_ lighter.  If that fixes your problem then it's probably one of 1 or 2 above.
b) Try switching to double precision floating point.  You'll need to get ODE compiled for double precision through some package or a precompiled binary or compile it yourself.  This will give you more precision so ODE will handle the stiff equations you throw at it better and it will also change the default CFM and ERP values of the world, which the joints inherit.
c) Try to eliminate the rope unless it's vital to your simulation.  One way would be to use the double-ball joint but you'll have to compile the latest version of ODE from the subversion repository.  This'll get rid of the rope (the double-ball joint, as its name implies is a pair of ball joints a fixed distance apart), but you won't have the slider.  To get that without an intermediate rope body you need the prismatic double-ball joint.  I have a patch in the patches tracker in SourceForge which implements that joint but it hasn't been added to ODE yet (and I'm not sure it ever will).  It's no big deal to patch the sources yourself to get it though.  For more information on these joints (don't expect to find anything in the manual) check the recent list archives here.

Dimitris

杨洋

unread,
Oct 23, 2012, 9:43:42 PM10/23/12
to ode-...@googlegroups.com
Thank you very very much!  I will give it a shot.

2012/10/24 Dimitris Papavasiliou <dpap...@gmail.com>
To view this discussion on the web visit https://groups.google.com/d/msg/ode-users/-/636TafUkI10J.

杨洋

unread,
Oct 29, 2012, 3:59:44 AM10/29/12
to ode-...@googlegroups.com
I find why my SimCrane works so weirdly.I chalked it up to a rookie mistake--forgot to set world damping.

2012/10/24 Dimitris Papavasiliou <dpap...@gmail.com>
To view this discussion on the web visit https://groups.google.com/d/msg/ode-users/-/636TafUkI10J.

Dimitris Papavasiliou

unread,
Oct 29, 2012, 5:15:57 AM10/29/12
to ode-...@googlegroups.com

I find why my SimCrane works so weirdly.I chalked it up to a rookie mistake--forgot to set world damping.

Ah yes, I forgot to mention that.  I was meaning to tell you to set some feedback on the slider joint and see exactly how big the torque responsible for the turning of the king is.  Because if there is no friction whatsoever even a tiny amount can get it to turn (although in that case the kings mass must be very small).  In that case some damping would fix it.  On the other hand that doesn't really explain why the configuration won't fall if you fasten the king's hinge joint.  Best make sure the damping is not actually just masking the problem.

杨洋

unread,
Nov 1, 2012, 4:23:03 AM11/1/12
to ode-...@googlegroups.com
I make the crane lift a box(the green box in piture.png). When the box rises,it seems like the rope keeps a fixed angle with the crane arm(the light green object). I connect the rope with the arm and box by  ball joints. It should keep vertical downward. But the rope will not turn to a vertical direction until I stop the crane. How did it happen? And what should I do to solve the problem?
Thank you in advance for your assistance!

2012/10/29 Dimitris Papavasiliou <dpap...@gmail.com>
To view this discussion on the web visit https://groups.google.com/d/msg/ode-users/-/-0rP09AY5W8J.
piture.png

Dimitris Papavasiliou

unread,
Nov 1, 2012, 6:45:14 AM11/1/12
to ode-...@googlegroups.com

I make the crane lift a box(the green box in piture.png). When the box rises,it seems like the rope keeps a fixed angle with the crane arm(the light green object). I connect the rope with the arm and box by  ball joints. It should keep vertical downward. But the rope will not turn to a vertical direction until I stop the crane. How did it happen? And what should I do to solve the problem?
Thank you in advance for your assistance!

I don't think there is a problem, it looks like normal behavior to me.  Since the point where the rope attaches to the arm moves in a circle the tension which pull on the load does not point vertically up.  There is going to be some centrifugal acceleration pushing it outwards, the faster you rotate the crane arm the further out it should go.  Consider the physics of a trebuchet for example.  The shot moves in a circular arc.  The situation there is quite similar to yours here.
 

杨洋

unread,
Nov 1, 2012, 11:29:39 AM11/1/12
to ode-...@googlegroups.com
I got it.Thanks very much!

2012/11/1 Dimitris Papavasiliou <dpap...@gmail.com>
To view this discussion on the web visit https://groups.google.com/d/msg/ode-users/-/i6EljtULdIQJ.

杨洋

unread,
Nov 2, 2012, 10:51:07 AM11/2/12
to ode-...@googlegroups.com
Sorry for troubling again! It's still about that crane.In my case, I set the acceleration of gravity 0.5 and give the HingeParam with dParamVel and dParamFMax,the crane arm and linked box can goes up. But when I increase the  acceleration of gravity(for exampl 9.8)  and the dParamFMax--even I set it dInfinity,the box does not move at all. Is the mass of the box too big? But when I decrease the mass of box, it moves like a feather. And the  acceleration of gravity will influence the movement of crane?

2012/11/1 Dimitris Papavasiliou <dpap...@gmail.com>
To view this discussion on the web visit https://groups.google.com/d/msg/ode-users/-/i6EljtULdIQJ.

Dimitris Papavasiliou

unread,
Nov 2, 2012, 12:49:43 PM11/2/12
to ode-...@googlegroups.com

Sorry for troubling again! It's still about that crane.In my case, I set the acceleration of gravity 0.5 and give the HingeParam with dParamVel and dParamFMax,the crane arm and linked box can goes up. But when I increase the  acceleration of gravity(for exampl 9.8)  and the dParamFMax--even I set it dInfinity,the box does not move at all. Is the mass of the box too big? But when I decrease the mass of box, it moves like a feather. And the  acceleration of gravity will influence the movement of crane?

Well the acceleration of gravity gets multiplied by the box's mass to give the force exerted on the rope and, through that, the crane so it should influence its movement, yes.  But on the other hand the crane should be able to lift the box given infinite torque.  I assume that since you try 9.8 for gravity all your measurements are in meters and kilograms.  If that's not the case 9.8 might end up to be much larger than 1G of gravity.  What happens when you set gravity to 9.8?  Does everything just remain still?  Do you observe any wobbling of the parts of the crane?  Does it perhaps blow apart?
 

杨洋

unread,
Nov 2, 2012, 9:29:28 PM11/2/12
to ode-...@googlegroups.com
oh,yes! When I set gravity to 9.8,  the crane and rope keep wobbling until the program crash. It seems like the crane "try" to go up but can't. My measurements are just in meters and kilograms.

2012/11/3 Dimitris Papavasiliou <dpap...@gmail.com>
To view this discussion on the web visit https://groups.google.com/d/msg/ode-users/-/Dm1B2HMpMnIJ.

Dimitris Papavasiliou

unread,
Nov 3, 2012, 1:53:38 PM11/3/12
to ode-...@googlegroups.com
Please see my post dated Oct 24th.  As I say there, since making the load lighter solves the problem it's probably one of the two issues I mention there.  I also propose some things to try.  To these I should add:  try making the rope bodies heavier and see if that makes a difference. 

杨洋

unread,
Nov 3, 2012, 9:41:20 PM11/3/12
to ode-...@googlegroups.com
Thanks! I'll have a try.

2012/11/4 Dimitris Papavasiliou <dpap...@gmail.com>
To view this discussion on the web visit https://groups.google.com/d/msg/ode-users/-/J1H_kl9Ie1AJ.
Reply all
Reply to author
Forward
0 new messages