Skip to content

Commit

Permalink
fix #7, logger statements in lbg1_base
Browse files Browse the repository at this point in the history
  • Loading branch information
rallen10 committed Nov 5, 2023
1 parent ce5222b commit 155d528
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Resolve [iss7](https://github.com/mit-ll/spacegym-kspdg/issues/7) by switching print statements to logger statements in lbg1_base.py

### Changed

- Conda environment is no longer pinned to python 3.9 due to removal of poliastro dependency
- Conda environment is no longer pinned to python 3.9 due to removal of poliastro dependency. This will cause the most recent python version (currently 3.12) to be used when creating the environment
- `evaluate.pyc` script has been replaced by python-version-specific binaries `evaluate.cpython-39.pyc` (for python 3.9) and `evaluate.cpython-312.pyc` (for python 3.12). This is to avoid a `RuntimeError: Bad magic number in .pyc file` when trying to run evaluate.pyc from the wrong python version

### Removed

- poliastro dependency and related functions in `utils.py`. This removes functions for propagating orbits which were used for non-essential metric evals. For further justification, see [this issue](https://github.com/mit-ll/spacegym-kspdg/issues/8)
- `utils.estimate_capture_dv` and related unit tests which depended upon poliastro
- `utils.solve_lambert` and related unit tests which depended upon poliastro
- `utils.propagate_orbit_tof` and related unit tests which depended upon poliastro

## [v0.1.0] - 2023-10-23

Expand Down
12 changes: 6 additions & 6 deletions src/kspdg/lbg1/lbg1_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,13 @@ def _reset_vessels(self):

# Set the bandit as the the active (i.e. human-controlled) vessel
# and target lady
print("Changing active vehicle to Bandit and setting target to Lady...")
self.logger.info("Changing active vehicle to Bandit and setting target to Lady...")
self.conn.space_center.active_vessel = self.vesBandit
self.conn.space_center.target_vessel = self.vesLady
time.sleep(0.5) # give time to re-orient

# orient bandit in target-pointing direction
print("Activating Bandit SAS, RCS and orienting to Lady...")
self.logger.info("Activating Bandit SAS, RCS and orienting to Lady...")
self.vesBandit.control.sas = True
time.sleep(0.1) # give time to re-orient
self.vesBandit.control.sas_mode = self.vesBandit.control.sas_mode.target
Expand Down Expand Up @@ -517,21 +517,21 @@ def enforce_episode_termination(self):
d_vesL_vesB = self.get_lb_relative_distance()
is_lady_captured = d_vesL_vesB < self.lady_capture_dist
if is_lady_captured:
print("\n~~~SUCCESS! LADY CAPTURED BY BANDIT~~~\n")
self.logger.info("\n~~~SUCCESS! LADY CAPTURED BY BANDIT~~~\n")

# check termination condition: bandit-guard proximity
d_vesB_vesG = self.get_bg_relative_distance()
is_bandit_captured = d_vesB_vesG < self.bandit_capture_dist
if is_bandit_captured:
print("\n~~~FAILURE! BANDIT CAPTURED BY GUARD~~~\n")
self.logger.info("\n~~~FAILURE! BANDIT CAPTURED BY GUARD~~~\n")

# check for episode timeout
is_timeout = self.vesBandit.met > self.episode_timeout
if is_timeout:
print("\n~~~EPISODE TIMEOUT~~~\n")
self.logger.info("\n~~~EPISODE TIMEOUT~~~\n")

if is_lady_captured or is_bandit_captured or is_timeout:
print("Terminating episode...\n")
self.logger.info("Terminating episode...\n")
self.is_episode_done = True
self.stop_bot_thread = True
self.stop_episode_termination_thread = True
Expand Down

0 comments on commit 155d528

Please sign in to comment.