Skip to content

Commit

Permalink
Merge pull request #56 from aidotse/Plotting-the-performed-activity-i…
Browse files Browse the repository at this point in the history
…n-the-visualization

Activity visualization
  • Loading branch information
gomezzz committed Nov 29, 2022
2 parents 00ccbff + 3365ea4 commit 24ef38f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions paseos/activities/activity_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,11 @@ async def job():
)
await asyncio.wait([asyncio.create_task(processor.stop())])
self._paseos_instance._is_running_activity = False
self._paseos_instance._local_actor._current_activity = None
del processor

# Workaround to avoid error when executed in a Jupyter notebook.
self._paseos_instance._local_actor._current_activity = name
if is_notebook():
return job()
else:
Expand Down
3 changes: 3 additions & 0 deletions paseos/actors/base_actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class BaseActor(ABC):
# Communication links dictionary
_communication_devices = DotMap(_dynamic=False)

# Tracks the current activity
_current_activity = None

def __init__(self, name: str, position, epoch: pk.epoch) -> None:
"""Constructor for a base actor
Expand Down
5 changes: 5 additions & 0 deletions paseos/visualization/space_animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def _populate_textbox(self, actor: BaseActor) -> str:
for name in actor.communication_devices.keys():
info = actor.communication_devices[name]
info_str += f"\nCommDevice1: {info.bandwidth_in_kbps} kbps"

elif isinstance(actor, GroundstationActor):
# TODO: implement textbox for groundstation
raise NotImplementedError(
Expand All @@ -163,6 +164,10 @@ def _populate_textbox(self, actor: BaseActor) -> str:
"SpacePlot is currently not implemented for actor type" + type(actor)
)

cur_act = actor._current_activity
if cur_act is not None:
info_str += f"\n({cur_act})"

return info_str

def _plot_los(self, los_matrix: np.ndarray) -> None:
Expand Down

0 comments on commit 24ef38f

Please sign in to comment.