thecountoftuscany / PyTeapot-Quaternion-Euler-cube-rotation

Visualization of IMU orientation from quaternion or Euler angles with a rotating cube
GNU General Public License v3.0
145 stars 42 forks source link

Euler angles Range #6

Closed veeresh-dammur closed 3 years ago

veeresh-dammur commented 3 years ago

Hi, Thanks for the nice repo. I would like to ask about the Euler angle ranges obtained from MPU9250. Do you get the orientation values between -180 to +180 degrees on each Euler axes (yaw, roll, pitch)?

thecountoftuscany commented 3 years ago

Please refer quat_to_ypr() function in pyteapot.py. Yaw and roll angles are obtained with the math.atan2() function, which returns angles in [-pi, pi]. Pitch is obtained with math.asin(), which returns angles in [-pi/2, pi/2] (refer this page)

thecountoftuscany commented 3 years ago

Also note that, as mentioned in the readme, this repo assumes that orientation data has been calculated already (for example, using this code) and is only concerned with visualizing that orientation. In case your algorithm calculates quaternions, this repo contains a function that converts that to yaw, pitch, roll angles as mentioned in my previous response. In case it provides yaw, pitch, roll angles, the sensor fusion implementation used defines the ranges.

veeresh-dammur commented 3 years ago

Just off the topic of the created issue, Currently, we are using BNO055 in one of our projects. The IMU is placed next to the dc motor due to space constraints within the hardware setup. Due to motors vibrations, we are applying a low pass filter on quaternion values read from this script. We have set 5 Hz as a cut-off frequency of the filter. We have also placed IMU on Sorbothane (damping material) to minimize the vibrations. However, we are still selling the error in the orientation.

What could be done to reduce the impact of motor vibrations on IMU both from a software and hardware point of view? Any inputs are highly appreciated!

thecountoftuscany commented 3 years ago

Apart from what you have already mentioned, I can only think of a few things: