Giombal v2 RC control

Hi, I am using ArduPilot 4.3.3 and I am trying to update my code to work with gimbal v2 protocol. I tried simple switch to manual control via RC channels, I am confused, since based on documentation I shall send this message Messages (common) · MAVLink Developer Guide with flags set to 256 (Messages (common) · MAVLink Developer Guide). and If I want to control gimbal with RC only, i shall send float(‘NaN’) for angles and rates in GIMBAL_MANAGER_SET_MANUAL_CONTROL, but when I try it, it tells me it expects integer, not float… But with 0s as integeres, I believe it tells gimbal to not move? I am doing something wrong?

You are trying to use code that is only available in ArduCopter 4.4.4.
BTW the code has been again improved in ArduCopter 4.5.0-beta2

Update FW and re-try.

you are mistaken with “based on documentation I shall send this message GIMBAL_MANAGER_SET_MANUAL_CONTROL with flags set to 256 (GIMBAL_MANAGER_FLAGS_RC_EXCLUSIVE)

the RC flags are info to the gimbal device that it should ignore the messages from the gimbal manager and do it’s own propietary RC control (if it has any), which is totally different to using MANUAL_CONTROL (MANUAL_CONTROL != RC control). Therefore, in fact, when you send MANUAL_CONTROL with RC_EXCLUSIVE set you tell the gimbal device to ignore any data from the gimbal manager, i.e., you effectively shut off the MANUAL_CONTROL message!

so, just send MANUAL_CONTROL, but don’t mangle with the RC flags.

oh, ok, thank you for info, I did upgrade to 4.4.4., but with the same result.

Then what value for flags shall I send with the GIMBAL_MANAGER_SET_MANUAL_CONTROL? To not disable manual control message? Or maybe from start, what shall I send to switch gimbal to RC control mode? I understood the docs that I shall send the GIMBAL_MANAGER_SET_MANUAL_CONTROL message with specific flags, based on what I want. But obviously, I understood it wrongly. The RC control mode works fine with gimbal v1 protocol, so I just wanted to replace old with new one :slight_smile:

there is no such thing as RC control in gimbal protocol v1. You really need to tell properly what you want to do.

with ArduPilot you can do RC control with v1 messages, since ArduPilot has implemented ways to do this. The VERY SAME ways however work also with using gimbal v2 messages. Just do exactly the same as before, as in the docs.

You however talk about GIMBAL_MANAGER_SET_MANUAL_CONTROL. It’s a new thing, so (1) you can’t argue it was working before and (2) you need to go new ways, the gimbal v2 ways.

with regards to MANUAL_CONTROL itself, you “simply” send it to the gimbal manager, i.e., with the gimbal_id you got for your gimbal device by listening to GIMBAL_MANAGER_STATUS.

from here on I can’t tell you what’s going to happen or needs to be done since ArduPilot’s gimbal manager implementation isn’t complete. If it were gimbal v2 protocol compatible you would have to send a DO_GIMBAL_MANAGER_CONFIGURE to acquire control and MANUAL_CONTROL should then work. But it might be that ArduPilot doesn’t even support GIMBAL_MANAGER_SET_MANUAL_CONTROL yet. You need to check. All I can tell you is that you should not set the RC flags :wink:

ok, I am sorry about confusion, and I dont argue about it :). I am simply really lost here :).
I used
msg = self._vehicle.message_factory.mount_configure_encode(
0, 1, # target system, target component
mavutil.mavlink.MAV_MOUNT_MODE_RC_TARGETING, # mount_mode
1, # stabilize roll
1, # stabilize pitch
1, # stabilize yaw
)
self._vehicle.send_mavlink(msg)
before to simply switch the gimbal control. But now I get info this is depraceted. So I wanted to replace it with newer method.

So if I understand what you say, I shall use
msg = self._vehicle.message_factory.gimbal_manager_set_manual_control_encode(
0,
1,
flags,
0, # yaw
0, # pitch
0, # rate yaw
0, # rate pitch
0 # Reserved for future use, set to 0
)
self._vehicle.send_mavlink(msg)
where I use gimbal device ID (obtained from GIMBAL_MANAGER_STATUS)? but what about that flags value? shall I use all of them there? or just one? This is what I dont understand here.
and the manager implementation is not ready yet in 3.4.4 so I need to check in code or release notes.
Am I correct now? Thank you very much for your understanding and responses .