Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions px4tools/ulog.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,21 @@ def series_quatrot(x, y, z, q0, q1, q2, q3, rot_name):
def series_quatrot_inverse(x, y, z, q0, q1, q2, q3, rot_name):
return series_quatrot(x, y, z, q0, -q1, -q2, -q3, rot_name)

def series_axangle2quat(x, y, z, yaw, msg_name):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing unit test.

'''
Given pandas series x-z and yaw
return quaternion
'''
vec = np.array([
quat.axangle2quat([xi, yi, zi], yawi)
for xi,yi,zi,yawi in zip(x,y,z,yaw)
])
q0 = pd.Series(name=msg_name, data=vec[:,0],index=yaw.index)
q1 = pd.Series(name=msg_name, data=vec[:,1],index=yaw.index)
q2 = pd.Series(name=msg_name, data=vec[:,2],index=yaw.index)
q3 = pd.Series(name=msg_name, data=vec[:,3],index=yaw.index)
return q0, q1, q2, q3

def series_quat2euler(q0, q1, q2, q3, msg_name):
"""
Given pandas series q0-q4, compute series roll, pitch, yaw
Expand Down