IMU
Python Library for ST LSM6DS33 IMU.
Turta_IMU library is responsible for reading reading 3D gyro and acceleration data.
Add the following statement to the top of your Python code.
from turta_rcdriverhat import Turta_IMU
Then, create an instance of the IMU class.
imu = Turta_IMU.IMU()
Now you're ready to access the library by calling its instance.
Reads the X-axis acceleration.
read_accel_x()
Parameters
None Returns
Int: X-axis acceleration.
Reads the Y-axis acceleration.
read_accel_y()
Parameters
None Returns
Int: Y-axis acceleration.
Reads the Z-axis acceleration.
read_accel_z()
Parameters
None Returns
Int: Z-axis acceleration.
Reads the accelerations of X, Y and Z-axes.
read_accel_xyz()
Parameters
None Returns
Int[]: Acceleration of X, Y and Z-axes respectively.
Reads the pitch on X-axis.
read_gyro_x_pitch()
Parameters
None Returns
Int: Pitch.
Reads the roll on Y-axis.
read_gyro_y_roll()
Parameters
None Returns
Int: Roll.
Reads the yaw on Z-axis.
read_gyro_z_yaw()
Parameters
None Returns
Int: Yaw.
Reads the pitch, roll and yaw.
read_gyro_xyz()
Parameters
None Returns
Int array: Pitch, roll and yaw values respectively.
Reads the accelerations of X, Y, Z-axes and pitch, roll, yaw values.
read_gyro_accel_xyz()
Parameters
None Returns
Int[]: X accel, Y accel, Z accel, pitch, roll and yaw values respectively.
Reads the temperature of the IMU.
read_temp(fahrenheit)
Parameters
Bool fahrenheit: True for Fahrenheit output, False for Celcius output. (False is default.) Returns
Float: Temperature of IMU.
Sends Who_Am_I command to the IMU, checks if it responses correctly.
config(ch, pga, mode, dr, ts_mode)
Parameters
None Returns
Bool: True if the device responses with 0x69, False if not.
When exiting from the program, the library turns off the IMU and then releases the SPI bus & interrupt pins.
Last modified 3yr ago