refactor: (env_manager, rbs_runtime) and add YAML config loading
- Updated `camera.py` to use consistent float literals for default spawn positions. - Removed unused import statements and organized imports in `robot.py` and `scene.py`. - Removed debugging import from `scene.py` to clean up codebase. - Added a new YAML configuration file (`default-scene-config.yaml`) for scene settings. - Implemented a scene configuration loader function in `rbs_runtime/__init__.py` to read and parse YAML config files. - Modified `runtime.py` to utilize the newly added scene config loader and removed in-code default scene setup. - Updated `setup.py` to include `config` directory in package data. - Changed `rbs_robot.launch.py` to use position control strategy by default. - Refactored `skills.launch.py` with cleaner parameter definitions and reactivated commented-out nodes.
This commit is contained in:
parent
cc9b525637
commit
dba3b8682a
10 changed files with 226 additions and 72 deletions
|
@ -0,0 +1,18 @@
|
|||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
from dacite import from_dict
|
||||
from env_manager.models.configs import SceneData
|
||||
|
||||
|
||||
def scene_config_loader(file: str | Path) -> SceneData:
|
||||
def tuple_constructor(loader, node):
|
||||
return tuple(loader.construct_sequence(node))
|
||||
|
||||
with open(file, "r") as yaml_file:
|
||||
yaml.SafeLoader.add_constructor("!tuple", tuple_constructor)
|
||||
scene_cfg = yaml.load(yaml_file, Loader=yaml.SafeLoader)
|
||||
|
||||
scene_data = from_dict(data_class=SceneData, data=scene_cfg)
|
||||
|
||||
return scene_data
|
Loading…
Add table
Add a link
Reference in a new issue