Open shubhagrawal30 opened 5 months ago
Glad we have a code-change issue for this. For docs, I have been working on writing up some docs for this process, with a simple simulated example to help explain it. We should have something like this for each sensor, so if we take this as an example, I have folders ready for the other sensors.
https://github.com/tim-balloon/TIM-software-primer/blob/main/sensor_calibration/magnetometer/mag.md
Overview
This is an attempt to finalize a well-documented procedure for calibrating the magnetometer, detailing needs and insights discovered from testing at the UA MIL. It exists as a GitHub Issue as we need to make sure that our sensors, pointing, and commanding code are compliant with our nominal procedure. Some of the information listed in this issue is speculative and based on our best guess of what the current BLAST flight code is attempting to do.
Current
mcp
behaviorWe use a three-axis (say, Z towards the pivot, X "towards" boresight) magnetometer that measures fields from -2 to 2 G, mounted on the outer frame's static sunshield. During the flight, the two dominant sources the magnetometer is sensitive to are the gondola and the Earth.
Calibration on the ground, close to flight at LDB, seems to involve rotating the gondola through full rotations, and extracting the constant offset in X, Y, and Z components of the gondola (say B_x, B_y, B_z), as well as the "amplitude" of the Earth's magnetic field (say, A_x, ...). These are
#DEFINE#
s inmagnetometer.h
for Z or command-able fields for X & Y.In
pointing.c:MagConvert
, the WMM is used to figure out the "declination" and the "dip" of the magnetic field given our known lat, long, and altitude. To get azimuth, we compare this declination to the angle of the XY vector formed by linearly scaled versions of the magnetometer readings. We subtract the offset B and then divide by the slope A.Suggested changes and questions
atan2
is similar precise over its domain, andA_x
andA_y
should be the same value, unless the pivot axis precesses by a lot. remove scaling bymagx_m
and like inpointing.c
*.A_*, B_*
directly. Rather, we set the maximum and minimum of the curves we obtain on the ground when performing the calibration operation, and the code calculatesA_*, B_*
. This makesA_*, B_*
related and toughens removing the scaling. make the gondola field offset the command-able term.Acceptance
A coherent procedure that several of us agree is the right thing to do pre-flight, corresponding code changes code in
magnetometer.
andpointing.
, and changes to command-able fields to ensure the sufficient flexibility during operations.