Aircraft rotations in an external program #542
Replies: 2 comments 2 replies
-
You can't retrieve the quaternion via the property tree. jsbsim/src/models/FGPropagate.cpp Lines 873 to 883 in 1095804 P.S The following are equivalent ways of accessing the property tree. theta_deg = self.fdm.get_property_value("attitude/theta-deg")
theta_deg = self.fdm["attitude/theta-deg"] There is a Lines 105 to 137 in 1095804 Which returns the matrix jsbsim/src/models/FGPropagate.cpp Line 680 in 1095804 With the following implementation:
jsbsim/src/math/FGMatrix33.cpp Lines 106 to 153 in 1095804 |
Beta Was this translation helpful? Give feedback.
-
@sr71684, I'd suggest to check if Unity is expecting the transformation from the body frame to the local frame or the transformation from the local frame to the body frame. These transformations are the inverse of each another and so are their matrices and quaternions so the difference matters. Also may be you could check that Finally, I'm a bit surprised by your statement
The pitch angle should never be higher than 90 degrees in absolute value. |
Beta Was this translation helpful? Give feedback.
-
Greetings,
I am building a 3D visualisation tool for JSBSim in Unity.
I am having trouble rendering aircraft rotation in Unity.
So far, I can access the Euler angles describing rotation on the JSBSim side:
Naievely plugging
theta_deg
,psi_deg
, andphi_deg
into Unity (as shown below) causes incorrect rotation.when the pitch angle is >90 or < -90.I know The order of rotations used in JSBSim is a 3-2-1 sequence or Y-P-R, or Z-Y-X.
However, the Unity documentation on Euler angles says rotations are performed around the Z axis, the X axis, and the Y axis, in that order.
Question 1: How can I convert JSBSim Euler angles to Unity Euler angles?
I tried using quaternions to fix this issue. I used SciPy to derive a quaternion
and plugged that into Unity like this:
but the same broken behaviour resulted.
Question 2: Is it possible to read JSBSim's aircraft quaternion from python?**
Beta Was this translation helpful? Give feedback.
All reactions