On realtime control of gimbal from companion computer

What I am trying to do:

I have been looking into enabling offboard gimbal control from the companion computer to use it for human tracking. (such as what skydio does). The gimbal should be able to look at certain objects / positions while the vehicle is doing aggressive maneuvers. However, I quickly realized the current firmware doesn’t seem to support this functionality properly. I would like to get some comments on what is the right direction on implementing this.

This is how far I went so far:

  • I have been trying to use the actuator_control commands through mavros with group_mix=2 which is the gimbal.
  • Previously acutaotr_commands made the vehicle ignore every setpoint, So a fix was made in this Pull Request to not ignore offboard setpoints when the actuator commands were for the gimbal. In order to use this, vmount needs to be off
  • The video of using actuator setpoints using mavros in SITL is shown below. I am making the drone follow a circular trajectory by sending bodyrate and thrust setpoints. The tracking performance is not so good due to the jitter of the setpoints. Without the actuator setpoints, it can fly quite well

Issues:

  • Sending actuator setpoints result in glitches in the offboard setpoints. This I was not able to figure out why. body_rate setpoints becomes jittery when actuator setpoints are sent at high rates(100Hz).

Using actuator setpoints is a hack anyway, so an alternative would be using MAV_DO_MOUNT_CONTROL. However, this is a mission command and does not enable continous setpoints for the gimbal control.

Would defining more mavlink messages to enable this be necessary? or would there be a better way to enable this? I would appreciate any comments.

@Jaeyoung-Lim any updates on this?

@Mzahana This should be fixed, but anyhow this issue was before we had the mount_plugin in mavros.

There is no reason to use actuator setpoints for controlling gimbals anymore

@Jaeyoung-Lim
Thanks for replying.
Do you know of any example MAVLink-enabled gimbal, or how to make one?!

@Mzahana It is not related with mavlink compatible gimbals. You can still control normal gimbals in offboard mode, just without offboard actuator setpoints

You can check: https://github.com/Jaeyoung-Lim/mavros_humantracking

@Jaeyoung-Lim
So, for example, any PWM gimbal can connect to a Pixhawk board through AUX pins and controlled by RC or offboard mode?

Yes, that is correct

Hey @Jaeyoung-Lim ,

I am trying to control a servo motor that is connected to AUX1 in offboard mode. The servo is powered through a BEC and the signal cable is connected to AUX1. I have tried different mavros messages but didnt get it working. However, when I passthrough channel 5 of my RC to AUX1 it works.

Do you know how I can control PWM of AUX1 in offboard mode? Is it possible? Do I have to set any parameters to activate this feature?

Hi @ernsten . I’m trying to control a servo motor like you. Did you solve your problem? I’m in firmware version v1.13.1