While experimenting with high-level analyzer (HLA) for quadrature decoder (see other thread), I noticed that a zero value didn’t display in the bubble text of my draft HLA:
as the zero value (0) was in the scaled_position
data – see Data table view:
(Note: original thread only had
position
column showing, while technically scaled_position
is output)
Some snippets from the analyzer python script:
- The result_types definition:
result_types = {
'QuadEncoder': {
'format': '{{data.scaled_position}}'
}
}
- The AnalyzerFrame being returned:
# Return the analyzer output data frame
return AnalyzerFrame('QuadEncoder', frame.start_time, frame.end_time, {
'position' : self.position,
'rate' : self.rate,
'scaled_position': self.scaled_position, # this value is what should display in BubbleText
'scaled_rate' : self.scaled_rate
})
I’m fairly new to python, so maybe it is something obvious with the ‘format’ string … ?
OR - maybe the HLA python conversion to BubbleText can’t differentiate between a numerical value of zero (0) vs. an empty string, null character (‘\0’)?
So, if I actually want a numerical 0 to be displayed, what do I need to do differently?
[Edit] Note: when trying to find other references (such as this article about displaying special characters), I tried updating my result_types to:
result_types = {
'QuadEncoder': {
'format': '{{{data.scaled_position}}}'
}
}
… but this still didn’t resolve the missing zero value (‘0’) display in the bubble text.
While trying various other things, I also managed to break it and get “Template renderer error” to display on the bubble text – so maybe the real question is: what syntax is actually being used to render/format the result_types string values for the format
key and actually convert/display the bubble text?