RPi send sensor distance for collision avoidance

I’m trying to send the distance from a custom sensor to a PX4 using a Raspberry. I have a lot of other code on the raspberry so it seem to be the best way.
But I can’t find any working system for that. I try to send OBSTACLE_DISTANCE message but Python tell me this is not implemented in mavutil. 'I tried to use master.obstacle_distance_send()). Is it another mavutil function for that?
Or anything in C?
If not should I build my own package and send them on the GPIO by manually setting the CRC2 etc?