pathfinder-for-autonomous-navigation / psim

Six DOF flight simulator and related GNC implementations.
MIT License
4 stars 6 forks source link

Make Simulation Configuration Editable from Python #275

Closed kylekrol closed 3 years ago

kylekrol commented 3 years ago

Fixes #266.

Make Simulation Configuration Editable from Python

Per the title, this change makes a simulation configuration object editable from Python. You can add and/or overwrite items in the configuration to whatever you prefer. Do note, however, that you can change the type of the underlying parameter as well!

I've also slightly refactored the Simulation interface - heads up on that @shihaocao. Now, you create the configuratoin yourself and pass it as an argument to the simulation like this:

import lin, psim
config = psim.Configuration(['config/deployment.txt', ...])
sim = psim.Simulation(psim.sims.Type, config)

Here is a small test I did in the Python shell:

@thinkpad ~/git/pan/psim git:(feature/update-parameters|+1) venv:(3.8.6)
% python
Python 3.8.6 (default, Sep 30 2020, 04:00:38)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lin, psim
>>> config = psim.Configuration()
>>> config['test.integer'] = 5
>>> config['test.integer']
5
>>> exit()

I also ran a single satellite attitude orbit case locally to verify the change!

kylekrol commented 3 years ago

@shihaocao Once this is in we can move to clean up some of the parameter setting on the PTest side of things! Perhaps add a section to the psim configuration files specifying overloads; althought, handling it on a case by case basis may be better because the changes will be smaller.

shihaocao commented 3 years ago

fat bet