Skip to content

Commit

Permalink
Normalize quaternion
Browse files Browse the repository at this point in the history
  • Loading branch information
iory committed Mar 13, 2024
1 parent c2ffee4 commit 4acb21d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rcb4/armh7interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,8 @@ def read_imu_data(self):
cs = self.memory_cstruct(Madgwick, 0)
acc = convert_data(cs.acc, 8)
q_wxyz = np.array([cs.q0, cs.q1, cs.q2, cs.q3], dtype=np.float32)
norm_q = np.sqrt(np.dot(q_wxyz.T, q_wxyz))
q_wxyz = q_wxyz / norm_q
gyro = convert_data(cs.gyro, 2000)
gyro = np.deg2rad(gyro)
return q_wxyz, acc, gyro
Expand Down

0 comments on commit 4acb21d

Please sign in to comment.