I have a Pixhwak running ArduPlane 3.7 on a Multiplex Easystar. The flight controller is tuned good enough, that the CRUISE mode works very well. There is no airspeed sensor.
Now, I put the flight controller in GUIDED mode and am sending continously the following MAVLink packets from a companion computer:
NewMissionItem.TargetSystem = PeerSystemId;
NewMissionItem.TargetComponent = 0;
NewMissionItem.Seq = 0;
NewMissionItem.Frame = MavFrame.Global;
NewMissionItem.Command = MavCmd.NavWaypoint;
NewMissionItem.Current = 2; // Guided waypoint
NewMissionItem.Autocontinue = 0;
NewMissionItem.Param1 = 0.0f;
NewMissionItem.Param2 = 0.0f;
NewMissionItem.Param3 = 0.0f;
NewMissionItem.Param4 = 0.0f;
NewMissionItem.X = targetLatitude;
NewMissionItem.Y = targetLongitude;
NewMissionItem.Z = currentAltitudeAtBeginingOfGUIDED; // Constant value
And, additionally,these packets:
UasCommandLong NewSpd = new UasCommandLong();
NewSpd.TargetSystem = PeerSystemId;
NewSpd.TargetComponent = 0;
NewSpd.Confirmation = 0;
NewSpd.Command = MavCmd.DoChangeSpeed;
NewSpd.Param1 = 0.0f;
NewSpd.Param2 = 0.0f;
NewSpd.Param3 = 60.0f; // Percentage throttle
The issue I am facing:
The result is, that the constant altitude is not kept as requested. Typically it is steadily raising, though in one case it was also decreasing. For more details please see the logfiles here:
Am I sending MAVLink packets wrongly? Why is the altitude not kept as requested in the MISSION_ITEM?
The thing I want to accomplish, is basically commanding the track over ground, the vertical speed and the forward speed. If the above approach is the wrong one to achieve that, how else could it be done? Alternative approaches could be:
- "Manage" the next waypoint and fly AUTO mode
- RC override and fly CRUISE mode
If the GUIDED approach is not feasible (or at least not reliably), I am tempted to try the RC override approach. "Setting" vertical speed and bank angle is very close to what I want to accomplish. This is what I do with my RC transmitter in CRUISE mode, and it works really nicely. It seems the input channel (= interface), that is used by the human pilot, is also the easiest to use by a companion computer.
But - Is there really no better approach to dictate the basic flight path parameters using MAVLink? E.g. I am absolutely not sure, whether even a target climb speed can be set at all using the GUIDED approach.
Any help would be appreciated...