Skip to main content
Version: 4.0.0

INAV Blackbox Varibles

Overview​

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.

In INAV we use a set of specific variables, each variable may contain multiple arrays, for example - navPos[0-2].

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". 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.

"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.

For further information about the coordinate system used please read the [[Coordinate systems|Coordinate-systems]] page.

#iNav Variables

Variables listed below with a short description of each:

  • navMode (navState in newer code): 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.

  • navFlags: 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.

  • navTgtPos: represents the desired position velocity as used/calculated by iNav. When you are in PH, navTgtPos will be set to hold position coordinates.

  • navPos: array of latest NEU coordinates as provided by inertial estimator. Will be slightly different from GPS/baro readings for 99% of time. Units - cm.

  • navVel: same as navPos, but for estimated velocity. Units - cm/s

  • navTgtVel: 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.

  • navDebug: 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.

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:
set blackbox_device = SPIFLASH # instead of SERIAL
set blackbox_rate_num = 1
set blackbox_rate_denom = 2
This will make it work and store every second value.

iNav Logging Intervals​

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.

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.

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.

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.

Explanation of all the parameters​

Name of field in txt fileName in Blackbox Log ViewerExplanation...
loopIterationnot usedcounter from main loop
time (us)x-axis of diagramreal time in micoseconds
axisRate[0]gyros[roll] (.. deg/s)rotation raterolldeg/sec
axisRate[1]gyros[pitch] (.. deg/s)rotation ratepitchdeg/sec
axisRate[2]gyros[yaw] (.. deg/s)rotation rateyawdeg/sec
axisP[0]PID_P[roll]PID controllerrollP
axisP[1]PID_P[pitch]PID controllerpitchP
axisP[2]PID_P[yaw]PID controlleryawP
axisI[0]PID_I[roll]PID controllerrollI
axisI[1]PID_I[pitch]PID controllerpitchI
axisI[2]PID_I[yaw]PID controlleryawI
axisD[0]PID_D[roll]PID controllerrollD
axisD[1]PID_D[pitch]PID controllerpitchD
axisD[2]PID_D[yaw]PID controlleryawD
mcPosAxisP[0]mcPosAxisP[0]multicopter positionnorthcm
mcPosAxisP[1]mcPosAxisP[1]multicopter positioneastcm
mcPosAxisP[2]mcPosAxisP[2]multicopter positionverticalcm
mcVelAxisP[0]mcVelAxisP[0]multicopter velocitynorthcm/sec
mcVelAxisP[1]mcVelAxisP[1]multicopter velocityeastcm/sec
mcVelAxisP[2]mcVelAxisP[2]multicopter velocityverticalcm/sec
mcVelAxisI[0]mcVelAxisI[0]multicopter velocitynorthcm/sec
mcVelAxisI[1]mcVelAxisI[1]multicopter velocityeastcm/sec
mcVelAxisI[2]mcVelAxisI[2]multicopter velocityverticalcm/sec
mcVelAxisD[0]mcVelAxisD[0]multicopter velocitynorthcm/sec
mcVelAxisD[1]mcVelAxisD[1]multicopter velocityeastcm/sec
mcVelAxisD[2]mcVelAxisD[2]multicopter velocityverticalcm/sec
mcVelAxisOut[0]mcVelAxisOut[0]multicopter velocitynorthcm/sec
mcVelAxisOut[1]mcVelAxisOut[1]multicopter velocityeastcm/sec
mcVelAxisOut[2]mcVelAxisOut[2]multicopter velocityverticalcm/sec
mcSurfacePmcSurfacePmulticopter surface modeP
mcSurfaceImcSurfaceImulticopter surface modeI
mcSurfaceDmcSurfaceDmulticopter surface modeD
mcSurfaceOutmcSurfaceOutmulticopter surface mode
rcData[0]rcData[0]received rc signalroll1000-2000 µs
rcData[1]rcData[1]received rc signalpitch1000-2000 µs
rcData[2]rcData[2]received rc signalyaw1000-2000 µs
rcData[3]rcData[3]received rc signalthrottle1000-2000 µs
rcCommand[0]rcCommand[0]stabilized control commandroll1000-2000 µs
rcCommand[1]rcCommand[1]stabilized control commandpitch1000-2000 µs
rcCommand[2]rcCommand[2]stabilized control commandyaw1000-2000 µs
rcCommand[3]rcCommand[3]stabilized control commandthrottle1000-2000 µs
vbatvbatvoltage of flight batteryV
amperage
magADC[0]magADC[0]compassroll
magADC[1]magADC[1]compasspitch
magADC[2]magADC[2]compassyaw
BaroAlt (cm)BaroAlt (cm)altitude(barometer)cm
gyroADC[0]gyroADC[0]rotation(gyro)rolldeg/sec
gyroADC[1]gyroADC[1]rotation(gyro)pitchdeg/sec
gyroADC[2]gyroADC[2]rotation(gyro)yawdeg/sec
accSmooth[0]acc[x]accelerationnorthfraction of 1g
accSmooth[1]acc[y]accelerationeastfraction of 1g
accSmooth[2]acc[z]accelerationverticalfraction of 1g
attitude[0]attitude[0]headingroll0-3600 deg/10
attitude[1]attitude[1]headingpitch0-3600 deg/10
attitude[2]attitude[2]headingyaw0-3600 deg/10
motor[0]motor[0]output to motor ESC01000-2000 µs
motor[1]motor[1]output to motor ESC11000-2000 µs
motor[2]motor[2]output to motor ESC21000-2000 µs
motor[3]motor[3]output to motor ESC31000-2000 µs
navStatequality of GPS fix
navFlagsquality of GPS fix
navEPHquality of GPS fix
navEPVquality of GPS fix
navPos[0]navPos[0]position of copternorthcm
navPos[1]navPos[1]position of coptereastcm
navPos[2]navPos[2]position of copterverticalcm
navVel[0]navVel[0]velocity of copternorthcm
navVel[1]navVel[1]velocity of coptereastcm
navVel[2]navVel[2]velocity of copterverticalcm
navAcc[0]navAcc[0]velocity of copternorthcm
navAcc[1]navAcc[1]velocity of coptereastcm
navAcc[2]navAcc[2]velocity of copterverticalcm
navTgtVel[0]navTgtVel[0]target value: positionnorthcm
navTgtVel[1]navTgtVel[1]target value: positioneastcm
navTgtVel[2]navTgtVel[2]target value: positionverticalcm
navTgtPos[0]navTgtPos[0]target value: velocitynorthcm
navTgtPos[1]navTgtPos[1]target value: velocityeastcm
navTgtPos[2]navTgtPos[2]target value: velocityverticalcm
navSurf[0]navSurf[0]
flightModeFlags (flags)
stateFlags (flags)
failsafePhase (flags)
rxSignalReceived
rxFlightChannelsValid
hwHealthStatus
powerSupplyImpedance
sagCompensatedVBat
wind[0]
wind[1]
wind[2]
GPS_home[0]longitude
GPS_home[1]lattitude
GPS_fixTypeGPS_fixType
GPS_numSatnumber od sats
GPS_coord[0]longitude
GPS_coord[1]lattitude
GPS_altitudeGPS_altitude
GPS_speedGPS_speed
GPS_ground_courseGPS_ground_course
GPS_hdopquality of GPS fix
GPS_ephquality of GPS fix
GPS_epvquality of GPS fix