Skip to content

Commit

Permalink
Issue #116: Add observation of angle between instrument and target
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzzoQM committed Feb 16, 2024
1 parent e484e3f commit 23e9c2e
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ def target_obs(self):
):
props = {}
for prop_spec in target_properties:
print(prop_spec)
name = prop_spec["prop"]
print("name ", name)
norm = prop_spec.get("norm", 1.0)
if name == "priority":
value = opportunity["target"].priority
Expand All @@ -246,6 +248,17 @@ def target_obs(self):
value = sum(opportunity["window"]) / 2 - self.simulator.sim_time
elif name == "window_close":
value = opportunity["window"][1] - self.simulator.sim_time
elif name == "target_angle":
vector_target_spacecraft_P = (
opportunity["target"].location - self.dynamics.r_BN_P
)
vector_target_spacecraft_P_hat = (
vector_target_spacecraft_P
/ np.linalg.norm(vector_target_spacecraft_P)
)
value = np.arccos(
np.dot(vector_target_spacecraft_P_hat, self.fsw.c_hat_P)
)
else:
raise ValueError(
f"Invalid target property: {prop_spec['prop']}"
Expand Down

0 comments on commit 23e9c2e

Please sign in to comment.