android - I can't get rotate my phantom 3 dji sdk 3.01 -
i'm trying rotate phantom 3 using sdk 3.0.1 without success,
my code:
djiflightcontroller flightcontroller = ((djiaircraft) mproduct).getflightcontroller(); flightcontroller.enablevirtualstickcontrolmode(new djicompletioncallback() { @override public void onresult(djierror error) { if (error == null) { showtoast("enablevirtualstickcontrolmode: success"); } else { showtoast(error.getdescription()); } } }); try { sleep(5000); } catch (interruptedexception e) { e.printstacktrace(); } showtoast("set yaw control mode angle"); flightcontroller.sethorizontalcoordinatesystem(djiflightcontrollerdatatype.djivirtualstickflightcoordinatesystem.body); flightcontroller.setrollpitchcontrolmode(djiflightcontrollerdatatype.djivirtualstickrollpitchcontrolmode.angle); flightcontroller.setverticalcontrolmode(djiflightcontrollerdatatype.djivirtualstickverticalcontrolmode.velocity); flightcontroller.setyawcontrolmode(djiflightcontrollerdatatype.djivirtualstickyawcontrolmode.angle); try { sleep(5000); } catch (interruptedexception e) { e.printstacktrace(); } djiflightcontrollerdatatype.djivirtualstickflightcontroldata flightcontroldata = new djiflightcontrollerdatatype.djivirtualstickflightcontroldata(0, 0, 45, 0); flightcontroller.sendvirtualstickflightcontroldata(flightcontroldata, new djicompletioncallback() { @override public void onresult(djierror error) { if (error == null) { showtoast("rotation: success"); } else { showtoast(error.getdescription()); } } }); try { sleep(5000); } catch (interruptedexception e) { e.printstacktrace(); } flightcontroller.disablevirtualstickcontrolmode(new djicompletioncallback() { @override public void onresult(djierror error) { if (error == null) { showtoast("disablevirtualstickcontrolmode: success"); } else { showtoast(error.getdescription()); } } });
i message "rotation: success" aircraft don't move. doing wrong? appreciate help.
i got problem before. performance wired, if invoke sendvirtualstickflightcontroldata
once. have sent e-mail dji support, suggest me invoke method in such frequency, 5hz. tested , fine.
something like:
timer timer = new timer(); timer.schedule(new timertask() { @override public void run() { mflightcontroller.sendvirtualstickflightcontroldata(flightcontroldata, new djicompletioncallback() { @override public void onresult(djierror error) { if (error == null) { showtoast("rotation: success"); } else { showtoast(error.getdescription()); } } }); } }, 0, 200);
Comments
Post a Comment