Controlling camera servos via mavlink commands?

I have a quadcopter running arducopter 3.4.1. I have a camera gimbal attached to ports AUX1 (tilt), AUX2 (mode), and AUX3 (pan), and APM configured like this (via qgroundcontrol):

Gimbal Tilt
Ouput channel: 9
Input channel: RC10

Gimbal Roll
Output channel: 10
Input channel: RC11

Gimbal Pan:
Output channel: 11
Input channel: RC12

This all works just fine using the pots on my transmitter (which are mapped to channels 10, 11, and 12), but I would like to be able to control the gimbal using mavlink commands set from mavproxy (1.5.7). I thought this seemed like the obvious solution for trying to control, for example, the gimbal tilt…

servo set 9 1500

…on the assumption that “servo 9” corresponds to “output channel 9”. But that doesn’t seem to have any effect. In fact, I’ve tried that without pretty much all servo channels without any impact. In all cases, I get the following response:

Got MAVLink msg: COMMAND_ACK {command : 183, result : 0}

I’ve also tried attacking this from the other side of things using the “rc” commands (like rc 10 1000), but these appear to have no effect whatsover (there is no COMMAND_ACK returned by the copter).

Is this a problem with my APM configuration? Or am I just not doing this the right way?

Hi Lars,

Starting from the end: rc commands don’t work because RC override is limited to the first 8 channels.
I see no reason why the servo command wouldn’t work, except that maybe it is immediately overwritten by your transmitter?

Are you using the mount feature? If you are, MAVProxy has a module called gimbal (you can load it with module load gimbal) that has a command gimbal point ROLL PITCH YAW that may do what you want.

1 Like

How does module load gimbal differ from the DO_MOUNT_CONTROL command available in flight plan in mission planner?

My set up is similar to Lars’. I can control the gimbal fine with the RC. However it appears the do_mount_control command is being ignored in auto missions. Under the action tab I select MAVlink target from the drop down and hit set mount. Am I missing some other step.



Hi David,

It differs in the way it is handled inside ArduPilot. The gimbal module sends a command that is executed immediately without the need to save it. The flight plan is saved to be used later when you are running a mission in Auto mode - there might be a bug in that, there’s a report here in the forum: APM:Copter V3.4.2-rc2,the command DO_DIGICAM_CONTROL does not trigger the servo/camera


Thanks for the timely reply. Do you know if I should be using the DO_MOUNT_CONTROL or do digicam control?



Just looked at mission planner. It looks like do-digicam-control sets the parameters of the camera, which is not what I need. I am trying to command the actual gimbal to move during an auto mission.


Starting from the end: rc commands don’t work because RC override is limited to the first 8 channels

Well, that’s interesting, and will probably save me quite a bit of frustration!

I see no reason why the servo command wouldn’t work, except that maybe it is immediately overwritten by your transmitter?

Yeah, me neither :confused: . The behavior is the same even with the transmitter off, so I think it’s not a case of the tx overriding the value I’m trying to set. I will try out the gimbal module this evening and see if that behaves any differently, although that will be a less optimal solution (because “roll” is actually “gimbal mode”, and “pan” is “rate of turning” rather than “angle”).

Hi David,

Sorry for not being clear. You should definitely use DO_MOUNT_CONTROL to control the gimbal. What I meant is that there might be a bug in the way we handle these commands when used in a mission.

Hi Lars,

If you have a log where you try to use the servo command it may be possible to see if the output value changed or not.
Also, if you are using the mount settings, you need to change the mode to MAVLink targeting (you can do that with the gimbal module too).

I don’t get what you are saying here, can you try to explain in a different way? Maybe test the module first to see if it does what you expect or not.

Well, I have at least solved the mystery of why the servo set ... commands weren’t working. When the corresponding RCx_FUNCTION is set to anything other than 0 (Disabled), you can’t use the servo set command to control the servo (and on my system, I had assigned these functions to the various mount_* control commands).

If I reset the corresponding parameters to 0, I am able to control the gimbal with servo set as expected.

1 Like

If you set the respective RCx to zero will it still work with the remote control? I want to control the gimbal with the RC on non auto mission and mission planner ti command it to the set parameters when flying auto missions.

Thank for sharing,


No, when an RCx_FUNCTION is set to 0, it can’t be controlled with your transmitter.

If you want to have both RC control and mission planner control, your best option is to configure the RCx_FUNCTION settings for mount_tilt, mount_pan, and mount_roll. Then you can set the corresponding MNT_RC_IN_x parameters to whichever RC channels you want, and assuming that MNT_DEFLT_MODE is “rc targeting” you will (a) be able to use your transmitter to control the gimbal in manual mode, and (b) you will be able to set up mission items using the MAV_CMD_DO_MOUNT_CONTROL command, putting the gimbal into “mavlink targeting” mode instead. When your mission is complete you will once again have manual control.

Use the mount control commands is in some ways a little less convenient that being able to set a single servo output to a particular value, but it ends up being more flexible.

1 Like


Thanks for the reply. The method you described is how I currently have my gimbal set up. I can control it with my RC but it doesn’t move to the commanded angles via mavlink on an auto mission. I missed the mavlink targeting action the first few times I tried it but eventually figured that one out.

I am using the gimbal tool in mission planner. Are you using servo or something else as type?



@skyveyor, I’m not 100% sure I understood your last question, but for the record, after fiddling around a bit, I’m using these RC*_FUNCTION settings…

RC9_FUNCTION     7.000000 
RC10_FUNCTION    6.000000
RC11_FUNCTION    8.000000

And these MNT_RC_IN_* settings:

MNT_RC_IN_PAN    10.000000
MNT_RC_IN_ROLL   11.000000
MNT_RC_IN_TILT   9.000000

And these MNT_* settings:

MNT_DEFLT_MODE   3.000000

(Where “3” means “RC Targeting”)

And then I can create a mission plan using MAV_CMD_DO_MOUNT_CONTROL commands, and those commands successfully control the gimbal. When the mission is over, the mount mode returns to RC targeting and I can once again use the transmitter to control the gimbal.

1 Like


Thanks for posting the details of your set up. Mine is similar. I saw in another post you use qControl as your GCS so the gimbal set up may be different from mission planner.

Mission planner gives an option to select servo, Storm32, Alexmos serial and a few other options I don’t recall. I am using servo and wondering if I need to use Alexmos serial to get it to work via mavlink on auto missions


I have my mount type set to “servo”:

STABILIZE> param show mnt_type
MNT_TYPE         1.000000

Here is the list of values for MNT_TYPE.

I think I have find some reason of the problem,by adding code to output the result of some parameters in code source file ,ardupilot-master\libraries\AP_Mission\AP_Mission.cpp. Where the problem occurred is in the function MAV_MISSION_RESULT AP_Mission::mavlink_int_to_mission_cmd(const mavlink_mission_item_int_t& packet, AP_Mission::Mission_Command& cmd)—case MAV_CMD_DO_DIGICAM_CONTROL—cmd.content.digicam_control.shooting_cmd = packet.x.The type of shooting_cmd is uint8_t, the type of packet.x is int32_t,and this problem may be due to the different types of data caused.In mission planner/flight plan,when I set param5=1(shutter_cmd) in command DO_DIGICAM_CONTROL,and I write waypoints(with DO_DIGICAM_CONTROL) by pressing the “write wps” button , the value of shooting_cmd should be equal to packet.x ,but the output of my test code shows that the value of it has changed.Tomorrow, I will continue to debug the code to find the real reason.

hello i have just setup a self made servo gimbal using pixhawk and i am able to finally send mavlink messages the steps i did were

  1. import gimbal module in mavproxy (module load gimbal)
    2)set mavlink control to gimbal(gimbal mode MAVLINK)
    3)use gimbal setpoint to get desired orientation(gimbal setpoint ROLL PITCH YAW)

plus before it i had setup the gimbal using gimbal setup in pixhawk and configured it using my rc RX/TX

1 Like