IMU Interface - Terrapin-Rocket-Team/SRAD-Avionics GitHub Wiki
Home/Documentation/IMU Interface
The IMU Interface (IMU.h
)
This interface extends the Sensor
interface and is used to define the functions that all IMU sensors must implement. This includes functions to get the acceleration, orientation, and magnetometer readings from the sensor. The IMU
class is responsible for parsing the module's data into local variables. The State
class then reads these variables to get the data.
Note: The getDataString()
and getStaticDataString()
functions are expected to return heap-allocated char*
s. This is because the State
class is responsible for freeing the memory after the data is used. getCsvHeader()
is expected to return a char[]
as a string literal (i.e. Don't delete[]
it).
Rather than list out all the functions here, I will refer you to the header file for the IMU
class. This prevents outdated documentation. The functions are documented in the header file.
Some important ideas to note:
- The
IMU
interface overrides thegetType()
andgetTypeString()
functions itself rather than leaving it to the fully derived implementation. This just makes it a bit easier to use. - The
IMU
class has a dependency on Adafruit'slibrary for vector math and storage. This is used to store position and velocity vectors. The library is included in the project, so you shouldn't need to worry about it.imumaths
-
Sensor.h
- The Sensor interface. -
- The Adafruit library used for vector math and storage.imumaths
-
State.h
- The State estimation system.
An Inertial Measurement Unit (IMU) is a sensor that measures the acceleration and orientation of an object. It is used to determine the orientation of the object in space. Our current IMU is the BNO055
, which is a 9-DOF (Degrees of Freedom) sensor that includes an accelerometer, gyroscope, and magnetometer. It is capable of fusing the data from these sensors to provide a more accurate orientation estimate than any one sensor could provide on its own. It may be interchangeably referred to as an accelerometer, gyroscope, or magnetometer, depending on the context.