Disengage Autopilot when touching skycontroller 2 axis


#1

Hi !

I am currently implementing a sort of “autopilot” for my Bebop 2 drone.
I.e. I use a smartphone app as extension of the skycontroller 2.

When I engage the autopilot, I need to setController(controller) to give controls to the phone which computes the drone behavior (-> skycontroller inputs don’t work any more).
When I disengage it I need to setController(skycontroller) to get back manual control.

My problem is for now, I need to click on the engage/disengage button each time I want engage or disengage the autopilot. But for security reason I also want an automatic disengage when I give manual axis inputs with the skycontroller 2. Is it possible to intercept the skycontroller axis inputs even when skycontroller is disabled by setController(controller) ?

Thanks !


#2

You want to grab the SC axes and disengage copilot when the event fires.

Pretty sure I have an example of this. Stand by.


#3

Correction on that… I did it the exact opposite…

In my implementation I make the APP the master and the SC the slave.

Perhaps the axes grabs will still work. It is worth trying.

     // grab SC control axes as part of some event
    int b1 = 1;
    b1 = b1 | (1 << 1);
    b1 = b1 | (1 << 2);
    b1 = b1 | (1 << 3);

   deviceController.getFeatureMapper().sendGrab(0, b1);



// triggered by ARCONTROLLER_DICTIONARY_KEY_MAPPER_GRABAXISEVENT
@Override
public void onMapperGrabbedAxisEvent(int axis, byte value) {
     // release axes controls
     deviceController.getFeatureMapper().sendGrab(0, 0);

     // do something application specific

}


#4

Thanks for your answer, I will have a look on that ! Keep in touch !


#5

So I am certain this will work the more that I think about it.


#6

It is working fine ! Thanks a lot !