An environment based on JSBSIM aimed at one-to-one close air combat.
# create python env
conda create -n jsbsim python=3.8
# install pytorch
conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge
# install dependency
pip install pymap3d jsbsim==1.1.6 geographiclib gym wandb icecream setproctitle matplotlib
-
Download Shapely‑1.7.1‑cp38‑cp38‑win_amd64.whl from here, and
pip install shaply
from local file. -
Initialize submodules(JSBSim-Team/jsbsim):
git submodule init; git submodule update
惯性坐标系下,导弹运动学方程为: $$ \begin{cases}
\dot{x}(t)=v(t)\cos{\theta(t)}\cos{\varphi(t)} \
\dot{y}(t)=v(t)\cos{\theta(t)}\sin{\varphi(t)} \
\dot{z}(t)=v(t)\sin{\theta(t)}
\end{cases} $$
式中,$(x,y,z)$为导弹在惯性坐标系下的坐标;$(v,\theta,\varphi)$为导弹的速度,航迹俯仰角和航迹偏航角,均为飞行时间
对于导弹的计算面积$S$,其大小近似满足: $$ S = \pi(\frac{d}{2})^2+(\sin^2(\Delta\theta)+\sin^2(\Delta\varphi))dL $$ 式中,$d$为导弹直径,$L$为导弹半径,$\Delta\theta,\Delta\varphi$为导弹姿态和航迹在俯仰角、偏航角上的差值,可近似认为是航迹俯仰角、偏航角$\theta,\varphi$在$\Delta t$时间内的变化量,即$\Delta\theta=\dot{\theta}\Delta t, \Delta\varphi=\dot{\varphi}\Delta t$。
导弹导引采用比例导引律。假设在相互垂直的两个控制平面内导引系数均为$K=3$,偏航和俯仰方向的两个侧向控制过载定义为:
$$ \begin{cases} n_{y}=\frac{Kv}{g}\cos{\theta}\dot{\beta} \ n_{z}=\frac{Kv}{g}\dot{\varepsilon}+\cos{\theta} \end{cases} $$ 式中,$\beta,\varepsilon$分别为视线偏角与视线倾角,$\dot{\beta},\dot{\varepsilon}$分别为视线偏角和视线倾角随时间变化的导数。 $$ \begin{cases} \beta=arctan(r_y/r_x) \ \varepsilon=arctan(r_z/\sqrt{r_x^2+r_y^2}) \end{cases} $$ 视线矢量即为距离矢量$\vec{r}$,有$r_x=x_t-x_m,r_y=y_t-y_m,r_z=z_t-z_m$,$x_t,y_t,z_t$为目标机位置,模值定义为$R=\sqrt{r_x^2+r_y^2+r_z^2}$。视线偏角和视线倾角及其随时间的导数公式定义为: