Suggestions for snappy flippers

I am trying to model something which essentially is a block attached to a revolute joint, which i wish to rotate the block around using the joint's motor. The joint has limits of rotation and basically i'd like to get the rotation being quite snappy. Sadly at the moment even though I've tried adding quite high amounts of max torque to the motor it just feels quite sluggish, rather than snapping.

Basically i'm looking for a 90 degree rotation to occur within say half a second or perhaps less, where as its currently doing so in > 1 second.

One thing i'm spotting already though is that when dynamic objects get hit by this sluggishly rotating block they can often get struck and move away too violently for my liking. This is something that is obviously going to get worse as i get the rotation happening even faster. I just wondered if there was any way of clamping the maximum speed that dynamic objects can travel, either all the time, or just when they're being struck by these rotating blocks.

Your help as ever is appreciated. Cheers

Jim
There is a setting in b2Settings for the max speed of all objects, sounds like you want to lower it.
Also, for your joint, are you setting a high motor speed as well as maxMotorTorque?
I'll have a look at the max velocity.. should be perfect for this.

I am currently using the following with my Revolute joint

maxMotortorque = 16000
motor speed = 500

As you can see it already seems far higher than it should be.

Another thing, I've got limits set on this joint, for example

lowerAngle=-0.18*pi
upperAngle=0.25*pi

and frustratingly though perhaps understandably given the silly torques and speeds being set you can quite often see the joint rotate beyond its limits and then after a frame snap back to being within the limits. Any options to make the joint motor limits more continuous?

Assuming that i can't get the motor doing what i want am i ok to just try and set the angles myself for the joint? I should be able to get the speed and feel that i want then and also shouldn't struggle enforcing the limits either.

Thanks

Jim
Yes, you can set positions without fatally destroying things 😉 . In fact, this kills two birds with one stone for you. As normally you would need to match each SetXForm with a SetAngularVelocity which made sense, or else collisions off the flipper would not react in the right way. But you can set the angular velocity lower than it would ordinarily be, to reduce the strong backlash you were complaining of.
I recall having a similar problem when first rigging up a ragdoll. The joints were very springy. I think the problem was the mass ratios I was using. It's also possible that not running the sim at 60Hz could make it worse.

I just hacked up a quick test of what you're trying to do, and it seems to work fine. A 1.0x1.0, density=1.0, block with a revolute joint to the ground body at one corner and 180 degrees of motion was able to flip from side to side very snappily with a motor speed of 100.0 and a max torque of 1000.0 (those two values won't match, one of them will be limiting, I just chucked them in and it did what I wanted).

What mass is your block, and is your sim running at a constant 60Hz?

EDIT: Actually, I was able to vary the mass, speed and max torque of my little test block through quite a range of values and still get snappy rotation. However, I didn't check the effect of it hitting another dynamic object.
I'm running the simulation at 30fps.

I've been playing with the density, and other values with this problem having not had chance to really look at it since the last post. I've been able to bring them down a little bit to make them more sensible, still seeing lots of problems with the joints.

I still struggle getting very snappy movement but its probably snappy enough. My big problem is that the motor limits just don't seem very hard at all, even with it taking 2-3 seconds to rotate 90 degrees its still fairly easy to see the joint limit being exceeded and then the object gets constrained a frame or two later into the limits, it just looks nasty, like a flickering glitch.

Before it was suggested that i could set the rotation myself, frustratingly i'd like to kind of just set the rotation angle of the revolute joint. I'm guessing this isn't possible at all, there are no members that look like you'd be able to manually override the rotation?

I assume in manually moving it i would want to set it to being dynamic, which means gravity is going to need to be countered on it as well.

Would Box2D object to me setting it as static but still moving it by rotating it, i'm assuming being static its fairly heavily optimised, i'll then move it, at this point is it going to be a lot messier being static than if i'd left it as dynamic the whole time?

Basically has anyone got any experience of having to hack around the revolute joint and roll their own rotational movement.
Did you try SetAngularVelocity() and SetXForm()?

And yes, technically, you can change the position and velocity of static bodies. This will affect the behavior of dynamic bodies that bump into them, although Box2D will never change the position of a static body based on its velocity during a timestep, you'll have to do that yourself.
thanks.

I haven't had chance to try setxform yet.. I guess if i can get the body pos to be where i want the rotation to around then i should just be able to use it set rotation only.

I'll give that a try later.

Cheers

Jim

Original thread: https://box2d.org/forum/viewtopic.php?t=1824