ardupilot
ardupilot copied to clipboard
AP_InternalSensor: fix imu temprature
This is a proposed solution for this issue
adding is_internal_imu to know if imu is internal or not. _min_internal_imu_index is initialized with max instance and later is updated by least index of an internal imu.
@IamPete1 kindly advise
Looks like a valid fix, I was hoping to do a bit more of a structural re-work.
sure... but at least this solves the issue.
@IamPete1 Kindly advise what changes are requires to pass this fix. I still see that if it fix the issue then it is better than the current status.
@khancyr based on what I understand from the code function _publish_temperature is called from each IMU driver. so drivers that have no temperature sensors should not call it. And the implemented logic in this function is to take the least -non-external- imu index as a temperature reference.
For example the Cube has three IMUS, each has a temperature sensor so will call _publish_temperature However only the first two IMUS are mounted near the heater, the third IMU is mounted somewhere else. For example:

@IamPete1 @khancyr Thank you for describing this issue.
I updated the proposed solution to do the following: if you give value to INS_DEFAULT_TEMP_INSTANCES then it will be the only temprature source. this will solve similar issues as the one you described. if you leave things as is it will use the least index of non-extrrnal imus.
INS_DEFAULT_TEMP_INSTANCES will allow the designer to select the most suitable sensor for controlling the heater.
@IamPete1 Kindly advise
Ping @IamPete1 - question asked on this one.
Looks like we might still have issues.