Decoupling Copter Yaw from Gremsy Gimbal Pan

I’m using a Gremsy Mio (a three-axis gimbal very similar to the Pixy U) set up as a SToRM32 serial gimbal and I’m having problems flying with it in guided mode, specifically when I give the drone a waypoint. I want to have the drone yaw to the next waypoint and be able to pan the gimbal arbitrarily throughout that flight, but so far I haven’t figured out how to do that.

I have WP_YAW_BEHAVIOR set to 1, so the drone should point its nose toward the next waypoint. However, when I command the gimbal to point to (pan, tilt) of (0, -45), the copter yaws to point due north when en route to a waypoint, no matter what direction that waypoint is in. If I command the gimbal to point to (90, 0), the gimbal pans 90 degrees with respect to the drone’s body frame, but the drone also yaws 90 degrees. So if I was flying to a waypoint due north and commanded the gimbal to pan to 90 degrees, the drone would be facing due east and the gimbal would be facing 90 + 90 = 180 = due south.

In reading this forum post, I thought if I changed the SToRM32_Serial has_pan_control() function to return true, I would be able to yaw to waypoints and the gimbal could move independently.

I tested that hypothesis today and found that when hovering in guided mode (without any waypoints) I could command the gimbal independently from copter yaw. Huzzah! But then I commanded gimbal (pan,tilt) to (0, -45) and gave it waypoints and the copter yawed to face due North again instead of facing its westward waypoint.

What else can I do to get this drone to face its waypoints while still using the Gremsy gimbal set up over serial? I’m willing and able to modify the firmware to make this work, I just need to have a general concept of where this problem is so I can hunt it down. Or perhaps I am overcomplicating matters. Is there instead some parameter or configuration I could tweak to get the copter to yaw independently of the gimbal?

Thanks in advance for your help!

Additional technical details:

  • Gremsy Mio set up as per Gremsy’s instructions
  • I am using MAVLink targeting mode with DO_MOUNT_CONTROL commands