Context
I need to get the current speed of the aircraft.
Efforts
Looking at the documentation, I can see that exists the method WaypointMissionOperator.getAutoFlightSpeed which gives me that info.
Problem
While implementing the code, this method was missing. Was it moved, renamed or something?
Environment
Have a look at the FlightControllerState
class, it contains the current status of pretty much all of the aircraft components.
Specifically, you should look at FlightController.setStateCallback()
. This returns current information, specifically you want to use getVelocityX
, getVelocityY
and getVelocityZ
.
There are also keys for each, the documentation gives the details.
Having X, Y and Z velocities, the speed can be computed in this way:
final speed = sqrt(pow(velocity.x, 2) + pow(velocity.y, 2) + pow(velocity.z, 2));