goodrobots / vision_landing

Precision landing using visual targets
GNU General Public License v3.0
202 stars 71 forks source link

Config parsing with python types #83

Closed vgroove closed 7 years ago

vgroove commented 7 years ago

Noticed unexpected behavior using controlprocessing=False in a config file. SafeConfigParser .items() function returns dictionary of all strings and doesn't convert strings to int/float/bool/etc. So when checking "elif not args.controlprocessing" it was checking "elif not 'False'" as opposed to "elif not False" which are opposite.

Added simple function to convert, but might want to consider using json or yaml for robustness.

fnoop commented 7 years ago

Oh, thanks very much :) I must admit this has been annoying for a while, just been too lazy to raise an issue and fix it! Will test shortly. You're right - structured/typed config would be much cleaner as I've had to move to in Maverick (related project), but getting the syntax 100% correct is a minefield for normal users as parser is very picky over extra commas etc. I've deliberately kept the config in ini format as it's very easy for non-coder users to use. And I hate yaml with a passion :)