How to use the sitl gazebo camera with MAVSDK?

Hello,
I have the SITL environment running with Gazebo, using the command $ make px4_sitl gazebo_typhoon_h480

The model runs fine, and the camera is working and I can access it via QGC.
I now want to use Python to do some computer-vision / image-processing using this camera feed.

How can I get the frames / images captured by this camera using MAVSDK?
Is there something like drone.camera.imread() that returns a frame every time it’s called?

Please help!

Thank you.

Hi,

MAVSDK only communicates over MAVLink with the drone. For the video stream you should be able to get the frames directly over UDP on port 5600. We are usually using gstreamer but I think any Python video library could work.

@Jaeyoung-Lim do you have a recommendation how to grab video frames in Python?

See: https://dev.px4.io/master/en/simulation/gazebo.html#simulated-survey-camera

I believe this was answered in How to use the SITL gazebo camera without ROS? ?

Yes… I asked the same question on two different topics. Sorry for spamming.
Thanks for the answers.

1 Like