Home        Store        Docs        Blog

Pulling Camera Info through Pymavlink

Hey all,
I’ve been trying over the last few days to pull camera info from the BlueROV2 using pymavlink - specifically I’m after the camera tilt. The closest I “think” I’ve come to a solution is the following:

connection.mav.command_long_send(
    connection.target_system,
    connection.target_component,
    mavutil.mavlink.MAV_CMD_REQUEST_MESSAGE,
    0,
    179, 0, 0, 0, 0, 0, 0
)

Where the 179 has been pulled from this list of MAVLink message IDs, and corresponds to the CAMERA_STATUS message.

Unfortunately, while the BlueROV2 does send an ACK back
COMMAND_ACK {command : 512, result : 3}
I never receive a message about the camera status. I know that the camera works because I can see through it on QGroundControl and have an additional Python program connecting to it for some machine vision stuff.

I’ve spent some time rolling through the forums and searching for an answer, but I can’t find any more than the above - can anyone help?

Thanks!

Hi David,

You can grab the camera tilt information from SERVO_OUTPUT_RAW or MOUNT_STATUS.

HI Patrick,

Thanks for the quick response!

Unfortunately SERVO_OUTPUT_RAW doesn’t seem to provide a changing value for the camera (8th servo here), but one of the other regular packets - NAMED_VALUE_FLOAT - has a CamTilt value which seems to do the trick! It’s a value between 0 and 1 which we can use to calculate the angle of the camera between +/- 45°

I’ll just dump some of our output:

NAMED_VALUE_FLOAT {time_boot_ms : 869128, name : CamTilt, value : 0.30000001192092896}
NAMED_VALUE_FLOAT {time_boot_ms : 869128, name : CamPan, value : 0.5}
NAMED_VALUE_FLOAT {time_boot_ms : 869128, name : TetherTrn, value : 0.0}
NAMED_VALUE_FLOAT {time_boot_ms : 869128, name : Lights1, value : 0.0}
NAMED_VALUE_FLOAT {time_boot_ms : 869128, name : Lights2, value : 0.5}
NAMED_VALUE_FLOAT {time_boot_ms : 869128, name : PilotGain, value : 0.5}
NAMED_VALUE_FLOAT {time_boot_ms : 869128, name : InputHold, value : 0.0}
NAMED_VALUE_FLOAT {time_boot_ms : 869128, name : StickMode, value : 0.0}
SERVO_OUTPUT_RAW {time_usec : 869208027, port : 0, servo1_raw : 1500, servo2_raw : 1500, servo3_raw : 1500, servo4_raw : 1500, servo5_raw : 1500, servo6_raw : 1500, servo7_raw : 1500, servo8_raw : 1500}
NAMED_VALUE_FLOAT {time_boot_ms : 869628, name : CamTilt, value : 0.45499998331069946}
NAMED_VALUE_FLOAT {time_boot_ms : 869628, name : CamPan, value : 0.5}
NAMED_VALUE_FLOAT {time_boot_ms : 869628, name : TetherTrn, value : 0.0}
NAMED_VALUE_FLOAT {time_boot_ms : 869628, name : Lights1, value : 0.0}
NAMED_VALUE_FLOAT {time_boot_ms : 869628, name : Lights2, value : 0.5}
NAMED_VALUE_FLOAT {time_boot_ms : 869628, name : PilotGain, value : 0.5}
NAMED_VALUE_FLOAT {time_boot_ms : 869628, name : InputHold, value : 0.0}
NAMED_VALUE_FLOAT {time_boot_ms : 869628, name : StickMode, value : 0.0}
SERVO_OUTPUT_RAW {time_usec : 869708026, port : 0, servo1_raw : 1500, servo2_raw : 1500, servo3_raw : 1500, servo4_raw : 1500, servo5_raw : 1500, servo6_raw : 1500, servo7_raw : 1500, servo8_raw : 1500}

You can see that while NAMED_VALUE_FLOAT returns a changing value for CamTilt (I was moving the camera at the time), servo8_raw only ever returns 1500 - if you’d be able to clarify what’s going on here I’d appreciate it; I’d like to understand the way you’d intended for me to use SERVO_OUTPUT_RAW - though if you don’t have the time that’s no stress!

Regardless, thanks for your help!