Virtual stick - uneven force
CompletedHello,
We implemented virtual stick control in our application.
We noticed that aircraft flies in a curve line when trying to fly from point to point.
10 times a second, we calculate the angle to destination point and using that angle we set roll and pitch respectively, and send to correct params.
We conducted the following test:
Using RollPitchControlMode.ANGLE and FlightCoordinateSystem.GROUND
Trying to fly the aircraft in a straight line, in angle -158.
We save the startLocation=currentLocation, AFTER aircraft ascended.
The params:
double angle = Math.toRadians(-158);
double pitch = (Math.cos(angle) * -1) * ROLL_PITCH_CONTROL_MAX_ANGLE;
double roll = (Math.sin(angle)) * ROLL_PITCH_CONTROL_MAX_ANGLE;
We send the params 10 times per second:
sendVirtualStickAdvancedParam(pitch, roll...)
After 10 seconds, we stop the aircraft and calculate the angle between the currentLocation and startLocation.
The calculated angle is -149, instead of -158.
Doing the same test, with an angle of 45 instead of -158, calculating the angle at the end of the flight - we get 45, which is fine.
So, when the roll and pitch forces are equal, the results are OK, otherwise, they are not.
We made sure that it's not a rounding issue and that sqrt(pitch^2+roll^2) = 1
I hope my explanation is understandable.
We ask for further assistance, thank you
-
Could you please explain why the RollPitchControlMode is not set to SPEED? When it is set to ANGLE, the acceleration process of the aircraft is not linear, resulting in continuous changes in the direction of speed. Consequently, this may cause the aircraft to fly in a curved trajectory. -
We tested with RollPitchControlMode set to VELOCITY - we still get a curve, but this time the curve is reversed (on the other side of the line)
virtualStickFlightControlParam.setVerticalControlMode(VerticalControlMode.POSITION);
virtualStickFlightControlParam.setYawControlMode(YawControlMode.ANGLE);
virtualStickFlightControlParam.setRollPitchControlMode(RollPitchControlMode.VELOCITY);
virtualStickFlightControlParam.setRollPitchCoordinateSystem(FlightCoordinateSystem.GROUND);
double xVelocity = Math.sin(angle);
double yVelocity = Math.cos(angle);
virtualStickFlightControlParam.setPitch(xVelocity*ROLL_PITCH_CONTROL_MAX_VELOCITY);
virtualStickFlightControlParam.setRoll(yVelocity*ROLL_PITCH_CONTROL_MAX_VELOCITY);Again, we calculate the angle and send those params 10 times a second.
-
-
Please upload at https://pan-sec.djicorp.com/s/cza2wE7m5ZrnHdM
Please sign in to leave a comment.
Comments
11 comments