Using MavROS with 2 different Mavlink versions

Hi, everyone! I’m working with an hexarotor equipped with a Pixhawk 4 and a Jetson Nano (running ROS 1 and consequently MavROS). My aim is to integrate a gimbal and a camera into the system and control them via mavros, but I have a problem. The gimbal works with Mavlink v2 while the camera with Mavlink v1.

At the beginning, I’ve used QGroundControl in order to test the communication between Pixhawk and the devices and everything worked well. I’ve used the Telem1 port for the telemetry, the Telem 2 port for the camera and the UART & I2C port for the gimbal, so I’ve set the following parameters:

  • MAV_0_CONFIG = 101
  • MAV_0_FORWARD = 1
  • MAV_0_MODE = 0
  • MAV_0_RADIO_CTL = 1
  • MAV_0_RATE = 1200
  • MAV_1_CONFIG = 102
  • MAV_1_FORWARD = 1
  • MAV_1_MODE = 2
  • MAV_1_RADIO_CTL = 1
  • MAV_1_RATE = 10000
  • MAV_2_CONFIG = 104
  • MAV_2_FORWARD = 1
  • MAV_2_MODE = 2
  • MAV_2_RADIO_CTL = 1
  • MAV_2_RATE = 10000
  • MAV_COMP_ID = 1
  • MAV_FWDEXTSP = 1
  • MAV_HASH_CHK_EN = 1
  • MAV_HB_FORW_EN = 1
  • MAV_ODOM_LP = 0
  • MAV_PROTO_VER = 0
  • MAV_RADIO_TOUT = 5
  • MAV_SIK_RADIO_ID = 0
  • MAV_SYS_ID = 1
  • MAV_TYPE = 13
  • MAV_USEHILGPS = 0

Through the Mavlink Console on Qgr I’ve used the “camera_trigger test” for the camera and the “vmount test” for the gimbal and, as I said, I was able to control both them. I’ve also checked the COMMAND_LONG and the COMMAND_ACK on the Mavlink Inspector and the command 203 (MAV_CMD_DO_DIGICAM_CONTROL) and 205 (MAV_CMD_DO_MOUNT_CONTROL) were properly sent and received.

Once everything was working with Qgr I moved to mavros and, after started the mavros node, I’ve used mavcmd with the command long in this way:

  • roslaunch mavros px4.launch
  • rosrun mavros mavcmd long 203 0 0 0 0 1 0 0 (for the camera, to trigger just one shot)
  • rosrun mavros mavcmd long 205 0 0 90 0 0 0 2 (for the gimbal, to set a yaw rotation of 90°)

And that’s when I’ve noticed something strange. Keeping the MAV_PROTO_VER = 0 (Default to Mavlink v1, switch to Mavlink v2 if GCS sends version 2), the camera was able to capture an image and the gimbal didn’t move while, setting the MAV_PROTO_VER = 2 (Always use version 2), I had the exact opposite situation, I mean the gimbal worked well but the camera didn’t shoot.

So, here it is the question: How should I set the parameters in order to communicate properly with both devices through mavros? and why doesn’t the MAV_PROTO_VER = 0 work well?

Thanks in advance