A python based application to visualize how various sensor fusion algorithms work. It receives data transmitted by the AndyIMU android application, performs a user specified sensor fusion algorithm, and rotates a 3-D cube to help the user visualize their output.
- Tkinter: For the GUI
pip install tk
- PyOpenGL: For rendering 3D graphics
pip install PyOpenGL PyOpenGL_accelerate
- PyGame: Container for 3D graphics
pip install pygame
Note: The ReferenceCodes folder contains code that implements various functionalities of the application independently.
- Open the file d_sensorFusion.py
- Add a method, for example, fusionAlgo to the class Fusion
- You can obtain the raw data from sensor as a 1x6 array (accelerometer values followed by gyroscope values) or 1x9 array (accelerometer, gyroscope followed by magnetometer) by using the
get()
method ofself.rawData
queue. - The size of array depends whether the android application is transmitting magentometer values or not.
- Before storing the result into final variables, add statement
Rpy.lock.acquire()
to lock the variables to the current thread so that the visualizing section does not read the values. - Store the final result of your algorithm in variables
- Rpy.rotateX: Rotation about X axis
- Rpy.rotateY: Rotation about Y axis
- Rpy.rotateZ: Rotation about Z axis
- End your function using
try:
Rpy.lock.notify()
finally:
Rpy.lock.release()
- Call your function in the
run
method
def fusionAlgo:
raw_values = self.rawData.get()
...
... # algorithm on raw_values
...
Rpy.lock.acquire()
Rpy.rotateX = some_value
Rpy.rotateY = another_value
Rpy.rotateZ = yet_another_value
try:
Rpy.lock.notify()
finally:
Rpy.lock.release()