Enabling RTL during the flight

I want to build the agriculture drone using Pixhawk 2.1, I want the drone to Return to its take-off point after liquid from the tank is finished. Can someone help me with what kind of sensor to be used to detect the water level in the tank and automatically go into RTL mode after the water is finished.