forked from Archive/PX4-Autopilot
Tools: Enable offline calibrator to handle less than 3 inertial sensors
This commit is contained in:
parent
4d163eebb9
commit
f86347f1e2
|
@ -50,32 +50,40 @@ data = ulog.data_list
|
|||
|
||||
# extract gyro data
|
||||
sensor_instance = 0
|
||||
num_gyros = 0
|
||||
for d in data:
|
||||
if d.name == 'sensor_gyro':
|
||||
if sensor_instance == 0:
|
||||
sensor_gyro_0 = d.data
|
||||
print('found gyro 0 data')
|
||||
num_gyros = 1
|
||||
if sensor_instance == 1:
|
||||
sensor_gyro_1 = d.data
|
||||
print('found gyro 1 data')
|
||||
num_gyros = 2
|
||||
if sensor_instance == 2:
|
||||
sensor_gyro_2 = d.data
|
||||
print('found gyro 2 data')
|
||||
num_gyros = 3
|
||||
sensor_instance = sensor_instance +1
|
||||
|
||||
# extract accel data
|
||||
sensor_instance = 0
|
||||
num_accels = 0
|
||||
for d in data:
|
||||
if d.name == 'sensor_accel':
|
||||
if sensor_instance == 0:
|
||||
sensor_accel_0 = d.data
|
||||
print('found accel 0 data')
|
||||
num_accels = 1
|
||||
if sensor_instance == 1:
|
||||
sensor_accel_1 = d.data
|
||||
print('found accel 1 data')
|
||||
num_accels = 2
|
||||
if sensor_instance == 2:
|
||||
sensor_accel_2 = d.data
|
||||
print('found accel 2 data')
|
||||
num_accels = 3
|
||||
sensor_instance = sensor_instance +1
|
||||
|
||||
# extract baro data
|
||||
|
@ -124,6 +132,7 @@ gyro_0_params = {
|
|||
}
|
||||
|
||||
# curve fit the data for gyro 0 corrections
|
||||
if num_gyros >= 1:
|
||||
gyro_0_params['TC_G0_ID'] = int(np.median(sensor_gyro_0['device_id']))
|
||||
|
||||
# find the min, max and reference temperature
|
||||
|
@ -219,6 +228,7 @@ gyro_1_params = {
|
|||
}
|
||||
|
||||
# curve fit the data for gyro 1 corrections
|
||||
if num_gyros >= 2:
|
||||
gyro_1_params['TC_G1_ID'] = int(np.median(sensor_gyro_1['device_id']))
|
||||
|
||||
# find the min, max and reference temperature
|
||||
|
@ -314,6 +324,7 @@ gyro_2_params = {
|
|||
}
|
||||
|
||||
# curve fit the data for gyro 2 corrections
|
||||
if num_gyros >= 3:
|
||||
gyro_2_params['TC_G2_ID'] = int(np.median(sensor_gyro_2['device_id']))
|
||||
|
||||
# find the min, max and reference temperature
|
||||
|
@ -409,6 +420,7 @@ accel_0_params = {
|
|||
}
|
||||
|
||||
# curve fit the data for accel 0 corrections
|
||||
if num_accel >= 1:
|
||||
accel_0_params['TC_A0_ID'] = int(np.median(sensor_accel_0['device_id']))
|
||||
|
||||
# find the min, max and reference temperature
|
||||
|
@ -507,6 +519,7 @@ accel_1_params = {
|
|||
}
|
||||
|
||||
# curve fit the data for accel 1 corrections
|
||||
if num_accel >= 2:
|
||||
accel_1_params['TC_A1_ID'] = int(np.median(sensor_accel_1['device_id']))
|
||||
|
||||
# find the min, max and reference temperature
|
||||
|
@ -605,6 +618,7 @@ accel_2_params = {
|
|||
}
|
||||
|
||||
# curve fit the data for accel 2 corrections
|
||||
if num_accels >= 3:
|
||||
accel_2_params['TC_A2_ID'] = int(np.median(sensor_accel_2['device_id']))
|
||||
|
||||
# find the min, max and reference temperature
|
||||
|
|
Loading…
Reference in New Issue