mavlink / mavlink2rest

mavlink2rest creates a REST server that provides mavlink information from a mavlink source
MIT License
89 stars 28 forks source link

tilting camera #23

Closed arendeutsch closed 4 years ago

arendeutsch commented 4 years ago

Hi I was wondering if its possible to tilt the camera with mavlink2rest. I tried setting a tilt angle with the following body in the request 2500 centidegrees "header": {{ "system_id": 1, "component_id": 1, "sequence": 0 }}, "message": {{ "type": "COMMAND_LONG", "param1": 1, "param2": 2500, "param3": 0, "param4": 0, "param5": 0, "param6": 0, "param7": 0, "command": {{ "type": "MAV_CMD_DO_MOUNT_CONTROL" }}, "target_system": 0, "target_component": 0, "confirmation": 0

But i dont get any reaction.

patrickelectric commented 4 years ago

Hi @arendeutsch, what kind of camera or vehicle are you using ? Does this camera support such command ?

arendeutsch commented 4 years ago

Im testing on bluerov which its default camera, I would assume it supports it based on the fact that I can tilt the camera when im using QGroundControl

patrickelectric commented 4 years ago

if you are using the bluerov, you'll need to change the last param (param7, mount mode) to 2 (MAV_MOUNT_MODE_MAVLINK_TARGETING), you can check the message documentation here.

arendeutsch commented 4 years ago

Thanks, I will try it and let you know how it goes

patrickelectric commented 4 years ago

@arendeutsch any update ?

arendeutsch commented 4 years ago

Sorry for the late replay @patrickelectric , I wasn't able to test it yet and wouldn't be able to do it before next week. But i will let you know as soon as i do it.

arendeutsch commented 4 years ago

Hi @patrickelectric , I've tried setting param7 to 2, doesnt seem to help

patrickelectric commented 4 years ago

try to change system_id to 255 to send the message as a ground station, I'll try to replicate it later

patrickelectric commented 4 years ago

Hi,

Can you try the following code ?

export DATA='{
        "header": {
            "system_id": 255,
            "component_id": 1,
            "sequence": 0
        },
        "message": {
            "type": "COMMAND_LONG",
            "param1": 4500.0,
            "param2": 0.0,
            "param3": 0.0,
            "param4": 0.0,
            "param5": 0.0,
            "param6": 0.0,
            "param7": 2.0,
            "command": {
                "type": "MAV_CMD_DO_MOUNT_CONTROL"
            },
            "target_system": 0,
            "target_component": 0,
            "confirmation": 0
      }
}'
curl --request POST http://0.0.0.0:8088/mavlink -H "Content-Type: application/json" --data $DATA

A warning: This message will not work under SITL but only in the real ROV or a simulated ROV.

arendeutsch commented 4 years ago

Thank you, it seems to work fine now :) Is that mean that in the future if i get another camera gimble param2 and param3 are roll and pan ?

patrickelectric commented 4 years ago

if you have a camera with a 3axis gimbal yes, the default bluerov only has pitch control.