liuqh16 / LAG

An environment based on JSBSIM aimed at one-to-one close air combat.
GNU General Public License v3.0
293 stars 95 forks source link

关于源码运行报错 #20

Open suchenjm opened 1 year ago

suchenjm commented 1 year ago

请问运行python envs/JSBSim/test/test_baseline_use_env.py语句时,报如下错误: JSBSim startup beginning ...

Could not open file: Path "E:/code/python_execise/CloseAirCombat-master/CloseAirCombat-master/envs/JSBSim/utils/../data/aircraft/f16/f16.xml" JSBSim failed to open the configuration file: Path "E:/code/python_execise/CloseAirCombat-master/CloseAirCombat-master/envs/JSBSim/utils/../data/aircraft/f16/f16.xml" Traceback (most recent call last): File "E:\code\python_execise\CloseAirCombat-master\CloseAirCombat-master\envs\JSBSim\test\test_baseline_use_env.py", line 163, in test_maneuver() File "E:\code\python_execise\CloseAirCombat-master\CloseAirCombat-master\envs\JSBSim\test\test_baseline_use_env.py", line 142, in test_maneuver env = SingleCombatEnv(config_name='1v1/NoWeapon/test/opposite') File "E:\code\python_execise\CloseAirCombat-master\CloseAirCombat-master\envs\JSBSim\envs\singlecombat_env.py", line 12, in init super().init(config_name) File "E:\code\python_execise\CloseAirCombat-master\CloseAirCombat-master\envs\JSBSim\envs\env_base.py", line 31, in init self.load() File "E:\code\python_execise\CloseAirCombat-master\CloseAirCombat-master\envs\JSBSim\envs\env_base.py", line 55, in load self.load_simulator() File "E:\code\python_execise\CloseAirCombat-master\CloseAirCombat-master\envs\JSBSim\envs\env_base.py", line 64, in load_simulator self._jsbsims[uid] = AircraftSimulator( File "E:\code\python_execise\CloseAirCombat-master\CloseAirCombat-master\envs\JSBSim\core\simulatior.py", line 132, in init self.reload() File "E:\code\python_execise\CloseAirCombat-master\CloseAirCombat-master\envs\JSBSim\core\simulatior.py", line 168, in reload Catalog.add_jsbsim_props(self.jsbsim_exec.query_property_catalog("")) File "E:\code\python_execise\CloseAirCombat-master\CloseAirCombat-master\envs\JSBSim\core\catalog.py", line 553, in add_jsbsim_props [name_jsbsim, access] = jsbsim_prop.split(" ") ValueError: not enough values to unpack (expected 2, got 1)

SJTUwbl commented 1 year ago

jsbsim版本太高了,换乘1.1.8试试

suchenjm commented 1 year ago

感谢回复! 请问这个必须在linux下运行吗,可以在windows下吗。如果想在windows系统下,.sh文件应该如何修改

Jin58857 commented 1 year ago

可以在windows下运行,.sh文件可以通过pycharm运行

suchenjm commented 1 year ago

感谢回复! 那关于在windows下运行>bash train_.sh,报错找不到wandb包: (jsbsim) E:\code\pythonexecise\CloseAirCombat\CloseAirCombat-master\scripts>bash train.sh env is SingleControl, scenario is 1/heading, algo is ppo, exp is v1, seed is 5 Traceback (most recent call last): File "train/train_jsbsim.py", line 5, in import wandb ModuleNotFoundError: No module named 'wandb' 但其实已安装这包,且在python下可以使用:

(jsbsim) E:\code\python_execise\CloseAirCombat\CloseAirCombat-master\scripts>python Python 3.8.18 (default, Sep 11 2023, 13:39:12) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32 Type "help", "copyright", "credits" or "license" for more information.

import wandb

安装wandb包时显示: (jsbsim) E:\code\python_execise\CloseAirCombat\CloseAirCombat-master\scripts>pip install wandb Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Requirement already satisfied: wandb in e:\anaconda\anaconda3\envs\jsbsim\lib\site-packages (0.16.0) Requirement already satisfied: Click!=8.0.0,>=7.1 in e:\anaconda\anaconda3\envs\jsbsim\lib\site-packages (from wandb) (8.1.7) Requirement already satisfied: GitPython!=3.1.29,>=1.0.0 in e:\anaconda\anaconda3\envs\jsbsim\lib\site-packages (from wandb) (3.1.40) Requirement already satisfied: requests<3,>=2.0.0 in e:\anaconda\anaconda3\envs\jsbsim\lib\site-packages (from wandb) (2.31.0) Requirement already satisfied: psutil>=5.0.0 in e:\anaconda\anaconda3\envs\jsbsim\lib\site-packages (from wandb) (5.9.6) Requirement already satisfied: sentry-sdk>=1.0.0 in e:\anaconda\anaconda3\envs\jsbsim\lib\site-packages (from wandb) (1.34.0) Requirement already satisfied: docker-pycreds>=0.4.0 in e:\anaconda\anaconda3\envs\jsbsim\lib\site-packages (from wandb) (0.4.0) Requirement already satisfied: PyYAML in e:\anaconda\anaconda3\envs\jsbsim\lib\site-packages (from wandb) (6.0.1)
Requirement already satisfied: setproctitle in e:\anaconda\anaconda3\envs\jsbsim\lib\site-packages (from wandb) (1.Requirement already satisfied: gitdb<5,>=4.0.1 in e:\anaconda\anaconda3\envs\jsbsim\lib\site-packages (from GitPython!=3.1.29,>=1.0.0->wandb) (4.0.11)Requirement already satisfied: charset-normalizer<4,>=2 in e:\anaconda\anaconda3\envs\jsbsim\lib\site-packages (from requests<3,>=2.0.0->wandb) (2.0.4)Requirement already satisfied: idna<4,>=2.5 in e:\anaconda\anaconda3\envs\jsbsim\lib\site-packages (from requests<3,>=2.0.0->wandb) (3.4)Requirement already satisfied: urllib3<3,>=1.21.1 in e:\anaconda\anaconda3\envs\jsbsim\lib\site-packages (from requests<3,>=2.0.0->wandb) (1.26.18)Requirement already satisfied: certifi>=2017.4.17 in e:\anaconda\anaconda3\envs\jsbsim\lib\site-packages (from requests<3,>=2.0.0->wandb) (2023.7.22)Requirement already satisfied: smmap<6,>=3.0.1 in e:\anaconda\anaconda3\envs\jsbsim\lib\site-packages (from gitdb<5,>=4.0.1->GitPython!=3.1.29,>=1.0.0->wandb) (5.0.1)

################################################################################## 在linux下运行没有上述问题,但在render时运行python render.py时报错: (jsbsim) sjm@LAPTOP-88HAV1UV:~/CloseAirCombat/CloseAirCombat-master/scripts/render$ python render.py Traceback (most recent call last): File "render_jsbsim.py", line 116, in main(sys.argv[1:]) File "render_jsbsim.py", line 54, in main assert all_args.model_dir is not None AssertionError

Heisenberg502 commented 7 months ago

包含了问题1,dada文件下没有F-16飞机参数文件,建议添加一个F-16的参数文件或者更改根目录到自己安装的JSBSim库下面自带的F-16飞机参数文件,如,

# load JSBSim FDM
        self.jsbsim_exec = jsbsim.FGFDMExec(root_dir='D:\\software\\anaconda\\Lib\\site-packages\\jsbsim')  # os.path.join(get_root_dir(), 'data')

问题2,应该是版本不同导致文本数据分割问题,仅保留有效属性就行

# Catalog.add_jsbsim_props(self.jsbsim_exec.query_property_catalog(""))
        jsbsim_props_raw = self.jsbsim_exec.query_property_catalog("")
        jsbsim_props_filtered = []
        for prop in jsbsim_props_raw.split('\n'):
            if " " in prop and "(" in prop and ")" in prop:  # Simple check for expected format "name_jsbsim (access)"
                jsbsim_props_filtered.append(prop)
        # Add only valid properties to the catalog
        Catalog.add_jsbsim_props(jsbsim_props_filtered)
Heisenberg502 commented 7 months ago

包含了问题1,dada文件下没有F-16飞机参数文件,建议添加一个F-16的参数文件或者更改根目录到自己安装的JSBSim库下面自带的F-16飞机参数文件,如,

# load JSBSim FDM
        self.jsbsim_exec = jsbsim.FGFDMExec(root_dir='D:\\software\\anaconda\\Lib\\site-packages\\jsbsim')  # os.path.join(get_root_dir(), 'data')

问题2,应该是版本不同导致文本数据分割问题,仅保留有效属性就行

# Catalog.add_jsbsim_props(self.jsbsim_exec.query_property_catalog(""))
        jsbsim_props_raw = self.jsbsim_exec.query_property_catalog("")
        jsbsim_props_filtered = []
        for prop in jsbsim_props_raw.split('\n'):
            if " " in prop and "(" in prop and ")" in prop:  # Simple check for expected format "name_jsbsim (access)"
                jsbsim_props_filtered.append(prop)
        # Add only valid properties to the catalog
        Catalog.add_jsbsim_props(jsbsim_props_filtered)
Pygyl commented 7 months ago

Traceback (most recent call last): File "render_2v2.py", line 3, in from envs.JSBSim.envs import SingleCombatEnv, SingleControlEnv, MultipleCombatEnv ModuleNotFoundError: No module named 'envs' (jsbsim) root@dell-PowerEdge-R730:/home/dell/gyl/CloseAirCombat-master/renders# python render_2v2.py Traceback (most recent call last): File "render_2v2.py", line 5, in from envs.JSBSim.envs import SingleCombatEnv, SingleControlEnv, MultipleCombatEnv ModuleNotFoundError: No module named 'envs' 渲染时报错 求解答

zkprimary4 commented 5 months ago

回溯(最近一次调用最后一次):文件“render_2v2.py”,第 3 行,来自 envs。JSBSim.envs import SingleCombatEnv、SingleControlEnv、MultipleCombatEnv ModuleNotFoundError:没有名为“envs”的模块 (jsbsim) root@dell-PowerEdge-R730:/home/dell/gyl/CloseAirCombat-master/renders# python render_2v2.py Traceback(最近一次调用最后):文件“render_2v2.py”,第 5 行,来自 envs。JSBSim.envs import SingleCombatEnv, SingleControlEnv, MultipleCombatEnv ModuleNotFoundError: No module named 'envs' 渲染时报错 求解答

你好,请问你的问题解决了吗

sakulall commented 2 months ago

包含了问题1,dada文件下没有F-16飞机参数文件,建议添加一个F-16的参数文件或者更改根目录到自己安装的JSBSim库下面自带的F-16飞机参数文件,如,

# load JSBSim FDM
        self.jsbsim_exec = jsbsim.FGFDMExec(root_dir='D:\\software\\anaconda\\Lib\\site-packages\\jsbsim')  # os.path.join(get_root_dir(), 'data')

问题2,应该是版本不同导致文本数据分割问题,仅保留有效属性就行

# Catalog.add_jsbsim_props(self.jsbsim_exec.query_property_catalog(""))
        jsbsim_props_raw = self.jsbsim_exec.query_property_catalog("")
        jsbsim_props_filtered = []
        for prop in jsbsim_props_raw.split('\n'):
            if " " in prop and "(" in prop and ")" in prop:  # Simple check for expected format "name_jsbsim (access)"
                jsbsim_props_filtered.append(prop)
        # Add only valid properties to the catalog
        Catalog.add_jsbsim_props(jsbsim_props_filtered)

你好,我也出现了问题1的情况,我的环境是Windows,但是我不知道你提到的修改的位置在哪里,可以具体给我讲一下在哪里吗