3 Blackbox is a valuable tool for analyzing the flight dynamics of our airborne vehicles and as such it can be useful for troubleshooting and debugging purposes.
5 In INAV we use a set of specific variables, each variable may contain multiple arrays, for example - navPos[0-2].
7 **navPos**, **navVel**, **navTgtPos** and **navTgtVel** each hold arrays [0-2], which represent distances due North [0], due East [1] and straight Up [2], all relative to the "point of origin".
8 North and East are fused from accelerometer and GPS data, while Up is fused from accelerometer + barometer for multicopters and accelerometer + gps for airplanes if no barometer is available. Read the [[Inertial position estimator|Inertial-position-estimator-(INAV)]] page for detailed explanation.
10 "Point of origin" might be different from "Home". "Home" is defined as position at the time of arming. While "Point of origin" is recorded after a valid GPS fix is aquired.
12 For further information about the coordinate system used please read the [[Coordinate systems|Coordinate-systems]] page.
16 Variables listed below with a short description of each:
18 * **navMode** (**navState** in newer code):
19 current mode of operation from INAV's point of view. Might be different from flight mode. Meaning vary by version, but navMode=0 and navState=1 means idle.
22 binary flags of INAV internal state: new data availability for altitude, position and heading, validity of altitude, surface distance and position, flags to indicate if pilot is adjusting altitude and position via rc input.
25 represents the desired position velocity as used/calculated by INAV. When you are in PH, navTgtPos will be set to hold position coordinates.
28 array of latest NEU coordinates as provided by inertial estimator. Will be slightly different from GPS/baro readings for 99% of time. Units - cm.
31 same as navPos, but for estimated velocity. Units - cm/s
34 represents the desired velocity as used/calculated by INAV. When you are in PH, navTgtVel will be set to calculated desired velocity to reach the target position.
37 as the name suggests it is used for debugging. Meaning of these values differ all the time depending on what part of the code is currently being debugged.
39 Blackbox can log data either via serial port or into internal dataflash. In order to log the data into the internal flash at the moment is possible via CLI:
40 set blackbox_device = SPIFLASH # instead of SERIAL
41 set blackbox_rate_num = 1
42 set blackbox_rate_denom = 2
43 This will make it work and store every second value.
45 # INAV Logging Intervals
47 Blackbox logs several types of frames - flight behaviour is written using I- and P-frames. I-frames are fairly big and contain absolute values, P-frames are delta-encoded to save space. Blackbox denominator only reduces P-frame rate, the I-frame rate is constant.
49 Originally I-frames were logged every 32 iterations, P-frame is logged every blackbox_rate_denom after I-frame. This doesn't give you exactly 1 / blackbox_rate_denom rate, i.e. for 1/16 - 1/31 rates it's going to be c. 16 iterations between frames on average.
51 For INAV 1.6 and later, the I-frame interval is set dynamically at 1/32, 1/64, 1/128 and 1/256 based on the blackbox_rate_denom chosen.
53 For example, if a blackbox_rate_denom of 50 is used, INav will select 64 as the I-frame interval, meaning c. 1/32 actual logging rate.
56 ### Explanation of all the parameters
58 | Name of field in txt file | Name in Blackbox Log Viewer | Explanation | . | .. |
59 |:--------------------------: |:----------------------------: |:------------: |:---: |:----------:|
60 | loopIteration | not used | counter from main loop | | |
61 | time (us) | x-axis of diagram | real time in micoseconds | | |
62 | axisRate[0] | gyros[roll] (.. deg/s) | rotation rate | roll | deg/sec |
63 | axisRate[1] | gyros[pitch] (.. deg/s) | rotation rate | pitch | deg/sec |
64 | axisRate[2] | gyros[yaw] (.. deg/s) | rotation rate | yaw | deg/sec |
65 | axisP[0] | PID_P[roll] | PID controller | roll | P |
66 | axisP[1] | PID_P[pitch] | PID controller | pitch | P |
67 | axisP[2] | PID_P[yaw] | PID controller | yaw | P |
68 | axisI[0] | PID_I[roll] | PID controller | roll | I |
69 | axisI[1] | PID_I[pitch] | PID controller | pitch | I |
70 | axisI[2] | PID_I[yaw] | PID controller | yaw | I |
71 | axisD[0] | PID_D[roll] | PID controller | roll | D |
72 | axisD[1] | PID_D[pitch] | PID controller | pitch | D |
73 | axisD[2] | PID_D[yaw] | PID controller | yaw | D |
74 | mcPosAxisP[0] | mcPosAxisP[0] | multicopter position | north | cm |
75 | mcPosAxisP[1] | mcPosAxisP[1] | multicopter position | east | cm |
76 | mcPosAxisP[2] | mcPosAxisP[2] | multicopter position | vertical | cm |
77 | mcVelAxisP[0] | mcVelAxisP[0] | multicopter velocity | north | cm/sec |
78 | mcVelAxisP[1] | mcVelAxisP[1] | multicopter velocity | east | cm/sec |
79 | mcVelAxisP[2] | mcVelAxisP[2] | multicopter velocity | vertical | cm/sec |
80 | mcVelAxisI[0] | mcVelAxisI[0] | multicopter velocity | north | cm/sec |
81 | mcVelAxisI[1] | mcVelAxisI[1] | multicopter velocity | east | cm/sec |
82 | mcVelAxisI[2] | mcVelAxisI[2] | multicopter velocity | vertical | cm/sec |
83 | mcVelAxisD[0] | mcVelAxisD[0] | multicopter velocity | north | cm/sec |
84 | mcVelAxisD[1] | mcVelAxisD[1] | multicopter velocity | east | cm/sec |
85 | mcVelAxisD[2] | mcVelAxisD[2] | multicopter velocity | vertical | cm/sec |
86 | mcVelAxisOut[0] | mcVelAxisOut[0] | multicopter velocity | north | cm/sec |
87 | mcVelAxisOut[1] | mcVelAxisOut[1] | multicopter velocity | east | cm/sec |
88 | mcVelAxisOut[2] | mcVelAxisOut[2] | multicopter velocity | vertical | cm/sec |
89 | mcSurfaceP | mcSurfaceP | multicopter surface mode | | P |
90 | mcSurfaceI | mcSurfaceI | multicopter surface mode | | I |
91 | mcSurfaceD | mcSurfaceD | multicopter surface mode | | D |
92 | mcSurfaceOut | mcSurfaceOut | multicopter surface mode | | |
93 | rcData[0] | rcData[0] | received rc signal | roll | 1000-2000 µs |
94 | rcData[1] | rcData[1] | received rc signal | pitch | 1000-2000 µs |
95 | rcData[2] | rcData[2] | received rc signal | yaw | 1000-2000 µs |
96 | rcData[3] | rcData[3] | received rc signal | throttle | 1000-2000 µs |
97 | rcCommand[0] | rcCommand[0] | stabilized control command | roll | 1000-2000 µs |
98 | rcCommand[1] | rcCommand[1] | stabilized control command | pitch | 1000-2000 µs |
99 | rcCommand[2] | rcCommand[2] | stabilized control command | yaw | 1000-2000 µs |
100 | rcCommand[3] | rcCommand[3] | stabilized control command | throttle | 1000-2000 µs |
101 | vbat | vbat | voltage of flight battery | | V |
103 | magADC[0] | magADC[0] | compass | roll | |
104 | magADC[1] | magADC[1] | compass | pitch | |
105 | magADC[2] | magADC[2] | compass | yaw | |
106 | BaroAlt (cm) | BaroAlt (cm) | altitude(barometer) | | cm |
107 | gyroADC[0] | gyroADC[0] | rotation(gyro) | roll | deg/sec |
108 | gyroADC[1] | gyroADC[1] | rotation(gyro) | pitch | deg/sec |
109 | gyroADC[2] | gyroADC[2] | rotation(gyro) | yaw | deg/sec |
110 | accSmooth[0] | acc[x] | acceleration | north | fraction of 1g |
111 | accSmooth[1] | acc[y] | acceleration | east | fraction of 1g |
112 | accSmooth[2] | acc[z] | acceleration | vertical | fraction of 1g |
113 | attitude[0] | attitude[0] | heading | roll | 0-3600 deg/10 |
114 | attitude[1] | attitude[1] | heading | pitch | 0-3600 deg/10 |
115 | attitude[2] | attitude[2] | heading | yaw | 0-3600 deg/10 |
116 | motor[0] | motor[0] | output to motor ESC | 0 | 1000-2000 µs |
117 | motor[1] | motor[1] | output to motor ESC | 1 | 1000-2000 µs |
118 | motor[2] | motor[2] | output to motor ESC | 2 | 1000-2000 µs |
119 | motor[3] | motor[3] | output to motor ESC | 3 | 1000-2000 µs |
120 | navState | | quality of GPS fix | | |
121 | navFlags | | quality of GPS fix | | |
122 | navEPH | | quality of GPS fix | | |
123 | navEPV | | quality of GPS fix | | |
124 | navPos[0] | navPos[0] | position of copter | north | cm |
125 | navPos[1] | navPos[1] | position of copter | east | cm |
126 | navPos[2] | navPos[2] | position of copter | vertical | cm |
127 | navVel[0] | navVel[0] | velocity of copter | north | cm |
128 | navVel[1] | navVel[1] | velocity of copter | east | cm |
129 | navVel[2] | navVel[2] | velocity of copter | vertical | cm |
130 | navAcc[0] | navAcc[0] | velocity of copter | north | cm |
131 | navAcc[1] | navAcc[1] | velocity of copter | east | cm |
132 | navAcc[2] | navAcc[2] | velocity of copter | vertical | cm |
133 | navTgtVel[0] | navTgtVel[0] | target value: position | north | cm |
134 | navTgtVel[1] | navTgtVel[1] | target value: position | east | cm |
135 | navTgtVel[2] | navTgtVel[2] | target value: position | vertical | cm |
136 | navTgtPos[0] | navTgtPos[0] | target value: velocity | north | cm |
137 | navTgtPos[1] | navTgtPos[1] | target value: velocity | east | cm |
138 | navTgtPos[2] | navTgtPos[2] | target value: velocity | vertical | cm |
139 | navSurf[0] | navSurf[0] | | | |
140 | flightModeFlags (flags) | | | | |
141 | stateFlags (flags) | | | | |
142 | failsafePhase (flags) | | | | |
143 | rxSignalReceived | | | | |
144 | rxFlightChannelsValid | | | | |
145 | hwHealthStatus | | | | |
146 | powerSupplyImpedance | | | | |
147 | sagCompensatedVBat | | | | |
151 | GPS_home[0] | | longitude | | |
152 | GPS_home[1] | | lattitude | | |
153 | GPS_fixType | | GPS_fixType | | |
154 | GPS_numSat | | number od sats | | |
155 | GPS_coord[0] | | longitude | | |
156 | GPS_coord[1] | | lattitude | | |
157 | GPS_altitude | | GPS_altitude | | |
158 | GPS_speed | | GPS_speed | | |
159 | GPS_ground_course | | GPS_ground_course | | |
160 | GPS_hdop | | quality of GPS fix | | |
161 | GPS_eph | | quality of GPS fix | | |
162 | GPS_epv | | quality of GPS fix | | |