Sensors, Electronics and Prototyping

Reply To: UM7 Python Library

Welcome to Redshift Labs Forums UM7 Product Support UM7 Python Library Reply To: UM7 Python Library


hi daniel,

thanks for your work! it has made my entry to UM7 with python easy.

i have forked to buxit/um7 and since then rewritten large parts of it. i wonder if dank93 is in indeed your github account as the github-code was behind the one on pip.

you might consider pulling some of my commits:

my first commit updates to version 0.9 as found on pip. the second commit adds python3 compatibility and improves packet parsing performance and robustness by correcting packet length interpretation, calculating and comparing checksums, passing only the payload as data and avoiding binary to hex-string conversions.

the following commits further improve different aspects of the UM7 module, but also modify the logic of state updates.
i always keep the complete state of all values requested through statevars in UM7.state, updating it as packets come in. in my app i have a separate thread that does only little more than:

while True:

following this logic the code will further diverge from the original, replacing host time by time values reported from the UM7. by checking for (plausibly) increasing time values it is then possible to asses if all the data from the UM7 is current / accurate.

i have also written calibration code that calculates a rotation matrix to be applied to all measurements (to compensate for slight differences in UM7-mounting) but i’m currently not sure if (and how) i could integrate it.