Hi,
I was wondering if there was any way if I could set the target position of a given joint (revolute for example) by quaternions?
Thanks.
Joint position setting via quaternions
Re: Joint position setting via quaternions
Hello,
if your joint is a spherical joint, then you can use sim.setObjectChildPose(jointHandle,pose), where pose={x,y,z,qx,qy,qz,qw} and the position component of the pose is ignored.
If your joint is revolute or prismatic, you'll have to use sim.setJointPosition(jointHandle,v) instead, where v is either the angle in radians, or the displacement in meters.
Above works for static joints. If you have a dynamic joint in position control mode, you'll have to use sim.setJointTargetPosition for revolute and prismatic joints instead. A dynamic, spherical joint can only be in passive mode and can't directly be actuated. In that case, you should either construct your joint out of 3 revolute joints (using auxiliary shapes in-between if not using the MuJoCo engine), or you can directly apply a torque to the attached shape via sim.addForceAndTorque.
Cheers
if your joint is a spherical joint, then you can use sim.setObjectChildPose(jointHandle,pose), where pose={x,y,z,qx,qy,qz,qw} and the position component of the pose is ignored.
If your joint is revolute or prismatic, you'll have to use sim.setJointPosition(jointHandle,v) instead, where v is either the angle in radians, or the displacement in meters.
Above works for static joints. If you have a dynamic joint in position control mode, you'll have to use sim.setJointTargetPosition for revolute and prismatic joints instead. A dynamic, spherical joint can only be in passive mode and can't directly be actuated. In that case, you should either construct your joint out of 3 revolute joints (using auxiliary shapes in-between if not using the MuJoCo engine), or you can directly apply a torque to the attached shape via sim.addForceAndTorque.
Cheers
-
- Posts: 22
- Joined: 31 Jul 2022, 19:48
Re: Joint position setting via quaternions
Yes thank you, just to specify my problem. I have a spherical joint which is made up from 3 dynamically enabled revolute joints in position control mode with auxilary shapes between them and I was wondering if there was any way I could set their positions with the use of quaternions and the sim.SetJointTargetPosition , without having to convert them to Euler angles.
Re: Joint position setting via quaternions
Then have a look at the demo scene scenes/eulerAngles.ttt and this page related to Euler angles, matrices and quaternions, and sim.buildPose.
Cheers
Cheers