Skip to content

Quaternion of a JointModelFreeFlyer #2199

Closed Answered by jorisv
xiaosuyang asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,

Actually the quaternion in the generalized position vector (q) is stored in [x, y, z, w] order.
The full position vector for the FreeFlyer is [X, Y, Z, QX, QY, QZ, QW] where X, Y, Z is the translation vector and QX, QY, QZ, QW is the quaternion.

You can see it with the following sample code:

import numpy as np
import pinocchio as pin

# Create a model with only a FreeFlyer joint
m = pin.Model()
m.addJoint(0, pin.JointModelFreeFlyer(), pin.SE3.Identity(), "t")
d = m.createData()
# q_vec = [X, Y, Z, QX, QY, QZ, QW]
q_vec = np.array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1])
pin.forwardKinematics(m, d, q_vec)
print("Identity quaterion:", q_vec[3:])
print(d.oMi[-1].rotation)
print()

# We crea…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by jorisv
Comment options

You must be logged in to vote
1 reply
@jcarpent
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants