How to control Gimbal from Olympe script

I have now spent almost a full day trying to control my AnafiThermal Gimbal from a script without any success. I can start and stop the drone. I managed to get the Gimbal moving by sending a reset request to the Gimbal with:

drone(olympe.messages.gimbal.reset_orientation(gimbal_id=0)).wait()

So gimbal messages seems to work. I can also see the Attitude messages with the gimbal location if I turn on debug logging.

I have then tried to control the gimbal with a lot of combinations (mode/reference/values etc…) using the following command (was available in some Olympe example):

drone(gimbal.set_target(
    gimbal_id=0,
    control_mode="position",
    yaw_frame_of_reference="absolute",
    yaw=0.0,
    pitch_frame_of_reference="absolute",
    pitch=45.0,
    roll_frame_of_reference="absolute",
    roll=0.0,
)).wait()

The gimbal does not move when I issue the command. If I issue the command connected via the SkyController3 then the tilt function on the handcontroller stops working (so something is happening). I also tried to connect directly to the drone with SkyController3 turned off via WiFi with same result.
I have tested some messages that are not documented in Olympe documentation (olympe.messages.ardrone3.Camera.OrientationV2) but that did not work either…

Have anyone else got this working on a Anafi or do you have any good ideas what to do???

Hi,

Could you try the following command:

drone(gimbal.set_target(
    gimbal_id=0,
    control_mode="position",
    yaw_frame_of_reference="none",   # None instead of absolute
    yaw=0.0,
    pitch_frame_of_reference="absolute",
    pitch=45.0,
    roll_frame_of_reference="none",     # None instead of absolute
    roll=0.0,
)).wait()

and post associated olympe logs ?

It should work with or without the SkyController3 between your application and the drone.
olympe.messages.ardrone3.Camera.OrientationV2 shouldn’t be used on Anafi (it’s only useful for Parrot Bebop or Disco).

Thanks

Nicolas

No it did not work for me but I will use the gimbal feature in the FlihtPlan instead. I can use REST interface to download and upload flightplans from the drone and control the gimbal direction there instead. Saw that FlightPlaner6 saves QGC WPL 120 format but it accepted upload of QGC WPL 110 (can be generated by MissionPlanner). I will test if 110 works…

Anyway, that solves the issue for now :slight_smile: but it would be good to get it working…

/ Mats

I really don’t know what we’re missing here. The code above should work without any issue.

Could you please share the olympe logs of the following script ?

gimbal_set_target = drone(gimbal.set_target(
    gimbal_id=0,
    control_mode="position",
    yaw_frame_of_reference="none",   # None instead of absolute
    yaw=0.0,
    pitch_frame_of_reference="absolute",
    pitch=45.0,
    roll_frame_of_reference="none",     # None instead of absolute
    roll=0.0,
)).wait()
print(gimbal_set_target.explain())

when you are directly connected to the drone without a SkyController3 first, even if it shouldn’t have much impact.

Thanks

Nicolas

Thanks for your support. I did a quick test and I got same result as before. I have uploaded the python script, stdio and log file in the attached file.

gimbaltest.zip (15.5 KB)

Hi eubmabe,

I still don’t understand what’s happening to this gimbal.set_target command. The drone just seem to ignore it for some unknown reason. Please continue to share any update you may have on this issue. Thanks

Thanks for the information. Could not find the link that you referred to. Could you share it?
Thanks
/ Mats