File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,9 +85,8 @@ def __init__(
8585 estimate_dist_t: If the disturbance torques should be estimated, defaults to False.
8686 initial_obs: Optional, the initial observation of the environment's state. See the environment's observation space for details.
8787 """
88-
8988 fx = dynamics_function (model , config )
90- hx = observation_function ()
89+ hx = observation_function
9190 # fx = jax.jit(dynamics_numeric(model, config))
9291 # hx = jax.jit(observation_function)
9392
Original file line number Diff line number Diff line change 22
33from __future__ import annotations
44
5- from functools import partial
5+ import importlib
66from typing import TYPE_CHECKING
77
88from drone_models .core import parametrize
1313 from array_api_typing import Array
1414
1515
16- def dynamics_function (model :str , config :str ):
17- """TODO."""
18- # Idea:
19- # from drone_models.{model}.model import dynamics as fn
20-
21- # return parametrize(fn, config)
22- ...
16+ def dynamics_function (model : str , config : str ) -> Callable :
17+ """Imports and return the correct dynamics function from the drone-models."""
18+ # Dynamically import the module
19+ module = importlib .import_module (f"drone_models.{ model } .model" )
20+
21+ # Get the `dynamics` function from the module
22+ fn = getattr (module , "dynamics" )
23+
24+ # Parametrize it with the config
25+ return parametrize (fn , config )
2326
2427
2528def observation_function (
You can’t perform that action at this time.
0 commit comments