GIMBAL_DEVICE_ATTITUDE_STATUS flags and values

Hi, I use GIMBAL_DEVICE_ATTITUDE_STATUS message to obtain state of gimbal and I calculate the euler angles like this r, p, y = pymavlink.quaternion.Quaternion(m.q).euler. And it works fine when I have the gimbal in follow mode I get relative attitude to vehicle frame, but once I switch the gimbal into lock mode, the values are strange and they surly not represent values relative to earth north, like described in GIMBAL_DEVICE_FLAGS_YAW_LOCK neither the relative values to vehicle frame. I use Gremsy gimbal. What can be the issue?

Hi @LukasBrno which gimbal model do you use? Can you check the GIMBAL_DEVICE_FLAGS_YAW_LOCK set or not? For better support, please contact support@gremsy.com

Hi @Minh_Le , we use GREMSY T3V3 - Gremsy. And I have noticed that the issue is only in case when I use rate to move gimbal, the feedback is strange, like not updated for some time. And when I set zeros to angles it is heading to somewhere else than north. Any Ideas? Maybe we do something wrong…? The flag GIMBAL_DEVICE_FLAGS_YAW_LOCK is set properly, I can see it in gimbal feedback, only thing the number is different than documented, but it changes. And even QGC reports the flag correctly.

Hi @LukasBrno , Do you use the latest v783 firmware in github Release gremsyT3V3_v783_Official · Gremsy/T3V3-Firmware (github.com) This fixed some bugs so it might fix your issue. Otherwise, Can you share some logs in your control application and a video describe the issue, so I can debug further.

Hi @Minh_Le , thank you for your advice… We are currently traveling with drone and it is already packed. I will check it immediately once we are back at home, but we expect returning of our equipment by the end of this week. But I will definitely check it and I will try to provide the video.

Hi @Minh_Le , we finally got our drones back and working again. I was not able to create a video, but we did check the gimbal firmware with gtune app and we alread have the latest one from the link. I dont have any logs from today, since we did not fly, but I have one log from recent fly and I found MNT field and I can see too values for yaw - YawE and YawB. In the mean time I have another issue controling gimbal, but this can be in my code, but when I try to rotate the gimbal with rate, it seems the response is quite slow, when I change the rate suddenly, it follows previous direction for a while then it changes to new one. I dont know why, like I said it can be something from my code, but still any hints?
And thank you for your pation…

Hi @Minh_Le , Do you know, if it is possible to enable Mavlink2 on that gimbal? It seems it uses Mavlink1 as default.

Hi @LukasBrno , I dont know much about the log but I guess yawE is the gimbal yaw in Earth frame and yawB is the gimbal yaw in the Drone frame. About the slow response, you can take a look at the smooth parameters in gTune → Settings → Controls → Mavlink → Tilt/ Roll/ Pan. Lower value has faster response.

Hi @LukasBrno , Do you mean Mavlink protocol version 2, right? The gimbal only support Mavlink protocol version 2. If you mean Mavlink Gimbal Protocol, the gimbal supports both Mavlink Gimbal Protocol 1 and 2, but it is recommended to use the Mavlink Gimbal Protocol version 2.

Hi @Minh_Le , thank you, it seems yaw E is end value - corrected angle in earth frame, yaw b is yaw before correction done by Ardupilot, so it is in vehicle frame.
But thank you for the tip about smooth params, will test it. Lukas

Right, I ment the Mavlink protocol version 2. I will check the SERIAL2_PROTOCOL parameter, it it uses Mavlink2 or not, because I dont see extended fields in GIMBAL_DEVICE_ATTITUDE_STATUS msg.

Hi @Minh_Le , I did not create video, but I have log snipped.
Test what I did today is:

  1. centered gimbal with vehicle frame - I had feedback almost 0 yaw, that is ok
  2. sent command to move with rate (0,0) in earth frame (yaw lock - flag 16 in command), flag 60 in attached log
  3. sent command to move with rate (0,0) in vehicle frame (flag 32 in command), flag 44 in attached log
    And you can see from log attached

that the angle in feedback is different even if gimbal did not move. If it would be constant, I could compensate it, but when i restart connection, the number is different then.
Commands I used to control gimbal:
self.master.mav.gimbal_manager_set_pitchyaw_send(
self.master.target_system, self.master.target_component,
int(flag_id),
0,
float(‘NaN’),
float(‘NaN’),
float(math.radians(pitch_rate)),
float(math.radians(yaw_rate)),
)
where flag_id is set to 16 to use yaw lock and 32 to use vehicle frame
feedback is obtained via GIMBAL_DEVICE_ATTITUDE_STATUS msg. Interesting thing is, that the imaginary offset is there even I set absolute angles instead of rates, so the feedback then is increased by that imaginary offset.
When I tried to simply change the mode from QGC


by clicking Yaw Follow and Yaw Lock, so when I click Yaw lock, the gimbal moves by 180 degrees, but it should not… right?
Any ideas why this is happening or what could be the rootcause?

Hi @LukasBrno , Sorry for the late reply.

Can you try the new v784 Beta firmware at Release gremsyT3V3_v784_Beta · Gremsy/T3V3-Firmware. This fixed some bugs when using with new QGC. Also, you have to enable Reduce Drift by Drone for the gimbal in gTune.

hi @Minh_Le , no worries, thank you for the tip, will try new firmware ASAP. In meantime I have found this gSDK/doc/gSDK Documentation_v3.0.0_draft.pdf at master · Gremsy/gSDK · GitHub and I have noticed that there is NED system used instead of XYZ. Can you confirm? If so, I need to update my code getting Euler angles from quaternions in GIMBAL_DEVICE_ATTITUDE_STATUS and test it again.
Lukas

Hi @LukasBrno , In the new firmware, the gimbal send GIMBAL_DEVICE_ATTITUDE_STATUS with flag as GIMBAL_DEVICE_FLAGS_YAW_IN_VEHICLE_FRAME

So the frame is described in the attached image

Hi @Minh_Le , ok, I take it as it will always send the values as it does with vehicle frame = relative to vehicle heading, even I switch gimbal to yaw lock mode, is that right? We are going to test it next week, but this would really solved our issue, so I am curiouse. Thank you now for the info and update, I will let you know how it went.

Hi @LukasBrno , the gimbal always send the value in vehicle frame because the new QGC 4.4 and above expecting that. We have to implement so to compatible to the QGC. To check for Lock or Follow mode you can check for the bit GIMBAL_DEVICE_FLAGS_YAW_LOCK is set or not in the flag.

I know, how to switch the gimbal into GIMBAL_DEVICE_FLAGS_YAW_LOCK, only issue is that the gimbal feedback is strange, once I use this flag. The value is somehow extended with some random offset. Like I wrote before.

Hi @Minh_Le , we test the Release gremsyT3V3_v784_Beta · Gremsy/T3V3-Firmware · GitHub today and it seems to solve our issue with the feedback data. After installing and restarting the gimbal started to send the data correctly. Thank you very much. We are going to test it with more drones and gimbals, but I believe it will be ok too.
Lukas

Hi @LukasBrno Great to hear good news from you. Thank you