Skip to content

Commit

Permalink
Reduction to single reporter class
Browse files Browse the repository at this point in the history
Now that multiple use of same plugin can be done, only 1 reporter class required
Now reports out via its name
Reports function and data, low and high
  update reports data it was given and records it
  render_reasoning reports known data
Added VERBOSITY constant for easy on/off of data reporting
  when True, all outputs
  when False, reporter only states function
  • Loading branch information
asgibson committed Mar 13, 2024
1 parent 646ff5d commit 556b85f
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 108 deletions.
12 changes: 8 additions & 4 deletions onair/config/reporter_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ TelemetryMetadataFilePath = onair/data/telemetry_configs/
MetaFile = data_physics_generation_CONFIG.json
ParserFileName = onair/data_handling/csv_parser.py

KnowledgeRepPluginDict = {'reporter_of_knowledge':'plugins/reporters/reporter_of_knowledge/__init__.py'}
LearnersPluginDict = {'reporter_of_learning':'plugins/reporters/reporter_of_learning/__init__.py'}
PlannersPluginDict = {'reporter_of_planning':'plugins/reporters/reporter_of_planning/__init__.py'}
ComplexPluginDict = {'reporter_of_complexity':'plugins/reporters/reporter_of_complexity/__init__.py'}
KnowledgeRepPluginDict = {'Knowledge Reporter 1':'plugins/reporter',
'Knowledge Reporter 2':'plugins/reporter'}
LearnersPluginDict = {'Learners Reporter 1':'plugins/reporter',
'Learners Reporter 2':'plugins/reporter'}
PlannersPluginDict = {'Planner Reporter 1':'plugins/reporter',
'Planner Reporter 2':'plugins/reporter'}
ComplexPluginDict = {'Complex Reporter 1':'plugins/reporter',
'Complex Reporter 2':'plugins/reporter'}

[RUN_FLAGS]
IO_Flag = true
Expand Down
File renamed without changes.
36 changes: 36 additions & 0 deletions plugins/reporter/reporter_plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# GSC-19165-1, "The On-Board Artificial Intelligence Research (OnAIR) Platform"
#
# Copyright © 2023 United States Government as represented by the Administrator of
# the National Aeronautics and Space Administration. No copyright is claimed in the
# United States under Title 17, U.S. Code. All Other Rights Reserved.
#
# Licensed under the NASA Open Source Agreement version 1.3
# See "NOSA GSC-19165-1 OnAIR.pdf"

from onair.src.ai_components.ai_plugin_abstract.ai_plugin import AIPlugin

VERBOSE = False

class Plugin(AIPlugin):
def update(self, low_level_data=[], high_level_data={}):
"""
Reporter outputs that it is updating and outputs known headers and
given low and high level data.
"""
print(f"{self.component_name}: UPDATE")
if VERBOSE:
print(f" : headers {self.headers}")
print(f" : low_level_data {low_level_data.__class__} = '{low_level_data}'")
self.low_level_data = low_level_data
print(f" : high_level_data {high_level_data.__class__} = '{high_level_data}'")
self.high_level_data = high_level_data

def render_reasoning(self):
"""
Reporter outputs that it is reasoning and gives its known low and
high level data.
"""
print(f"{self.component_name}: RENDER_REASONING")
if VERBOSE:
print(f" : My low_level_data is {self.low_level_data}")
print(f" : My high_level_data is {self.high_level_data}")

This file was deleted.

Empty file.

This file was deleted.

Empty file.

This file was deleted.

Empty file.

This file was deleted.

0 comments on commit 556b85f

Please sign in to comment.