Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ulog: series function for axis-angle to quaternion #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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