← All tools

Message & Error Explainer

What an ArduPilot message means and what to do about it

Українська

The dead-reckoning script: flying home without GPS

Act nowFailsafes and emergencies in flightCopter only

What ArduPilot says:

Also explained here: 7 more
  • DR: failed to set attitude target
  • DR: flying home
  • DR: waiting for dist:… need:…
  • DR: NEXT_MODE=-1 but fallingback to RTL
  • DR: GPS and EKF recovered
  • DR: pilot retook control
  • DR: failed to change to mode …

Lines that begin “DR:” come from the Lua script copter-deadreckon-home, not from the firmware. It watches the GPS (satellites under DR_GPS_SAT_MIN, speed accuracy worse than DR_GPS_SACC_MAX) and the EKF failsafe. “DR: waiting for dist” and “DR: enabled” are normal: it is ready once the copter is DR_ENABLE_DIST metres from home. “DR: GPS or EKF bad” is the event: in Auto, Guided, RTL, Circle, Land, Brake or SmartRTL it switches to Guided_NoGPS, levels for 5 s, then leans DR_FLY_ANGLE degrees towards where home was (“DR: flying home”). When GPS and EKF are good for 3 s, or after DR_FLY_TIMEOUT seconds, it switches to DR_NEXT_MODE.

What to do, most likely first

  1. The GPS really became poor: jamming, spoofing, or a blocked view of the sky.

    CheckIn the log, GPS.NSats and GPS.SAcc in the seconds before “DR: GPS or EKF bad”, against DR_GPS_SAT_MIN and DR_GPS_SACC_MAX.

    FixThe script is doing its job: it flies a heading, not a position, so wind carries it off the line home. Take over in AltHold or Stabilize as soon as you see the copter and bring it in by hand (“DR: pilot retook control”).

  2. The thresholds are tighter than this GPS manages on a normal day, so it triggers on good flights.

    CheckLook at GPS.SAcc and GPS.NSats over a whole good flight: the speed accuracy should stay well under DR_GPS_SACC_MAX (0.8 by default) and the satellites above DR_GPS_SAT_MIN (6).

    FixSet the two thresholds with a margin from what your logs show. DR_GPS_TRIGG_SEC is meant to be how long the GPS must stay bad, but in ArduPilot's own copy of the script it is compared with milliseconds, so it acts at once whatever you set.

  3. “DR: failed to change to Guided_NoGPS mode”, “DR: failed to set attitude target” or “DR: failed to change to mode …”: the copter refused what the script asked.

    CheckA “Mode change to … failed: …” line beside it gives ArduPilot's reason. DR_NEXT_MODE 6 (RTL) is refused for as long as there is no position.

    FixThe script keeps trying and stays in Guided_NoGPS meanwhile. Fly it home by hand, and afterwards choose a DR_NEXT_MODE that can start without a position if you expect the GPS not to come back.

The script needs SCR_ENABLE 1 and about 80 kB of script memory (SCR_HEAP_SIZE). DR_FLY_TIMEOUT 0 means it flies on the heading until the battery failsafe or you stop it. The firmware has a dead reckoning of its own (“Dead Reckoning started”), which is another thing.

Parameters to look at

ParameterWhat it is
DR_ENABLEDeadreckoning Enable
DR_ENABLE_DISTDeadreckoning Enable Distance
DR_GPS_SACC_MAXDeadreckoning GPS speed accuracy maximum threshold
DR_GPS_SAT_MINDeadreckoning GPS satellite count min threshold
DR_GPS_TRIGG_SECDeadreckoning GPS check trigger seconds
DR_FLY_ANGLEDeadreckoning Lean Angle
DR_FLY_TIMEOUTDeadreckoning flight timeout
DR_NEXT_MODEDeadreckoning Next Mode
The code that sends it

DR: could not get home or vehicle location

libraries/AP_Scripting/applets/copter-deadreckon-home.lua update() · Open in ArduPilot Copter-4.7.1

DR: enabled

libraries/AP_Scripting/applets/copter-deadreckon-home.lua update() · Open in ArduPilot Copter-4.7.1

DR: failed to change to Guided_NoGPS mode

libraries/AP_Scripting/applets/copter-deadreckon-home.lua update() · Open in ArduPilot Copter-4.7.1

DR: fly home yaw:… pit:… cr:……

libraries/AP_Scripting/applets/copter-deadreckon-home.lua update() · Open in ArduPilot Copter-4.7.1

And 9 more messages, sent from the same places.

Written here for Copter 4.6. In the tool you choose your vehicle and version, see your own parameter values beside the ones named here, and drop a flight log to have every message in it explained.

Open it in the Message & Error Explainer