Get drone orientation after take-off

Is there an interface for getting where the drone is facing after take-off?

I want to get the orientation of the drone after take-off. This is so that when drone returns to take-off location, it can adjust itself to face the same direction as it was during take-off.

Hello

You can get the drone orientation through the AttitudeChanged message yaw parameter. You just have save the value after take-off.

And how do you set the orientation of the drone according to the saved yaw value? I tried gimbal.set_target which does not work.

Hello

gimbal.set_target is for controlling the gimbal orientation (only pitch axis for Anafi). For the drone heading you should use the moveTo command message, set the heading parameter to the desired yaw orientation and the position to the current GPS position (as returned by the PositionChanged event message).

Regards

Nicolas

Still does not work. The drone does not face the same direction it was facing during takeoff.
Steps:

  1. Take-off
  2. Get yaw from AttitudeChanged

Attitude ([(‘roll’, -0.0030544851906597614), (‘pitch’, 0.009128596633672714), (‘yaw’, 1.5361944437026978)])

  1. moveBy to some location
  2. moveTo take-off GPS location orientation=TO_TARGET

Attitude ([(‘roll’, -0.0034618081990629435), (‘pitch’, 0.00774390110746026), (‘yaw’, -0.6753292679786682)])

  1. moveTo using position from PositionChanged with heading=yaw(from 2), orientation-HEADING_START

Attitude ([(‘roll’, 0.0020538419485092163), (‘pitch’, 0.006904979702085257), (‘yaw’, -0.07678093761205673)])

Result: Drone did not face expected direction.

It turns out I was using the wrong unit for the heading in moveTo function. The attitude[‘yaw’] from AttitudeChanged is in radian. This must be converted to degrees first before passing to moveTo function.