diff --git a/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense.py b/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense.py index 6800213..501933b 100644 --- a/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense.py +++ b/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense.py @@ -132,20 +132,6 @@ def __post_init__(self): name=self.name, ) - def initialization(self, state: Environment): - """ - creates the simulation environment setup - with preset values in the definition - - returns: grids - - """ - # update walk region - self.update_offset_regions( - ground_array=state.grids["ground"].to_numpy(), - scan_array=state.grids["scan"].to_numpy(), - ) - def update_environment(self, state: Environment): self.decay_environment(state) diff --git a/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_a_vortex.py b/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_a_vortex.py index 8b45c86..e5ec2d1 100644 --- a/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_a_vortex.py +++ b/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_a_vortex.py @@ -165,19 +165,6 @@ def __post_init__(self): name=self.name, ) - def initialization(self, state: Environment): - """ - creates the simulation environment setup - with preset values in the definition - - returns: grids - - """ - # update walk region - self.update_offset_regions( - state.grids["ground"].to_numpy(), state.grids["scan"].to_numpy() - ) - def update_environment(self, state: Environment): self.decay_environment(state) self.diffuse_follow_grid(state, state.grids["built"].to_numpy()) diff --git a/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_b_walls.py b/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_b_walls.py index 818ee85..84f86b1 100644 --- a/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_b_walls.py +++ b/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_b_walls.py @@ -89,19 +89,6 @@ def __post_init__(self): name=self.name, ) - def initialization(self, state: Environment): - """ - creates the simulation environment setup - with preset values in the definition - - returns: grids - - """ - # update walk region - self.update_offset_regions( - state.grids["ground"].to_numpy(), state.grids["scan"].to_numpy() - ) - def update_environment(self, state: Environment): self.decay_environment(state) if follow_newly_built > 0: diff --git a/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_c_4view.py b/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_c_4view.py index f2e8738..678b57e 100644 --- a/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_c_4view.py +++ b/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_c_4view.py @@ -93,20 +93,6 @@ def __post_init__(self): ) self.print_dot_counter = 0 - def initialization(self, state: Environment): - """ - creates the simulation environment setup - with preset values in the definition - - returns: grids - - """ - ground = state.grids["ground"] - scan = state.grids["scan"] - - # update walk region - self.update_offset_regions(ground.to_numpy(), scan.to_numpy()) - def update_environment(self, state: Environment): self.decay_environment(state) if follow_newly_built > 0: diff --git a/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_d2_goal_density_v2.py b/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_d2_goal_density_v2.py index 3d525be..0c8708c 100644 --- a/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_d2_goal_density_v2.py +++ b/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_d2_goal_density_v2.py @@ -92,24 +92,14 @@ def __post_init__(self): ) def initialization(self, state: Environment): - """ - creates the simulation environment setup - with preset values in the definition - - returns: grids - - """ + """Setup that needs to be after environment is created""" + self.super().initialization(state) goal_density = state.grids["goal_density"] goal_density.set_values_using_index_map( self.make_goal_density_box_mockup_D(), goal_density__modifier_D ) - # update walk region - self.update_offset_regions( - state.grids["ground"].to_numpy(), state.grids["scan"].to_numpy() - ) - def update_environment(self, state: Environment): self.decay_environment(state) diff --git a/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_d_goal_density.py b/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_d_goal_density.py index fc8f2e5..f68e53e 100644 --- a/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_d_goal_density.py +++ b/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_d_goal_density.py @@ -96,13 +96,8 @@ def __post_init__(self): ) def initialization(self, state: Environment): - """ - creates the simulation environment setup - with preset values in the definition - - returns: grids - - """ + """Setup that needs to be after environment is created""" + self.super().initialization(state) goal_density = state.grids["goal_density"] goal_density.set_values_using_index_map( @@ -117,11 +112,6 @@ def initialization(self, state: Environment): self.make_goal_density_box_mockup_C(), goal_density__modifier_C ) - # update walk region - self.update_offset_regions( - state.grids["ground"].to_numpy(), state.grids["scan"].to_numpy() - ) - def update_environment(self, state: Environment): self.decay_environment(state) diff --git a/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_e_smooth.py b/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_e_smooth.py index c8d3d99..c4c633a 100644 --- a/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_e_smooth.py +++ b/src/bdm_voxel_builder/agent_algorithms/algo_20_build_by_sense_e_smooth.py @@ -92,18 +92,6 @@ def __post_init__(self): name=self.name, ) - def initialization(self, state: Environment): - """ - creates the simulation environment setup - with preset values in the definition - - returns: grids - - """ - ground = state.grids["ground"] - scan = state.grids["scan"] - self.update_offset_regions(ground.to_numpy(), scan.to_numpy()) - def update_environment(self, state: Environment): self.decay_environment(state) diff --git a/src/bdm_voxel_builder/agent_algorithms/base.py b/src/bdm_voxel_builder/agent_algorithms/base.py index d596637..4c830f5 100644 --- a/src/bdm_voxel_builder/agent_algorithms/base.py +++ b/src/bdm_voxel_builder/agent_algorithms/base.py @@ -34,9 +34,11 @@ def __init__( def setup_agents(self, state: Environment): raise NotImplementedError - @abc.abstractmethod def initialization(self, state: Environment, **kwargs): - raise NotImplementedError + """Setup that needs to be after environment is created""" + ground = state.grids["ground"].to_numpy() + scan = state.grids["scan"].to_numpy() + self.update_offset_regions(ground, scan) @abc.abstractmethod def update_environment(self, state: Environment):