GithubHelp home page GithubHelp logo

harfang3d / dogfight-sandbox-hg2 Goto Github PK

View Code? Open in Web Editor NEW
136.0 8.0 41.0 468.27 MB

Air to air combat sandbox, created in Python 3 using the HARFANG 3D 2 framework.

License: GNU General Public License v3.0

Python 73.25% Scala 12.08% SuperCollider 2.53% Shell 12.13% Batchfile 0.02%
simulation python 3d flight-simulator pbr autopilot network harfang3d opengl game

dogfight-sandbox-hg2's People

Contributors

aksoym avatar astrofra avatar disketflu avatar erkmkd avatar muraatozbek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dogfight-sandbox-hg2's Issues

New to Harfang. JSBSim integration.

Can we integrate open-source dynamics like JSBSim to Harfang flight models. And also how to include support for HOTAS, rudder and throttle too.

Connection reset by peer in RL training process

Hello, there is a reset error as follow:
socket_lib.py", line 91, in send_message sock.sendall(sizeb + message)
ConnectionResetError: [Errno 104] Connection reset by peer

Can you help me?

<WindowSystemInit> returned a result with an error set in ubuntu20.04

When I pip install harfang-.....-linux_x86_64.whl (import harfang is ok )and then run python main.py in the dogfight.../source, there is a error as follow:Compiling assets...
99%|█████████████████████████████████████████▌| 99/100 [25:30<00:15, 15.46s/it]
Assertion failed (ret == GLFW_TRUE)
Reason: Failed to initialize window system
RuntimeError: X11: The DISPLAY environment variable is missing

About the network mode

In network mode, I'm trying to get two planes to start a dogfight and I can attack the enemy plane by doing "df.activate_IA", but how do I do it to get my plane to attack? It seems to only fly in circles

Help!

Hello, I am currently conducting scientific research and development based on your software. I would like to ask what algorithm is the flight combat strategy of the enemy aircraft in this software based on?

HELP

I'm sorry to bother you, but I currently want to use this dogfighting software as a simulation environment to verify the reliability of some flight algorithms. How should I control the aircraft through flight data and what data do I need to control?

About citations

Hi!
I had some problems reading your citation "HARFANG3D DOG-FIGHT SANDBOX: A REINFORCEMENT LEARNING RESEARCH PLATFORM FOR THE CUSTOMIZED CONTROL TASKS OF FIGHTER AIRCRAFTS". I contacted you by email and did not get a reply.
Due to a lack of expertise and experience, we could not achieve the results shown in your paper. I would like to ask if I can get the source code and algorithm for the experimental part of the article
l am looking forward to your reply as soon as possible!

How to realize multi-process?

Multi-process and multiple doglight simulation starts are not feasible, because even if multiple dogEnv instances are created, they all import the same client, that is, the data received and sent from the same doglight simulation platform. How to realize multi-process?

Does not work when compiled via PyInstaller

Run exe output:
`(0:051:583:200) Harfang core 1.2.0 (build 1538b3acd3c9351b7b9108742a5f352c98b78e5d Feb 7 2019 09:51:22)
(0:056:555:200) See http://harfang3d.com/license for licensing terms
(0:204:585:600) Load plugins from 4 default paths
(0:206:580:300) Scanning for plugin in 'c:/Users/User/'...
(0:211:050:000) error: LoadSharedLibrary('sfextra.dll') failed, reason: %1 is not a valid Win32 application.

(0:215:589:600) 0 plugin(s) loaded
(0:217:320:100) Scanning for plugin in 'c:/Users/User/AppData/Local/Temp/_MEI184562/base_library.zip/harfang/'...
(0:222:930:200) 0 plugin(s) loaded
(0:224:276:900) Scanning for plugin in 'c:/Users/User/AppData/Local/Temp/_MEI184562/lib-dynload/harfang/'...
(0:229:429:900) 0 plugin(s) loaded
(0:231:235:200) Scanning for plugin in 'c:/Users/User/AppData/Local/Temp/_MEI184562/harfang/'...
(0:236:044:700) 0 plugin(s) loaded
(0:238:165:200) 0 plugin(s) loaded
(0:240:725:100) Mount root driver 000002236AEAE4B0 (relative to '')
(0:256:356:600) warn: No renderer available, was LoadPlugins called successfully?
Traceback (most recent call last):
File "flight_sim.py", line 4232, in
File "flight_sim.py", line 2575, in request_screen_mode
RuntimeError: RenderInit failed, was LoadPlugins called succesfully?`

How can I run multiple dogfight windows?

Hello, I would like to conduct parallel testing in multiple environments, but I cannot find where to modify the IP address. Can you please tell me how to operate so that I can run multiple dogfight windows with different IP addresses on a single computer?

The problem of kinematic model of aircraft

Hello, I am sorry that I am not a major in aerospace and know little about aerodynamics of aircraft, so it is difficult for me to understand the kinematics model of aircraft in your code, such as the ‘matrix’ of update_physics function. Could you please give me some relevant reference materials to help me understand the specific aircraft kinematic model?

Question: position information is abnormal in network mode

Description: Giving the autopilot "0" heading command, the position obtained by the "get_plane_state" function is abnormal. Theoretically, the position "y" should increase and "x" remains unchanged (or small change). But the result is they are both changed after a period of time. As shown:
111
Thanks for your help!

Question about rendering with client sample

Hi!

First of all, thank you for your great effort in the field of dogfight simulations and build this wonderful platform.

I have problems using "Network mode" with client_*.py code. I made a screen record, but the video is too big to be uploaded on Github, so I upload it on OneDrive. You could download it in the link below.

https://1drv.ms/u/s!AjYxuXuKCgSEvjGBt1HkUVXPusP-?e=cRpGYp

In this trial, the rendering couldn't be played correctly while the program and even the sound works well. When I tried to run client_sample.py, the rendering will play after the program is finished. So did the client_sample_missile_custom_phisics.py.

Besides, just a small suggestion. The IP and port displayed in the top-left corner of the screen would be hidden if the sandbox windows was in different size, along with health, bullets, etc.

I'm using Windows 10 Home edition,
CPU: Intel Core i7 11700
RAM: DDR4 32GBytes
GPU: NVIDIA GeForce RTX 3070

Question about the kinematic model of the aircraft

May I ask where I can see the kinematic equations of the aircraft, that is, the equations for updating parameters such as position and speed. I have been searching for a long time in the code but have not found it.

About multiple dogfight-sandboxes

Hi,
I am working on a reinforcement learning project using the Harfang platform and I would like to ask how to enable multiple dogfight-sandboxes in network mode to achieve parallel training?

How can I make it work without graphical display on docker or server, just like StarCraft

Because I want to train them on the server, but both the local machine and the server are ubuntu18.04, so I created a container of ubuntu20.04 with the docker, and installed harfang and doglight in it. But because the docker and the server can not be displayed graphically, the error occurred in running main.py: window_init error. And, it cannot work when I set "OpenGL": true in config.json. Therefore, how can I make it work without graphical display, just like StarCraft

About the IA mode

Dear author:
I’m interested in how does the IA mode work?I'm curious about how did you train the agent to become “intelligent agent”?Which algorithm did you use?

node error

hope you have a good day, and thanks for your great package
when i'm trying to run the game in python 3.10.3 and harfang newest version i get this error , is there anyone who knows about the problem?

e:\dogfight-sandbox-hg2-main\dogfight-sandbox-hg2-main\source\Machines.py:135: Warning: Invalid node
  nm = nd.GetName()

and another error when loading fps_start_point , i changed nothing by the way

About the Meaning of parameters

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"]

About Multiagent Dogfight

Hey,I'm interested in Multiagent Dogfight,I'd appreciate it if you can share me the code of the multiagent-agent reinforcement learning.

The missiles fail to hit the target.

I apologize for my unfamiliarity with GitHub, as I accidentally deleted the previous issue. Allow me to restate the problem I encountered and the temporary solution:

While configuring dogfight on the new workstation, I encountered an issue. When the target device locks onto the opponent and the missile device launches the missiles, they consistently deviate from the target and continue to circle around it, even when the opponent is flying at a constant speed without any turns. However, when I configured it on my desktop computer and personal laptop, it worked properly. You can find a video showcasing the issue below:

20230608-105405.mp4

My temporary solution was to modify the "angular_frictions" value in the missile parameters
https://github.com/ErkMkd/dogfight-sandbox-hg2/blob/69815f4804b87bf0ca250d2f49d371c6c9fc4dbd/source/missile_aim_sl.py#LL21C7-L21C7
and, as a result, I had to increase the value of "target_collision_test_distance_max"
https://github.com/ErkMkd/dogfight-sandbox-hg2/blob/69815f4804b87bf0ca250d2f49d371c6c9fc4dbd/source/Machines.py#LL876C54-L876C54
to resolve the issue.
Thanks for the previous responses from @astrofra and @ErkMkd .

I have a question about the client update mode, help!

When performing reinforcement learning on an aircraft, it is common to turn on renderless mode to speed up training, which is the following code:
df.set_renderless_mode(True)
May I ask if the following code can be used to turn off the client update mode during reinforcement learning training?df.set_client_update_mode(False)
Does this affect my training results?

The Socket Client Receive the Nonetype Date

I'm getting an error when using your latest version of network_client_example.
The terminal printout shows that my client's socket received a new error while decoding. The client's socket received the None which cannot be decoded.I would like to know the reason for this problem. Thank for your helping.

A fatal error occurred when I tried to open dogfight

The python environment I'm using is the anaconda virtual environment, and the following error occurs when I open dogfight:
If I open it through the source main file it shows:
Harfang 3.2.4 for CPython 3.2+ on windows-x64 (build 2002087e407e25dcd76a597f4b180bb6c82a5332 Sep 19 2022 14:31:06)
See https://www.harfang3d.com/license for licensing terms
Compiling assets...
0%| | 0/100 [00:00<?, ?it/s]Traceback (most recent call last):
File "D:\Users\14290\Desktop\dogfight-sandbox-hg2-main\source\main.py", line 66, in
dc.run_command("../bin/assetc/assetc assets -api GL -quiet -progress")
File "D:\Users\14290\Desktop\dogfight-sandbox-hg2-main\source\data_converter.py", line 79, in run_command
for line in execute_com(exe):
File "D:\Users\14290\Desktop\dogfight-sandbox-hg2-main\source\data_converter.py", line 74, in execute_com
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
File "D:\ANACONDA\envs\harfang2\lib\subprocess.py", line 947, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "D:\ANACONDA\envs\harfang2\lib\subprocess.py", line 1416, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the specified file。
0%| | 0/100 [00:00<?, ?it/s]

If I open it through the start.bat it shows:
d:\Users\14290\Desktop\dogfight-sandbox-hg2-main>cd source

d:\Users\14290\Desktop\dogfight-sandbox-hg2-main\source>..\bin\python\python.exe main.py
'..\bin\python\python.exe' Not an internal or external command, not a runnable program
or a batch file

d:\Users\14290\Desktop\dogfight-sandbox-hg2-main\source>pause

FileNotFoundError: ..\\bin\\assetc\\assetc.exe assets -quiet -progress'

When I run the main.py file it gives the following error:

Compiling assets...
0%|          | 0/100 [00:00<?, ?it/s]Traceback (most recent call last):
  File "/home/kadir/Desktop/kadirnar/github/dogfight-sandbox-hg2/source/main.py", line 32, in <module>
    dc.run_command("..\\bin\\assetc\\assetc.exe assets -quiet -progress")
  File "/home/kadir/Desktop/kadirnar/github/dogfight-sandbox-hg2/source/data_converter.py", line 79, in run_command
    for line in execute_com(exe):
  File "/home/kadir/Desktop/kadirnar/github/dogfight-sandbox-hg2/source/data_converter.py", line 74, in execute_com
    p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '..\\bin\\assetc\\assetc.exe assets -quiet -progress'
  0%|          | 0/100 [00:00<?, ?it/s]

What could be the cause of this error?

The missiles fail to hit the target.

Hello,

I encountered an issue while configuring the dogfight on the new workstation. When the target device locks onto the opponent and the missile device launches a missile, the missile consistently deviates from the target, continuously circling around it, even when the opponent is flying at a constant speed without any turns. However, when I configured it on my personal laptop, it worked fine.

I would like to inquire about the possible solutions to resolve this issue. Could it be related to the hardware configuration? The GPU on my device is Nvidia GeForce RTX 3090.

Thank you for your assistance in advance.

GLIBC_ 2.29 and ubuntu18.04

Hello, how is it compatible with ubuntu18.04 , because it needs to be upgraded to GLIBC_ 2.29, this is a very dangerous operation. Can you help me?

VR doesn't seem to work after v1.0.2

VR doesn't seem to work after v1.0.2 , issuing this error (in the latest build):

G:\works\harfang\hg2\dogfight-sandbox-hg2\source\MachineDevice.py:130: Warning: Invalid scene animation
  self.gear_anim_play = self.scene.PlayAnim(self.open_anim, hg.ALM_Once, hg.E_Linear, hg.time_from_sec_f(self.gear_moving_delay), hg.time_from_sec_f(self.gear_moving_delay), True, 1)
Traceback (most recent call last):
  File "G:\works\harfang\hg2\dogfight-sandbox-hg2\source\main.py", line 154, in <module>
    Main.update()
  File "G:\works\harfang\hg2\dogfight-sandbox-hg2\source\master.py", line 1557, in update
    cls.render_frame_vr()
  File "G:\works\harfang\hg2\dogfight-sandbox-hg2\source\master.py", line 1204, in render_frame_vr
    vid = cls.sea_render.render_vr(vid, cls.vr_state, vs_left, vs_right, output_fb_left, output_fb_right) #, tex_reflect_left_color, tex_reflect_left_depth, tex_reflect_right_color, tex_reflect_right_depth)
  File "G:\works\harfang\hg2\dogfight-sandbox-hg2\source\planet_render.py", line 374, in render_vr
    focal_distance_left = hg.ExtractZoomFactorFromProjectionMatrix(vs_left.proj)
RuntimeError: incorrect number of arguments to function ExtractZoomFactorFromProjectionMatrix

help

What does the position and rotation of the aircraft refer to?
I can currently obtain the quantitative information of the speed of the aircraft, but cannot obtain the speed vector information of the aircraft. How can I obtain it?

About citation

Hi! I wonder whether there is any paper about Dogfight 2 so that I could cite if I make use of this sandbox in my research? Or I can just cite this Github page? Thank you

The problem of IA mode

Hello, when we tested the IA mode of the aircraft, we found that when we were away from the enemy aircraft for a certain distance, the enemy aircraft did not seem to come close to us, just like the IA mode failed. What can I do to solve this problem?

is there linux support

I want to run this library on ubuntu. Is there Ubuntu support?

Error Message:

from .harfang import *
ImportError: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory

Question about customizing instances

Hi

I'm doing research about dogfighting between planes. I want to design some simple instances, such as a flare countermeasure, and add those to dogfight 2 environments. I wonder whether there is any manual of guidance. Thank you!

About the framework

Hello, is there some frameworks or flow charts for dogfight, can you provide it please?

Video playback with flight route

I have been looking for a Reinforcement Learning research platform for air combat maneuver generation for a long time, and it is very lucky to find your paper and platform. The platform is really amazing, and I will study your paper and projects carefully. I believe that I can do a lot of work through the platform.

When the combat is done, I want to see the combat process, so I think it would be better if there is a replay of the combat with flight route video playback.

In _get_reward() function,what's the mean of setting the reward about plane_heading and plane_heading2?

if self.plane_heading>180:
deger_1 = (self.plane_heading-360)
else:
deger_1 = self.plane_heading

    if self.plane_heading_2>180:
        deger_2 = (self.plane_heading_2-360)
    else:
        deger_2 = self.plane_heading_2
    self.reward -= abs(deger_1-deger_2)/90

I don't know what's the meaning of this reward setting.
I don't know what's the meaning of this code.
What do these equations mean?
Thank you very much for your reply!

About multi-uav confrontation

Hello, I would like to ask if the environment can only support up to 4 drones? Is there a function of adding fighter jets to study the application of multi-agent reinforcement learning in air combat?

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.