MCPcopy Create free account
hub / github.com/InternRobotics/OpenHomie / load_config

Function load_config

MujocoDeploy/mujoco_deploy_g1.py:11–25  ·  view source on GitHub ↗

Load and process the YAML configuration file

(config_path)

Source from the content-addressed store, hash-verified

9from legged_gym import LEGGED_GYM_ROOT_DIR
10
11def load_config(config_path):
12 """Load and process the YAML configuration file"""
13 with open(config_path, 'r') as f:
14 config = yaml.safe_load(f)
15
16 # Process paths with LEGGED_GYM_ROOT_DIR
17 for path_key in ['policy_path', 'xml_path']:
18 config[path_key] = config[path_key].format(LEGGED_GYM_ROOT_DIR=LEGGED_GYM_ROOT_DIR)
19
20 # Convert lists to numpy arrays where needed
21 array_keys = ['kps', 'kds', 'default_angles', 'cmd_scale', 'cmd_init']
22 for key in array_keys:
23 config[key] = np.array(config[key], dtype=np.float32)
24
25 return config
26
27def pd_control(target_q, q, kp, target_dq, dq, kd):
28 """Calculates torques from position commands"""

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected