Giter Site home page Giter Site logo

jimmmy0 / bvrgym Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xcwoid/bvrgym

0.0 0.0 0.0 40.06 MB

License: GNU General Public License v3.0

Shell 0.13% C++ 68.46% Python 12.58% C 7.70% PHP 2.21% Objective-C 2.76% Julia 0.04% XSLT 3.08% HTML 1.74% CMake 1.13% Cython 0.17%

bvrgym's Introduction

BVRGym

Description

This library is heavily based on JSBSim software (https://github.com/JSBSim-Team/jsbsim). This library's primary purpose is to allow users to explore Beyond Visual Range (BVR) tactics using Reinforcement learning.

me

Environment

The environments above mainly use the F16 flight dynamics and BVR missile models. The F16 model has an additional wrapper to control simply, while the BVR missile has a Proportional Navigation guidance law implemented to guide it toward the target. The following commands are equivalent, but they run the process in parallel to speed up convergence. Currently, there are three available environments:

Evading one missile

Single CPU or multiple CPUs:

python mainBVRGym.py -track t1 -seed 1

python mainBVRGym_MultiCore.py -track M1 -cpus 8 -Eps 100000 -eps 3

Evading two missile

python mainBVRGym.py -track t2 -seed 1

python mainBVRGym_MultiCore.py -track M2 -cpus 8 -Eps 100000 -eps 3

BVR air combat

python mainBVRGym.py -track dog

python mainBVRGym_MultiCore.py -track Dog -cpus 10 -Eps 10000 -eps 1

At the beginning of the training, we see that the Red aircraft effectively shoots down the agent with its first missile (aim1r) but later starts using the second missile as well (aimr2). As the training progresses, the agent starts to utilize their own missiles (aim1) and (aim2), and the running reward illustrates that the agent slowly improves its behavior towards defeating the enemy. Running on 10 CPUs it take less than 4 hours to generate these results.

me

Requirments

The following libraries are required to run BVRGym. The code has been tested with Python 3.9

pip install jsbsim geopy pyproj pymap3d torch tensorboard py_trees

Getting started

To plot Aircraft and Missile behavior

python mainBVRGym.py -track f1 -head 0.0 -alt -1.0 -thr 1.0

Configuration files

BVR air combat is a relatively complex environment with a large number of variable and non-linear dynamics. To change the behavior of the environment, you can modify the configuration files for the corresponding unit or the environment itself.

Environment: jsb_gym/environments/config

Tactical Units: jsb_gym/TAU/config

Additional details

Additional details can be found in the following article

BVR Gym: A Reinforcement Learning Environment for Beyond-Visual-Range Air Combat

https://arxiv.org/abs/2403.17533

FlightGear

FlightGear offers an excellent tool for visualizing the units present in BVR Gym. To install FlightGear (Tested on Ubuntu 20.04.6 LTS)

sudo add-apt-repository ppa:saiarcot895/flightgear

sudo apt update

More details on https://launchpad.net/~saiarcot895/+archive/ubuntu/flightgear

In the FlightGear aircraft directory (~ /.fgfs/Aircraft/org.flightgear.fgaddon.stable_2020/Aircraft), you should have the f16 model already present, but not the missile. To have a missile model as well, copy the ogel folder from this repo (fg/ogel) to the Flightgears aircraft directory. To visualize missile in Flightgear, I used the ogel (1) model within the fgfs, replaced the grapical representations of the ogel with a missile that was available in fgfs (I think it was from (2)) and added a trail from santa claus (3) to see the trajectory.

  1. https://wiki.flightgear.org/Ogel

  2. https://forum.flightgear.org/viewtopic.php?t=19930#p183249

  3. https://wiki.flightgear.org/Santa_Claus

Given that you have both the f16 and ogel directories in the fgfs directory, you can run the following commands to visualize both units.

terminal 1: fgfs --fdm=null --native-fdm=socket,in,60,,5550,udp --aircraft=f16-block-52 --airport=ESSA --multiplay=out,10,127.0.0.1,5000 --multiplay=in,10,127.0.0.1,5001

terminal 2: fgfs --fdm=null --native-fdm=socket,in,60,,5551,udp --aircraft=ogel --airport=ESSA --multiplay=out,10,127.0.0.1,5001 --multiplay=in,10,127.0.0.1,5000

And run an example:

terminal 3: python mainBVRGym.py -track f1 -head 0.0 -alt -1.0 -thr 1.0 -v

In Flightgear, you can use "v" to change view-point, "x" to zoom in, "ctrl + x" to zoom out

Finally, you should be able to see something like this:

me

bvrgym's People

Contributors

xcwoid avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.