Hi everyone!
I would like write the code to support an alternative IMU (MinIMU-9-Gyro) to work with the ArduPilotMega.
From reading the code I deduced that I have to subclass AP_InertialSensor for gyro and accelerometer. Is that correct?
Where do I control which of the AP_InertialSensor subclasses will actually be used?
Cheers!
Replies
Now back to my original problem. It would be nice if someone could comment on my thoughts and correct me if I'm wrong:
I guess, I have to write a new subclass of AP_InertialSensor (say AP_InertialSensor_MinIMU9). AP_InertialSensor_MinIMU9 will talk to the gyro and accelerometer over I2C. It will return the raw data from the sensors.
I guess there is some kind of I2C abstraction layer? Or do I have to write that myself?
I saw that an AP_InertialSensor_Oilpan is instantiated in the constructor of Board_APM1. So I guess I simply have to change that so that my AP_InertialSensor_MinIMU9 is created there instead.
It seems to be pretty much the same for the compass: I will exchange AP_Compass_HMC5843 against my own subclass of Compass (e.g. AP_Compass_MinIMU9).
Both AP_InertialSensor_MinIMU9 and AP_Compass_MinIMU9 have to use the same I2C.
What other code parts depend on the original AP Imu?