Follow Mode

When in Follow mode, the vehicle will attempt to follow another vehicle (or anything publishing its position) at a specified offset.

The lead vehicle’s position must be published to the vehicle in Follow mode using a telemetry system. Telemetry radios which support mesh networking (e.g. DroneBridge ESP32) are recommended. See Mult-Vehicle Flying for more details.

Although Follow mode can use standard GLOBAL_POSITION_INT MAVLink messages from the lead vehicle, it generally works better if the lead vehicle publishes a FOLLOW_TARGET MAVLink message. This can be done by running the follow-target-send.lua Lua script on the lead vehicle.

The following parameters can be used to tune Follow mode’s performance:

  • FOLL_ENABLE: set to 1 to enable follow mode and refresh parameters

  • FOLL_SYSID: MAVLink system id of lead vehicle (“0” means follow the first vehicle “seen”)

  • FOLL_DIST_MAX: if lead vehicle is more than this many meters away, give up on following and hold position

  • FOLL_OFS_X, FOLL_OFS_Y, FOLL_OFS_Z: 3D offset (in meters) from the lead vehicle

  • FOLL_OFS_TYPE: set to 0 if offsets are North-East-Down, 1 if offsets are relative to lead vehicle’s heading

  • FOLL_YAW_BEHAVE: controls whether follow points in the same direction as lead vehicle or always towards it

  • FOLL_POS_P: gain which controls how aggressively this vehicle moves towards lead vehicle (limited by WP_SPD)

  • FOLL_ALT_TYPE: allows selecting whether to use lead vehicle’s relative-to-home or relative-to-sea-level altitude

  • FOLL_OPTIONS: set bit 0 to “1” to enable the Gimbal / Mount Controls to follow the target vehicle.

  • FOLL_ACCEL_NE, FOLL_JERK_NE: Acceleration and jerk limits applied to the lead vehicle’s estimated horizontal position, velocity and acceleration

  • FOLL_ACCEL_D, FOLL_JERK_D: Acceleration and jerk limits applied to the lead vehicle’s estimated vertical position, velocity and acceleration

  • FOLL_ACCEL_H, FOLL_JERK_H: Acceleration and jerk limits applied to the lead vehicle’s estimated heading and yaw rotation rate

  • FOLL_TIMEOUT: Timeout in seconds. If no messages are received from the lead vehicle within this many seconds, the follower will give up and hold position

  • WP_SPD, WP_SPD_UP, WP_SPD_DN, WP_ACC, WP_ACC_Z: horizontal and vertical speed and acceleration limits for the following vehicle

Choosing the Altitude Type

FOLL_ALT_TYPE selects which altitude field from the lead vehicle is used as the follow target, and getting it wrong is a common cause of the follower sitting at an unexpected height.

  • “1” (relative, the default on Copter) uses the lead vehicle’s altitude above its own home. Choose this if both vehicles take off from places whose home altitudes are physically the same, and the EKF altitude source is the default barometer (i.e. EK3_SRCx_POSZ = Baro). Because both vehicles then measure height from the same physical datum, barometric drift and GPS altitude error largely cancel out and the follower holds the commanded offset accurately.

  • “0” (absolute) uses the lead vehicle’s altitude above mean sea level. Choose this in any other situation, in particular when the vehicles take off from different elevations, or when either vehicle uses a non-barometric altitude source. Note that absolute altitude carries the full error of each vehicle’s own altitude estimate, so a constant vertical offset between the vehicles is normal.

  • “3” (terrain) converts the lead vehicle’s altitude to a height above terrain, so the follower matches the lead vehicle’s clearance above ground rather than its altitude. This requires terrain data (see Terrain Following) to be available for the lead vehicle’s position. If it is not, the target update is discarded and the follower will stop tracking, so only use this option where terrain data is known to be loaded.

Note

The lead vehicle’s home altitude is not transmitted, so ArduPilot cannot detect a mismatch between the two vehicles’ home altitudes. If the follower consistently flies too high or too low by roughly the difference in take-off elevations, “relative” is the wrong choice for that setup.