Skip to content

Commit

Permalink
Merge pull request #50 from 708yamaguchi/acc-multiple-g
Browse files Browse the repository at this point in the history
Fix MPU9250 acceleration measurement range
  • Loading branch information
iory authored Mar 14, 2024
2 parents a94e8f4 + d774add commit afaec28
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rcb4/armh7interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,10 @@ def read_rpy(self):

def read_imu_data(self):
cs = self.memory_cstruct(Madgwick, 0)
# MPU9250 acceleration measurement range is +-8g
acc = convert_data(cs.acc, 8)
g = 9.81
acc = acc * g
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
Expand Down

0 comments on commit afaec28

Please sign in to comment.