px4 包含校准和补偿速率陀螺仪、加速度计和气压传感器的功能, 以纠正传感器温度对传感器偏差的影响。
After thermal calibration the thermal calibration parameters (
TC_*) are used for all calibration/compensation of the respective sensors. Any subsequent standard calibration will therefore update
TC_*parameters and not the "normal"
SYS_CAL_*calibration parameters (and in some cases these parameters may be reset).
At time of writing (PX4 v1.11) thermal calibration of the magnetometer is not yet supported.
The calibration procedures described in the following sections are ideally run in an environment chamber (a temperature and humidity controlled environment) as the board is heated from the lowest to the highest operating/calibration temperature. Before starting the calibration, the board is first cold soaked (cooled to the minimum temperature and allowed to reach equilibrium).
For the cold soak you can use a regular home freezer to achieve -20C, and commercial freezers can achieve of the order of -40C. The board should be placed in a ziplock/anti-static bag containing a silica packet, with a power lead coming out through a sealed hole. After the cold soak the bag can be moved to the test environment and the test continued in the same bag.
The bag/silica is to prevent condensation from forming on the board.
It possible to perform the calibration without a commercial-grade environment chamber. A simple environment container can be created using a styrofoam box with a very small internal volume of air. This allows the autopilot to self-heat the air relatively quickly (be sure that the box has a small hole to equalize to ambient room pressure, but still be able to heat up inside).
Using this sort of setup it is possible to heat a board to ~70C. Anecdotal evidence suggests that many common boards can be heated to this temperature without adverse side effects. If in doubt, check the safe operating range with your manufacturer.
To check the status of the onboard thermal calibration use the MAVlink console (or NuttX console) to check the reported internal temp from the sensor.
PX4 supports two calibration procedures:
The offboard approach is more complex and slower, but requires less knowledge of the test setup and is easier to validate.
Onboard calibration is run entirely on the device. It require knowledge of the amount of temperature rise that is achievable with the test setup.
To perform and onboard calibration:
SYS_CAL _ *参数设置为 1，以便在下次启动时启用所需传感器的校准。 1
- 将 SYS_CAL_TDEL 参数设置为板载校准器完成所需的温升度数。 如果此参数太小，则校准将提前完成，并且校准的温度范围将不足以在电路板完全预热时进行补偿。 如果此参数设置得太大，则板载校准器将永远不会完成。 在设置此参数时，应考虑到电路板自加热导致的温度升高。 如果传感器的温升量未知，则应使用板外校准方法。
- 将 SYS_CAL_TMIN 参数设置为您希望校准器发挥作用的最低温度数据。 更低的冷却温度能够用于减少冷却时间，同时保持对校准最低温度的控制。 如果校准器温度低于此参数设置的值，则不会使用传感器的数据。
- 将 SYS_CAL_TMAX 参数设置为校准器起作用的最高起始传感器温度。 如果起始温度高于此参数设置的值，校准将退出并报告错误。 注意，如果不同传感器测量的温度的差异超过
SYS_CAL_TDEL参数指定的温升。 校准期间，完成百分比将打印到系统控制台。 3
commander calibrate accel指令或通过 QGroundControl ，执行6点加速度校准。 如果首次设置电路板，则还需要执行陀螺仪和磁力计校准。
Offboard calibration is run on a development computer using data collected during the calibration test. This method provides a way to visually check the quality of data and curve fit.
To perform an offboard calibration:
- Power up the board and set the TC_A_ENABLE, TC_B_ENABLE and TC_G_ENABLE parameters to
- 将所有 CAL_GYRO * 和 CAL_ACC * 参数设置为默认值。
- Set the SDLOG_MODE parameter to 2 to enable logging of data from boot.
- Set the SDLOG_PROFILE checkbox for thermal calibration (bit 2) to log the raw sensor data required for calibration.
- Cold soak the board to the minimum temperature it will be required to operate in.
- Apply power and keeping the board still 2, warm it slowly to the maximum required operating temperature. 3
- Remove power and extract the .ulog file.
Open a terminal window in the Firmware/Tools directory and run the python calibration script script file:
sh python process_sensor_caldata.py <full path name to .ulog file> This will generate a
.pdf file showing the measured data and curve fits for each sensor, and a .params file containing the calibration parameters.
- Power the board, connect QGroundControl and load the parameter from the generated .params file onto the board using QGroundControl. Due to the number of parameters, loading them may take some time.
- After parameters have finished loading, set
SDLOG_MODEto 1 to re-enable normal logging and remove power.
- Power the board and perform a normal accelerometer sensor calibration using QGroundControl. It is important that this step is performed when board is within the calibration temperature range. The board must be repowered after this step before flying as the sudden offset changes can upset the navigation estimator and some parameters are not loaded by the algorithms that use them until the next startup.
Calibration refers to the process of measuring the change in sensor value across a range of internal temperatures, and performing a polynomial fit on the data to calculate a set of coefficients (stored as parameters) that can be used to correct the sensor data. Compensation refers to the process of using the internal temperature to calculate an offset that is subtracted from the sensor reading to correct for changing offset with temperature
The inertial rate gyro and accelerometer sensor offsets are calculated using a 3rd order polynomial, whereas the barometric pressure sensor offset is calculated using a 5th order polynomial. Example fits are show below:
With the existing parameter system implementation we are limited to storing each value in the struct as a separate entry. To work around this limitation the following logical naming convention is used for the thermal compensation parameters:
instance：是一个整数 0、1或2 ，允许至多校准三个相同
X3* (temperature - reference temperature)**3。
axis：是一个整数0，1或2，指示校准数据为飞控板参照系的 X，Y 或 Z 轴。 对于气压传感器，省略
The correction for thermal offsets (using the calibration parameters) is performed in the sensors module. The reference temperature is subtracted from the measured temperature to obtain a delta temperature where:
delta = measured_temperature - reference_temperature
The delta temperature is then used to calculate a offset, where:
offset = X0 + X1*delta + X2*delta**2 + ... + Xn*delta**n
The offset and temperature scale factor are then used to correct the sensor measurement where:
corrected_measurement = (raw_measurement - offset) * scale_factor
If the temperature is above the test range set by the
*_TMAX parameters, then the measured temperature will be clipped to remain within the limits.
The legacy temperature-agnostic PX4 rate gyro and accelerometer sensor calibration is performed by the commander module and involves adjusting offset, and in the case of accelerometer calibration, scale factor calibration parameters. The offset and scale factor parameters are applied within the driver for each sensor. These parameters are found in the CAL parameter group.
Onboard temperature calibration is controlled by the events module and the corrections are applied within the sensors module before the sensor combined uORB topic is published. This means that if thermal compensation is being used, all of the corresponding legacy offset and scale factor parameters must be set to defaults of zero and unity before a thermal calibration is performed. If an on-board temperature calibration is performed, this will be done automatically, however if an offboard calibration is being performed it is important that the legacy
CAL*SCALE parameters be reset before calibration data is logged.
If gyro thermal compensation has been enabled by setting the
TC_G_ENABLE parameter to 1, then the commander controlled gyro calibration can still be performed, however it will be used to shift the compensation curve up or down by the amount required to zero the angular rate offset. It achieves this by adjusting the X0 coefficients.
If accel thermal compensation has been enabled by setting the
TC_A_ENABLE parameter to 1, then the commander controlled 6-point accel calibration can still be performed, however instead of adjusting the
*SCALE parameters in the
CAL parameter group, these parameters are set to defaults and the thermal compensation
SCL parameters are adjusted instead.
Scale factors are assumed to be temperature invariant due to the difficulty associated with measuring these at different temperatures. This limits the usefulness of the accelerometer calibration to those sensor models with stable scale factors. In theory with a thermal chamber or IMU heater capable of controlling IMU internal temperature to within a degree, it would be possible to perform a series of 6 sided accelerometer calibrations and correct the accelerometers for both offset and scale factor. Due to the complexity of integrating the required board movement with the calibration algorithm, this capability has not been included.
1. 当校准开始时，SYS_CAL_Accel、SYS_CAL_Baro 和 SYS_CAL_GYRO 参数重置为 0。 ↩
2. 气压传感器偏置的校准需要一个稳定的气压环境。 由于天气的原因，空气压力变化缓慢，建筑物内部的气压会因室外风的波动和暖通空调系统的运行而迅速变化。 ↩