robotika / osgar

Open Source Garden (Autonomous) Robot
MIT License
13 stars 12 forks source link

add to ogar.record option --without (list of modules) #975

Closed m3d closed 8 months ago

m3d commented 8 months ago

I would like to minimize the number of needed configuration JSON files. This is proposal for --without option to osgar.record which removes given module (or list of modules) from config and all its dependent links. Inspiration is from poetry.lock: https://python-poetry.org/docs/cli/#install where the original poetry.lock is already consistent with versions, but you may want to install only some packages. Later we may add also --with and "optional modules" ... but "later may never come".

Example:

(osgar) md@md-ThinkPad-P50:~/git/osgar$ python -m osgar.record --duration 10 config/test-dual-timer.json
2024-01-14 21:55:06,225 root             WARNING  Environment variable OSGAR_LOGS is not set - using working directory
2024-01-14 21:55:06,226 __main__         INFO     /home/md/git/osgar/test-dual-timer-240114_205506.log
2024-01-14 21:55:06,233 __main__         INFO     SIGINT handler installed
(osgar) md@md-ThinkPad-P50:~/git/osgar$ python -m osgar.logger /home/md/git/osgar/test-dual-timer-240114_205506.log
 k        name bytes | count | freq Hz
--------------------------------------
 0         sys 396 |   4 |   0.4Hz
 1 timer1.tick 900 | 100 |  10.1Hz
 2 timer2.tick 450 |  50 |   5.0Hz

Total time 0:00:09.937925

and with new option --without

osgar) md@md-ThinkPad-P50:~/git/osgar$ python -m osgar.record --duration 10 config/test-dual-timer.json  --without timer1
2024-01-14 22:10:46,318 root             WARNING  Environment variable OSGAR_LOGS is not set - using working directory
2024-01-14 22:10:46,319 __main__         INFO     /home/md/git/osgar/test-dual-timer-240114_211046.log
2024-01-14 22:10:46,319 __main__         INFO     SIGINT handler installed
(osgar) md@md-ThinkPad-P50:~/git/osgar$ python -m osgar.logger /home/md/git/osgar/test-dual-timer-240114_211046.log
 k        name bytes | count | freq Hz
--------------------------------------
 0         sys 296 |  3 |   0.3Hz
 1 timer2.tick 450 | 50 |   5.1Hz

Total time 0:00:09.816342