mavlink / MAVSDK-Python

MAVSDK client for Python.
https://mavsdk.mavlink.io
BSD 3-Clause "New" or "Revised" License
291 stars 216 forks source link

`drone.camera.status()` doesn't work | `drone.camera.list_photos(PhotosRange.SINCE_CONNECTION)` always returns an empty list #470

Open medric49 opened 2 years ago

medric49 commented 2 years ago

I tried to run the camera.py example after running

make px4_sitl gazebo_typhoon_h480

and after manually enabling the camera with

camera_trigger start
camera_trigger test

and I receive no status update with this function

async def print_status(drone):
    async for status in drone.camera.status():
        print(status)

I also tested await drone.camera.list_photos(PhotosRange.SINCE_CONNECTION) and I always receive an empty list, even when drone.camera.take_photo seems to work (according to the logs of the simulator shell).

Can someone help me with these issues, please?

I also add that drone.camera.mode() works fine.. I receive updates about the camera mode.

medric49 commented 2 years ago

It seems that for some methods like camera.take_photo() camera.set_mode() or camera.format_storage(), the communication goes well. But for others (particularly for those that return an answer) like camera.status(), camera.capture_info() or camera.list_photos(), there is a problem.

JonasVautherin commented 2 years ago

I don't think that gazebo_typhoon_h480 supports all the camera functionalities. If you try with QGC, probably you will have the same issue, right?

medric49 commented 2 years ago

I see. No, actually QGC streams perfectly the drone camera.

medric49 commented 2 years ago

Did you succeed to get photos with another drone model? Which one please?

JonasVautherin commented 2 years ago

I just don't think that SITL supports that. Video stream works with the typhoon SITL (I use it here), but list_photo for instance is just not supported by SITL in general.

medric49 commented 2 years ago

Okay I see. Finally, since my initial objective was simply to take pictures, regardless of the methods, I switched to this method

cam = cv2.VideoCapture("udpsrc port=5600 ! application/x-rtp, payload=96 ! rtph264depay ! h264parse ! avdec_h264"
             " ! decodebin ! videoconvert ! video/x-raw,format=(string)BGR ! videoconvert! appsink emit-signals=true sync=false max-buffers=2 drop=true", cv2.CAP_GSTREAMER)

inspired by this

sibujacob commented 1 year ago

Okay I see. Finally, since my initial objective was simply to take pictures, regardless of the methods, I switched to this method

cam = cv2.VideoCapture("udpsrc port=5600 ! application/x-rtp, payload=96 ! rtph264depay ! h264parse ! avdec_h264"
             " ! decodebin ! videoconvert ! video/x-raw,format=(string)BGR ! videoconvert! appsink emit-signals=true sync=false max-buffers=2 drop=true", cv2.CAP_GSTREAMER)

inspired by this

Does this work correctly