selectively copy models and search for dependencies#93
Conversation
|
instead of hardcoding in each worldnode file which models are used imo it'll be cleaner if there was some automatic way to do this Eg if the models are already organized by competition in the models folder Or if u search through the sim definition to see what models are used for that sim |
ethayu
left a comment
There was a problem hiding this comment.
can we rename the file from HoopCourse.py to InHouse.py
and in general there will be 2 types of naming - the class name directly (invoked via self.__class__.__name__) and the camel_case version (so in_house in this case) - we use camel_case when referring to file names
| """ | ||
|
|
||
| def __init__(self, | ||
| competition_name: str, |
There was a problem hiding this comment.
competition_name should not exist as a parameter (if anything should be hardcoded for subclasses)
| """ | ||
|
|
||
| def __init__(self, competition_name: str, output_filename: Optional[str] = None): | ||
| def __init__(self, competition_name: str): |
There was a problem hiding this comment.
yeah should not exist as a param
There was a problem hiding this comment.
sorry kevin for putting this on you i know you didn't write the code but pls make fix
| output_filename: Optional custom output filename. If None, uses {competition_name}.sdf | ||
| """ | ||
| super().__init__(self.__class__.__name__) | ||
| self.competition_name = competition_name |
There was a problem hiding this comment.
reference https://github.com/pennaerial/monorepo/blob/main/controls/sae_2025_ws/src/uav/uav/autonomous_modes/Mode.py to see how we refer to this sort of thing (we use self.__class__.__name__)
| max_dist: 1 | ||
| world_name: "src/sim/sim/world_gen/worlds/template.sdf" # Gazebo world template | ||
| # output_filename is optional - defaults to competition name | ||
| world_name: "world_gen/worlds/template.sdf" # Gazebo world template (relative to package root) |
There was a problem hiding this comment.
let's have it always default to world_gen/worlds/{name of yaml} (so remove this param)
| uav=self.uav, | ||
| num_hoops=self.num_hoops, | ||
| max_dist=self.max_dist, | ||
| course = AscentCourse(dlz=self.dlz, |
There was a problem hiding this comment.
for code cleanliness lets put these repeated params into a dict and pass into functions via **
| response.hoop_positions.append(hp) | ||
| return response | ||
|
|
||
| def _validate_parameters(self): |
There was a problem hiding this comment.
hmm let's add this function into main WorldNode implementation
There was a problem hiding this comment.
change irrelevant to commit (remove)
| This function merges sim models (hoop, dlz, payload, etc.) with existing PX4 models | ||
| using dirs_exist_ok=True. It should be called *after* PX4 vehicle models are copied. | ||
|
|
||
| Model copying flow: | ||
| 1. UAV launch: copy_px4_models() clears ~/.simulation-gazebo/models/ and copies PX4 vehicle models | ||
| 2. WorldNode: This function merges sim models with existing PX4 models (dirs_exist_ok=True) |
|
|
||
| return dependencies | ||
|
|
||
| def copy_px4_models(px4_path: str, models: list[str]) -> None: |
There was a problem hiding this comment.
why is this new function, sim package already downloads px4/gz models (
…pennaerial/monorepo into user/kevins4202/selective-model-copying
#84 Lazily loads sim and PX4 models, searching recursively for dependencies