Best way to override mission with a script

I am new to ANAFI and am looking for some high-level advice about sending MOVE commands from a script while the drone is already in flight.

I have Sphinx running, and can fly a simulated mission using Freeflight 7 through the SkyController. I want to maintain the ability to take control manually in case of emergency. I want write a python script that will send a MOVE command and interrupt the mission (in response to an emergency, say). The drone would suspend it’s mission and follow the MOVE command. Right now I’m trying to do this using Olympe, but I cannot get the script to connect to the SkyController while the SkyController is already connected to the drone.

Ultimately I’d like to then test that script using the real Anafi AI.

Is it possible to do what I’m describing? Is Olympe the way to go to do this?

Hi,

This is behavior is expected: the drone only accepts one controller at a time (and that’s the same for the SkyController ↔ FreeFlight link).

You should always be able to interrupt the mission using FreeFlight, since the drone would also interrupt it and run a RTH if the link is lost, but if you really need a third party piece of code to do it, then the way is probably by using an Air SDK mission using the libairsdk internal controller feature. We have an example of such a mission here, with the full Air SDK documentation being available there.

Regards,
Nicolas.

Hi Nicolas,

Thanks for your response.

We understand that the drone cannot accept controls from both the computer and the drone at the same time. Thus we have been trying to connect the computer to the SkyController and pass the Olympe commands through the SkyController to the drone using code similar to the following:

import olympe
from olympe.messages.skyctrl.CoPiloting import setPilotingSource

if __name__ == "__main__":
    skyctrl = olympe.SkyController("192.168.53.1")
    skyctrl.connect()
    skyctrl(setPilotingSource(source="Controller")).wait()

However, when I connect the drone to my Linux computer and start the simulation in Sphinx with the drone acting as a wireless access point, the SkyController remains unrecognized by the computer and no connection to the SkyController can be made, regardless of whether the WiFi connection from the Linux computer to the drone is active or not. When I disconnect the drone from the loop, I have no issue recognizing and connecting to the SkyController. I’m wondering if this is a limitation of the system, or if I should be doing things in a separate order in order to establish positive connection from the computer → Skycontroller → drone and back to the computer for Sphinx simulation?

Another possible point of issue is that my computer has only 1 USB-C port, so I’ve been using a USB-C to USB-A cord for one of the connections. Is that connection supported for Olympe/Sphinx or is it as simple as needing 2 dedicated USB-C ports?

Hi @tonyada99,

It should normally work.

try in this order:
1 - Execute the sphinx-drone-as-wifidongle command to set the drone as a wireless access point.
2 - Start the simulator. You should see this line in the log :

[Msg] Using interface for remote controller: ‘sphx_ana_XXXX’

3 - turn on the SkyController

Regards,
Axel

This topic was automatically closed after 30 days. New replies are no longer allowed.