Hello everybody,
I am working on a project for school and I am having the problem, that my Anafi drone changes into flying state after taking off and stays there. Thus ignoring the following moveby command. In the sphinx simulation everything works just fine. I am using the newest firmware version and connect via the Skycontroller to the drone, just like described in the documentation. I wrote a testscript wich yields the same result. The drone takes off and then just hovers there. Even when sending the drone a hover command (PCMD(1, 0, 0, 0, 0, 0)), the drone stays in the flying state. Here is the testscript:
DRONE_IP = "192.168.53.1"
with olympe.Drone(DRONE_IP) as drone:
drone.connect()
# Set up for Controller
drone(setPilotingSource(source="Controller")).wait()
# Wait for GPS fix
drone(GPSFixStateChanged(fixed=1, _timeout=30, _policy="check_wait")).wait()
# Wait until Drone is hovering
drone(
TakeOff(_no_expect=True)
& FlyingStateChanged(state="hovering", _policy="wait", _timeout=10)
).wait().success()
# Get flying state
print(drone.get_state(FlyingStateChanged)["state"])
# Fly to altitude
drone(
moveBy(0, 0, -5, 0, _no_expect=True)
& FlyingStateChanged(state="hovering", _policy="wait", _timeout=30)
).wait().success()
# Get flying state
print(drone.get_state(FlyingStateChanged)["state"])
# Do pcmd stuff
timer = time.time()
while(time.time() - timer < 2):
drone(
PCMD(1, 0, 100, 0, 0, 0)
)
# Send hover command
drone(
PCMD(1, 0, 0, 0, 0, 0)
>> FlyingStateChanged(state="hovering", _policy="wait", _timeout=10)
).wait().success()
# Get flying state
print(drone.get_state(FlyingStateChanged)["state"])
I also uploaded the output from olympe: log.zip (14.5 KB).
Thank you for your help in advance.
Domi