this week i first tweaked neil's python code for the txrx step response interface to include the two step response sensors of my final project prototype (see previous week with videos!) so i could see the two side by side. most of the work was just understanding the code, the clever way it reconverts 8-bit pieces of the values back into 16-bit values, the filtering arithmetic to soften the sensitive changes in values, and the structuring of the rectangles.

i then wanted to calculate the ratio of one value detected to the other (which in my project would control the motor speed) so i added another bar to the interface that would rest at 0.0 if the braking sensor detected a higher force than the other and the ratio of the values otherwise (maybe not the most intuitive system, in retrospect) like this:

this is my first time using python: i had trouble displaying a more precise ratio (could only get the decimal to the tenth place). getcontext().prec seemed to have no effect. i had imported from decimal, but some of the arithmetic commands couldn't be carried through it so for the bar itself, i had to use an integer while displaying a %.1 float:

for the purposes of my project, i don't think the accuracy is very important but i'd still like to figure out how to work with floats and decimals in python anyway.

i then wanted to calculate the ratio of one value detected to the other (which in my project would control the motor speed) so i added another bar to the interface that would rest at 0.0 if the braking sensor detected a higher force than the other and the ratio of the values otherwise (maybe not the most intuitive system, in retrospect) like this:

this is my first time using python: i had trouble displaying a more precise ratio (could only get the decimal to the tenth place). getcontext().prec seemed to have no effect. i had imported from decimal, but some of the arithmetic commands couldn't be carried through it so for the bar itself, i had to use an integer while displaying a %.1 float:

for the purposes of my project, i don't think the accuracy is very important but i'd still like to figure out how to work with floats and decimals in python anyway.