harfang3d / dogfight-sandbox-hg2

Air to air combat sandbox, created in Python 3 using the HARFANG 3D 2 framework.
GNU General Public License v3.0
153 stars 47 forks source link

About the Meaning of parameters #39

Open muzhizhao opened 1 year ago

muzhizhao commented 1 year ago

I've just had problems reading the code and am having trouble understanding the following parameters: 1.Aircraft.v_move and get_planestate(plane_id)["move_vector"] 2.Plane_Euler= [plane_state["Euler_angles"][0] / NormStates["Plane_Euler_angles"], plane_state["Euler_angles"][1] / NormStates["Plane_Euler_angles"], plane_state["Euler_angles"][2] / NormStates["Plane_Euler_angles"]] 3.Plane_Pitch_Att = plane_state["pitch_attitude"] / NormStates["Plane_pitch_attitude"] Plane_Roll_Att = plane_state["roll_attitude"] / NormStates["Plane_roll_attitude"] Plane_Hor_Speed = plane_state["horizontal_speed"] / NormStates["Plane_horizontal_speed"]

muzhizhao commented 1 year ago

Is the horizontal velocity on the x-axis? Is the vertical velocity on the y-axis?

ErkMkd commented 1 year ago

Hi !

  1. v_move is the instant velocity vector. It's linear and in meter per second.
  2. Euler angles are the angles of the 3 references axes X, Y, Z of the aircraft in the world. They are used to compute the matrices. https://en.wikipedia.org/wiki/Euler_angles
  3. Pitch attitude is the angle of inclination of the aircraft relative to the ground plane. (e.g. pitch = 15°: The aircraft's nose is pointed at 15° to the sky) Roll attitude is the angle of the plane relative to the horizon axis. In other words, it is the angle that determines whether the aircraft leans to the right or to the left. Plane Horizontal Speed is the speed of the aircraft on its projected ground track.
ErkMkd commented 1 year ago

"Is the horizontal velocity on the x-axis? Is the vertical velocity on the y-axis?" This is an very good question ! Physicians reference is not the same as 3d graphicians reference. Look: X axis is Red one, Y is Green one, and Z is Blue: image

ErkMkd commented 1 year ago

So, Pitch attitude is the angle between Z axis and ground plane,
https://github.com/harfang3d/dogfight-sandbox-hg2/blob/main/source/Machines.py#L663 Roll attitude is the angle between X axis and ground plane. https://github.com/harfang3d/dogfight-sandbox-hg2/blob/main/source/Machines.py#L670