Recommendations raspberry - pixhawk

Hi!

I am trying to make an autonomous quadcopter that could avoid obstables using computer vision. I am using a raspberry pi 5 with the pixhawk and mavproxy. My idea is to use a RGB camera ( I can´t afford a stereo one) to process the obstacle and send commands to the UAV to avoid it. I want to use ROS2 to make it (take the image, aply the algorithm, calculate deph and then send a MAVlink message to the autopilot), but I dont know if there is another way to make this easier. I only want to make it in a straigh line and use an ultrasonic to measure the distance with the floor.

Someone knows another way to make this instead of using ROS2?
Thank you!