Follow Mode¶
When switched into Follow, the vehicle will attempt to follow another vehicle (or anything publishing its position) at a specified offset. The vehicle lead vehicle’s position must be published to the vehicle in Follow mode using a telemetry system.
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 altitude is maintained with the altitude hold controller so the vehicle will attempt to hold its current altitude when the sticks are placed with 10% of mid-throttle. It will climb or descend at up to 2.5m/s (this speed is adjustable with the PILOT_SPD_UP and PILOT_SPD_DN parameters). The acceleration used to establish these speeds is set by PILOT_ACC_Z.
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.
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.