pymunk icon indicating copy to clipboard operation
pymunk copied to clipboard

Reading Force and Torque

Open hai-h-nguyen opened this issue 1 year ago • 2 comments

Hi,

I am trying to read out the force (Fx, Fy) and the torque (Mx, My) when inserting a square peg into a hole. The idea is to insert the peg into the hole using the force and torque feedback. The peg is controlled by setting the velocity along the X and Y axes.

When I print out peg.torque while I manually control the peg (randomly driving it using a keyboard left/right), the torque is always 0, which seems wrong. Can you explain what I should do in this case?

Also, getting the force when the peg moves left/right and collides with the ground and the hole seems complicated. The property force, according to the documentation, is not the total force applied to the body (unlike the torque). Do you have any pointers for me?

Thank you!

hai-h-nguyen avatar May 12 '23 06:05 hai-h-nguyen

A basic question to start, how do you move the peg? Just settings its position, which is sort of like teleporting in the real world (if was possible), or something else?

I also wonder if you looked at arbiter.total_impulse and/or arbiter.total_ke instead?

viblo avatar May 12 '23 20:05 viblo

Hi, thanks for replying. Currently, we directly set the force vector of the peg body to make it move based on the input vx vy. I can look into that, can you give a high-level idea of how they can help?

hai-h-nguyen avatar May 12 '23 20:05 hai-h-nguyen