Quadruped-PyMPC icon indicating copy to clipboard operation
Quadruped-PyMPC copied to clipboard

Eliminate the use of global variables and global config files.

Open Danfoa opened this issue 1 year ago • 0 comments
trafficstars

Most modules in this repository import a fixed repo-specific config file, config.py, and use it to load class-specific and function-specific attributes. This practice poses a problem, as external users must modify the modules and scripts to avoid using config.py.

For instance, to utilize the Acados_NMPC_Nominal class, the mpc_params used to define its attributes should be passed through the class constructor or as a DataClass configuration. Such that I as an external user can import only this class and use it without having to rely on modifying the config file of the repo, which I dont want to use.

As an example, the Centroidal_Model_Nominal model only uses config.py to load the config.mpc_params["use_foothold_optimization"] argument. This should be a class attribute set during initialization.

Maintaining the modularity of each class is essential for scaling both the code and the user base.

Danfoa avatar Jun 19 '24 10:06 Danfoa