Shape angular position and velocity

Typically: "How do I... ", "How can I... " questions
Post Reply
neshom
Posts: 71
Joined: 21 Jul 2015, 20:55

Shape angular position and velocity

Post by neshom » 10 Apr 2019, 03:41

I am developing a segway-like robot and need to obtain the angualr position of velocity of the body. I realized that different approaches have been suggested in the forums and I wanted to get your recommendation.

Do you recommend using getObjectOrientation() to get absolute angles of a shape and then differentiate it over time step to get angular velocity? Or you suggest an alternative approach?

Thanks

coppelia
Site Admin
Posts: 7157
Joined: 14 Dec 2012, 00:25

Re: Shape angular position and velocity

Post by coppelia » 11 Apr 2019, 12:51

Hello,

best would be to extract for each simulation step a rotation vector and a rotation velocity.
You can do this my getting the object's matrix in each simulation step (sim.getObjectMatrix), then finding the rotation axis and angle with sim.getRotationMatrix and differentiating the angle.

Cheers

Post Reply