Gor-Ren / gym-jsbsim

A reinforcement learning environment for aircraft control using the JSBSim flight dynamics model
MIT License
178 stars 87 forks source link

Sorry, I encountered a minor issue while running tests after cloning your program. #15

Open liquidweb9 opened 1 year ago

liquidweb9 commented 1 year ago

It looks like there's an issue with the load_ic function in the jsbsim module. It seems like it's expecting two positional arguments, but only one is being given. You might want to check the documentation for the load_ic function to see what arguments it requires and make sure you are providing them correctly.

Here's the translation of my code:

import gym
import gym_jsbsim
import numpy as np
import time

env = gym.make('JSBSim-TurnHeadingControlTask-Cessna172P-Shaping.STANDARD-FG-v0')
state = env.reset()
env.render(mode='flightgear')
done = False

while not done:
    action = np.random.random((3,))*2-1
    state, reward, done, info = env.step(action)
    env.render(mode='flightgear')
    #time.sleep(1)

And the error message:

self.jsbsim.load_ic(ic_path, useStoredPath=False) File "_jsbsim.pyx", line 954, in jsbsim._jsbsim.FGFDMExec.load_ic TypeError: load_ic() takes exactly 2 positional arguments (1 given)

Hope this helps!

Gor-Ren commented 1 year ago

Thanks for flagging the issue.

I don't maintain this repository anymore, but it sounds like jsbsim made a breaking change to their python bindings. I see jsbsim 1.2.0 was released around two weeks ago. I would suggest trying jsbsim 1.1.x instead to see if that resolves the issue.

liquidweb9 commented 1 year ago

You're welcome! I will try again, and once again, thank you for your response.

RobertXWL commented 11 months ago

You should replace "useStoredPath" with "booluseAircraftPath" in the code, as it has been updated in the latest version.

sryu1 commented 11 months ago

You should replace "useStoredPath" with "booluseAircraftPath" in the code, as it has been updated in the latest version.

It should actually be useAircraftPath, not booluseAircraft Path.

skryu9607 commented 10 months ago

In my case, I just deleted the calling argument part ("useStoredPath="). Instead of "load_ic(ic_path,useStoredPath=False)", "load_ic(ic_path,False)".