Mode "terrain following" with a fixed wing

Good morning,
I work with a pixhawk 4 and a fixed wing and I want to fly close to the ground “20 cm”. I’ve test the altitude mode and it’s work well but the regulation work with the current altitude and not with the distance ground-vehicle. I saw in the doc that the “terrain following” mode is only available with multicopters and VTOL and I would like to know if it’s possible to enable this mode with a fixed wing. If not, how can I implement the altitude mode with the distance ground-vehicle ?

Thank you for your response :slight_smile:

Hi @Mael_Forestal ,

IIRC, terrain following is not available for fixedwing yet. I guess it should probably be implemented here:
You can simply use the dist_bottom field from the vehicle_local_position topic to get the estimate of the distance below the drone (using a range finder or an optical flow sensor).

Good luck!

1 Like

Thank you for your response, I’ve try to add this on the code in the file “FixedwingPositionControl.cpp” (Line 514) :

I’ve also define the variable in the hpp file :

I simulate with Gazebo but don’t see any change. The method “FixedwingPositionControl::update_desired_altitude(float dt)” is call periodically or with an interrupt (changing joystick value) ?

It’s all right ! With this method, the distance ground-vehicle is considered in the altitude setpoint and only when the joystick is centered. Thank you for your time @bresch :slight_smile:

Could you please make a PR such that everyone can benefit from that cool new feature?
Thanks in advance @Mael_Forestal.