From 56343865c9b78bcf05f5b74478738e64beeeee18 Mon Sep 17 00:00:00 2001 From: Mark Stephenson Date: Thu, 14 Dec 2023 15:18:00 -0700 Subject: [PATCH] Issue #86: Update BSK gravFactory --- .../general_satellite_tasking/simulation/environment.py | 7 ++----- src/bsk_rl/envs/general_satellite_tasking/utils/orbital.py | 5 ++--- .../scenario/test_int_satellites.py | 3 ++- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/bsk_rl/envs/general_satellite_tasking/simulation/environment.py b/src/bsk_rl/envs/general_satellite_tasking/simulation/environment.py index 3c661b53..1b83a495 100644 --- a/src/bsk_rl/envs/general_satellite_tasking/simulation/environment.py +++ b/src/bsk_rl/envs/general_satellite_tasking/simulation/environment.py @@ -121,11 +121,8 @@ def _set_gravity_bodies( self.planet.isCentralBody = ( True # ensure this is the central gravitational body ) - self.planet.useSphericalHarmParams = True - simIncludeGravBody.loadGravFromFile( - bsk_path + "/supportData/LocalGravData/GGM03S.txt", - self.planet.spherHarm, - 10, + self.planet.useSphericalHarmonicsGravityModel( + bsk_path + "/supportData/LocalGravData/GGM03S.txt", 10 ) # setup Spice interface for some solar system bodies diff --git a/src/bsk_rl/envs/general_satellite_tasking/utils/orbital.py b/src/bsk_rl/envs/general_satellite_tasking/utils/orbital.py index 37236777..c048b0f9 100644 --- a/src/bsk_rl/envs/general_satellite_tasking/utils/orbital.py +++ b/src/bsk_rl/envs/general_satellite_tasking/utils/orbital.py @@ -178,9 +178,8 @@ def init_simulator(self) -> None: planet = self.gravFactory.createEarth() self.gravFactory.createSun() planet.isCentralBody = True - planet.useSphericalHarmParams = True - simIncludeGravBody.loadGravFromFile( - bskPath + "/supportData/LocalGravData/GGM03S.txt", planet.spherHarm, 10 + planet.useSphericalHarmonicsGravityModel( + bskPath + "/supportData/LocalGravData/GGM03S.txt", 10 ) UTCInit = self.utc_init self.gravFactory.createSpiceInterface( diff --git a/tests/integration/envs/general_satellite_tasking/scenario/test_int_satellites.py b/tests/integration/envs/general_satellite_tasking/scenario/test_int_satellites.py index 4375eb02..ff1d0f6b 100644 --- a/tests/integration/envs/general_satellite_tasking/scenario/test_int_satellites.py +++ b/tests/integration/envs/general_satellite_tasking/scenario/test_int_satellites.py @@ -44,9 +44,10 @@ class ImageSat( ) def test_generate_more_windows(self): - self.env.reset() + observation, info = self.env.reset() dts = [] while self.env.simulator.sim_time < 1500.0: + print(self.env.simulator.sim_time, info) observation, reward, terminated, truncated, info = self.env.step(1) dts.append(info["d_ts"]) assert True # Ensure stepping past initial generation duration works