Aircraft control policy
State Variable
Intuitive
- Aircraft
- Rotation (in euler angle: x,y,z)
- Position (In the world coordinate system:x,y,z)
- Linear velocity (In the world coordinate system: x,y,z)
- Angular velocity (In the world coordinate system: x,y,z)
- Acceleration (In the world coordinate system:x,y,z)
- Carrier Vessel Landing Runway
- Position
- Rotation (fixed)
- Velocity (fixed)
Extensive
- Aircraft
- AoA (angle of attack 攻角)
Decision Variable
- Aircraft
- Pitch angle (control aircraft’s rotation along x axis)
- Roll angle (control aircraft’s rotation along z axis)
- Yaw angle (control aircraft’s rotation along y axis)
- Throttle (control thrust)
Level 1 (Basic) Policy
Only contain the control over control surface (on control over throttle)
Attitude Control/Maintainance
Pitch(俯仰角) C/M
Function: KeepPitch()
Control the angle of horizontal tail (elevator)
First keep the angle of elevator same with AoA(攻角), to avoid the disturbance of the horizontal tail on the attitide of the aircraft.
1
aircraft.PitchAngle = aircraft.AoA;
这里的aircraft.PitchAngle指的是飞机升降舵的角度(下片为正)
根据当前俯仰角,俯仰速度,和目标俯仰角,调整升降舵面的角度
1
aircraft.PitchAngle += 5 * (p - aircraft.Pitch) / Mathf.Exp(10 * aircraft.PitchSpeed * Mathf.Sign(p - aircraft.Pitch));
Other Attitude C/M
与俯仰角类似(分别控制滚转舵面以及偏航舵面),不过不需要第一步
Level 2 Policy
Velocity Direction Control/Maintainance
Gliding Angle (下滑角)
Control the thrust of aircraft to change the angle of gliding
保持飞机的俯仰角不变(5度仰角)
1
KeepPitch(5f);
计算当前下滑角
1
float velAngle = 90 - Vector3.Angle(aircraft.rb.velocity, Vector3.up);
根据下滑角更改油门大小
1
aircraft.Thrust += (p - velAngle)/500f;
Level 3 Policy
Follow Trajectory
Vertical Approaching (竖直平面上接近预定下滑道)
通过调整飞机的下滑角来使飞机在竖直面上接近并维持在理想的下滑道
- 计算偏差对应的向量
1
Vector3 approachDirection = Vector3.ProjectOnPlane(route.Destination - transform.position, route.direction);
- 根据偏差值调整下滑角的大小(-3为目标下滑轨道的下滑角)
1
ThrustKeepGliding(-3 + Mathf.Clamp(approachDirection.y / 10f, -5,5));
Horizontal Approaching (水平面上接近预定下滑道)
通过调整飞机的偏航舵面角度(进而影响飞机的y轴rotation)来使飞机在水平面上接近并维持在理想的航道上
- 计算偏差对应的向量
1
2
3
4
5
6
7
8
9
10
11Vector3 approachDirection = Vector3.ProjectOnPlane(route.Destination - transform.position, route.direction);
float distance = 0;
if (Vector3.Angle(approachDirection, transform.right) < 90)
{
distance = Vector3.ProjectOnPlane(approachDirection, Vector3.up).magnitude;
}
else
{
distance = -Vector3.ProjectOnPlane(approachDirection, Vector3.up).magnitude;
} - 根据偏差值调整飞机的目标偏航角度(-8为目标下滑轨道的偏航角度)
1
KeepYaw(-8 + Mathf.Clamp(distance / 10f, -50, 50));
Get the ideal trajectory(补充)
基本的策略以及阐述完毕,那么所谓的理想下滑道到底应该怎么得到呢?
理想下滑道是一个射线,包含一个终点(飞机着陆的终点)和一个方向(飞机接近的方向)
1 | public class Target_Route |
理想航道的偏航角和下滑角已知(分别为-8(平行于着陆跑道)和-3)
通过迭代飞机着陆所需时间来求得下滑道终点的位置
1 | route.Destination = CV.transform.position; |