Skip to content

Commit

Permalink
Readd parameter to update_scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert108 committed Aug 20, 2024
1 parent 257c8cd commit d608a45
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions atos/modules/OpenScenarioGateway/openscenariogateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ def story_board_element_state_change_callback(self, story_board_element):
def parameter_callback(self, params):
for param in params:
if param.name == SCENARIO_FILE_PARAMETER and param.value:
self.update_scenario()
self.update_scenario(file_name=param.value)
elif param.name == ACTIVE_OBJECT_NAME_PARAMETER:
self.update_active_scenario_objects(active_objects_name=param.value)
return SetParametersResult(successful=True)

def update_scenario(self):
scenario_file = self.getScenarioFilePath()
def update_scenario(self, file_name):
scenario_file = self.getAbsoluteOSCPath(file_name)
# Check if the file exists, else throw an error
if not path.exists(scenario_file):
self.get_logger().error("File does not exist: {}".format(scenario_file))
Expand Down Expand Up @@ -147,12 +147,6 @@ def update_active_scenario_objects(self, active_objects_name: List[str]):
)
)

def init_callback(self, _):
self.update_scenario()
self.update_active_scenario_objects(
self.get_parameter(ACTIVE_OBJECT_NAME_PARAMETER).value
)

def get_all_objects_in_scenario(self, scenario_file) -> List[ScenarioObject]:
scenario = xosc.ParseOpenScenario(scenario_file)
scenario_objects = {
Expand Down

0 comments on commit d608a45

Please sign in to comment.