Please select Into the mobile phone version | Continue to access the computer ver.
Virtual Sticks implementation
822 3 2022-2-10
Uploading and Loding Picture ...(0/1)
o(^-^)o
djiuser_rUPo8vECVlTQ
lvl.2

Slovakia
Offline

Hello,

I am using sendVirtualStickDataTask programmatically based on DJI Sample SDK application for Android.

My settings are:

                     flightController.setVerticalControlMode(VerticalControlMode.POSITION);
                     flightController.setYawControlMode(YawControlMode.ANGULAR_VELOCITY);
                     flightController.setRollPitchControlMode(RollPitchControlMode.ANGLE);
                     flightController.setRollPitchCoordinateSystem(FlightCoordinateSystem.BODY);


and I create new DataTask like this:

                    throttle = 0f;
                    yaw = 0f;
                    pitch = 0f;
                    roll = -0.1f;

                    if (null == sendVirtualStickDataTimer) {
                        sendVirtualStickDataTask = new SendVirtualStickDataTask();
                        sendVirtualStickDataTimer = new Timer();
                        sendVirtualStickDataTimer.schedule(sendVirtualStickDataTask, 0, 200);
                    }


But everytime I move my drone (DJI Spark) with this code, it seems like it goes random way. Sometimes it flies to the left as it should, but as soon as I move or rotate the drone, then it will fly to any other side, even to the right, backwards or forwards or combination of roll and pitch, which is not supposed to happen if everything else is set up to zero. I am very confused as I am a beginner with this.

Do you have any ideas or do you know what can cause the problems? Thank you very much.
2022-2-10
Use props
Mats Bohlinsson
lvl.4
Flight distance : 1838077 ft
  • >>>
United States
Offline

The roll is never exact zero when hovering. You better use speed mode. Angle mode needs som kind of pid-controller to work well.
2022-2-10
Use props
Maros1515
lvl.2

Slovakia
Offline

Mats Bohlinsson Posted at 2-10 08:06
The roll is never exact zero when hovering. You better use speed mode. Angle mode needs som kind of pid-controller to work well.

Did you mean Velocity mode for flightController.setRollPitchControlMode? If yes,then can i keep other 3 parameters which i mentioned same as before?
2022-2-10
Use props
Mats Bohlinsson
lvl.4
Flight distance : 1838077 ft
  • >>>
United States
Offline

Maros1515 Posted at 2-10 08:18
Did you mean Velocity mode for flightController.setRollPitchControlMode? If yes,then can i keep other 3 parameters which i mentioned same as before?

Yes and yes.
2022-2-10
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules