Open varun-un opened 3 weeks ago
This still doesn't really fix the "if one fails they all fail" issue, as the imu itself on init() would need to check if each of its sub-sensors properly init()s. We could write more in-depth code to throw a warning on mag fail, for example, but we could do that when they are all a single class combined as well. I'm not sure the overhead of abstracting out three new classes is worth it, but I guess idk.
Edit: I guess this might be useful if we were to add i2c bus and address parameters into their constructors as #82 suggests
Right now, it's kind of awkward to have multiple sensors combine to be one 9 dof IMU, and it also means that those sensors' operations are tied together (one fails, the entire class fails). An alternate structure is this:
3 classes:
class Accelerometer : public Sensor
class Gyroscope : public Sensor
class Magnetometer : public Sensor
IMU class now takes in an instance of each of these 3 classes as members:
And hardware implementation classes extend >= 1 of the accel, gyro, or mag classes that they provide data for