[URGENT] Piloting with LibAR


#1

Product: [Bebop2]
Product version: [X]
SDK version: [3.13]
Use of libARController: [YES]
SDK platform: [iOS]
Reproductible with the official app: [Not tried]

Hello,
I’m using a basic motion detection algorithm to try and pilot the bebop2 using Motion data
from IOS
whenever I try to use libARSDK to pilot in realtime, I get unstable results and loose control over the drone (crashed into objects 2 times)
I try and send commands like this

            print ("Moving Backwards",abs(deviceMotion.userAcceleration.x*10))
            if (DroneController.isReady())
            {
                drone.setPilotingPCMDFlag(dronec,1)
                drone.setPilotingPCMDPitch(dronec,Int8(deviceMotion.userAcceleration.x*10))
            }
            unstable = true

and then every 2 seconds I send if (unstable == true)

 func stablisie()
    {
        print("stablising")
        if (DroneController.isReady())
        {
            drone.setPilotingPCMDFlag(dronec,1)
            drone.setPilotingPCMDYaw(dronec,0)
            drone.setPilotingPCMDPitch(dronec,0)
            drone.setPilotingPCMDRoll(dronec,0)
            drone.setPilotingPCMDGaz(dronec,0)
        }
        unstable = false
    }

even when I land and try to take off again the values don’t seem to be reset, I’m skipping error checking and on_state_changed.

Can anyone point me to the right and most straight forward usage of these functions (preferably with a code snippet)?

Thank you.


#2

It’s quite hard to answer this question without understanding your whole code and the specific problem.
What do you mean about “loose control over the drone”?
What is the value that is set as the pitch?

Please note that when you want to make the drone hover (your stablisie function), you’d probably set the flag to 0 instead of 1.