I have this Myo armband which has a IMU built in, and in python I want to get the roll-pitch-yaw in my desired frame of reference. It works well in the same position with the computer, but if I e.g. move to the opposite side of the table I will get opposite pitch values. I have tried following this guide: http://developerblog.myo.com/quaternions/
#Setting a center with the conjugation of the first set of Quaternions
centre = libmyo.Quaternion(myo.orientation[0], myo.orientation[1], myo.orientation[2], myo.orientation[3]).conjugate()
while True:
obj = libmyo.Quaternion(myo.orientation[0], myo.orientation[1], myo.orientation[2], myo.orientation[3])
#Multiplying the current Rotation with the centre
frame = obj.__mul__(centre).conjugate()
x= frame[0]
y= frame[1]
z= frame[2]
w= frame[3]
roll = math.atan2(2*y*w - 2*x*z, 1 - 2*y*y - 2*z*z)
pitch = math.atan2(2*x*w - 2*y*z, 1 - 2*x*x - 2*z*z)
yaw = math.asin(2*x*y + 2*z*w)
print(roll, pitch, yaw)
time.sleep(0.2)
Thanks in advance