Failing to make the camera work in px4_sitl / typhoon_h480

Hi,

I am trying to make the camera work in PHOTO mode and I am always getting a timeout - I just started using PX4 / MAVSDK, so I am sorry if my issue is actually really obvious. I am using typhoon_h480

make px4_sitl gazebo-classic_typhoon_h480

and then I am trying to run the following code in ipython

from mavsdk import System
from mavsdk.camera import Mode
import mavsdk


drone = System()
await drone.connect()
await drone.action.arm()
await drone.action.takeoff()
await drone.gimbal.take_control(mavsdk.gimbal.ControlMode.PRIMARY)
await drone.gimbal.set_mode(mavsdk.gimbal.GimbalMode.YAW_LOCK)
await drone.gimbal.set_pitch_and_yaw(-90, 0)
await drone.camera.set_mode(Mode.PHOTO)

The result is

CameraError                               Traceback (most recent call last)
Cell In[2], line 1
----> 1 await drone.camera.set_mode(Mode.PHOTO)

File ~/.local/lib/python3.10/site-packages/mavsdk/camera.py:2067, in Camera.set_mode(self, mode)
   2064 result = self._extract_result(response)
   2066 if result.result != CameraResult.Result.SUCCESS:
-> 2067     raise CameraError(result, "set_mode()", mode)

CameraError: TIMEOUT: 'Timeout'; origin: set_mode(); params: (<Mode.PHOTO: 1>,)

and if I check mavsdk_server I see

[04:06:04|Warn ] Received ack for not-existing command: 530! Ignoring... (mavlink_command_sender.cpp:283)
[04:06:05|Warn ] sending again after 0.501531 s, retries to do: 3  (530). (mavlink_command_sender.cpp:312)
[04:06:05|Warn ] Received ack for not-existing command: 530! Ignoring... (mavlink_command_sender.cpp:283)
[04:06:05|Warn ] sending again after 1.00608 s, retries to do: 2  (530). (mavlink_command_sender.cpp:312)
[04:06:05|Warn ] Received ack for not-existing command: 530! Ignoring... (mavlink_command_sender.cpp:283)
[04:06:06|Warn ] sending again after 1.51063 s, retries to do: 1  (530). (mavlink_command_sender.cpp:312)
[04:06:06|Warn ] Received ack for not-existing command: 530! Ignoring... (mavlink_command_sender.cpp:283)
[04:06:06|Error] Retrying failed (530) (mavlink_command_sender.cpp:339)

Regards,
Cristi

from the developer guide it seems like a internal issue

I am using gazebo classic, so I am actually starting typhoon_h480 ( Gazebo Classic Vehicles | PX4 Guide (main) ) and that model does work with QGroundControl ( both video and photo ), but if I try the code I added in the original post, I get the TIMEOUT error.

I think I kind of found out what is happening. The video is just broadcasted on UPD port 5600 and you can use OpenCV to save it ( How to use the SITL gazebo camera without ROS? - PX4 Autopilot - Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink ), but it’s not actually available through MAVSDK.

Did you get it to work? I’m using the same setup and facing the same issue.