Problem is for Roll, Pitch, Yaw angles estimated in FW mode (after the transition).
- They don’t match the setpoints. PX is not trying to catch the setpoints according to logs, that means that the angles inside PX are calculated differently.
- They are not what we observed in reality. When the flight is horizontal and pitch is -45° that just can’t be true. Roll and Yaw are less obvious, but they don’t match also.
Here are our logs that show the inconsistence:
https://logs.px4.io/plot_app?log=a5aac0ad-2acc-447f-922f-a20f36eae74a
https://logs.px4.io/plot_app?log=e04721a9-d9f8-4fb6-9494-74f060d2b8b7
https://logs.px4.io/plot_app?log=ece418ed-ae74-4525-ad3e-95f992696b2e
Also I found a log for other tailsitter here on this forum that shows the same problem:
https://logs.px4.io/plot_app?log=5b0a9781-4648-41d9-bd04-e246819571ea
We have calculated a transformation to get real angles (python):
import numpy as np
from helper import get_log, plotting, at_times
from scipy.spatial.transform import Rotation as R
def tailsitter_adapt(R: np.ndarray):
r = np.zeros_like(R)
r[:, :, 0] = -R[:, :, 2]
r[:, :, 2] = R[:, :, 0]
r[:, :, 1] = R[:, :, 1]
return r
def rpy_to_fw(roll, pitch, yaw):
angles = np.array([roll, pitch, yaw]).T
mat = R.from_euler("xyz", angles).as_matrix()
mat_fw = tailsitter_adapt(mat)
rpy_fw = R.from_matrix(mat_fw).as_euler("xyz")
r = rpy_fw[:, 0]
p = rpy_fw[:, 1]
y = rpy_fw[:, 2]
return r, p, y
log = get_log("https://logs.px4.io/plot_app?log=ece418ed-ae74-4525-ad3e-95f992696b2e")
v_att = log.topic("vehicle_attitude").data
roll_fw, pitch_fw, yaw_fw = rpy_to_fw(v_att["roll"], v_att["pitch"], v_att["yaw"])
Can you please fix the angles in Flight Review for tailsitters?