Skip to content

Commit

Permalink
Explicitly search for jsbsim root dir
Browse files Browse the repository at this point in the history
  • Loading branch information
julianneswinoga committed Aug 5, 2024
1 parent 58bd492 commit 491feea
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/jsbsim_wrapper/jsbsim_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import math
import site
import tempfile
from typing import List, NamedTuple
from pathlib import Path
Expand Down Expand Up @@ -204,7 +205,15 @@ def setup_jsbsim(jsb_config: JsbConfig) -> jsbsim.FGFDMExec:
fixed_waypoints.append(fixed_wp)
jsb_config = jsb_config._replace(waypoints=fixed_waypoints)

jsbfdm = jsbsim.FGFDMExec(None) # Use JSBSim default aircraft data
# fix for NixOS apparently breaking jsbsim
root_dir = None # By default use JSBSim default aircraft data
for sitepackagedir in site.getsitepackages():
matching_paths = Path(sitepackagedir).glob('**/aircraft/c310')
matching_path = next(matching_paths, None)
if matching_path:
root_dir = str(matching_path.parent.parent)
break
jsbfdm = jsbsim.FGFDMExec(root_dir)
default_dbg_level = jsbfdm.get_debug_level()

jsbfdm.set_debug_level(0) # initial output is too noisy
Expand Down

0 comments on commit 491feea

Please sign in to comment.