Universal Robots Forum

Popup precision/scientific notation

I have the UR5e run a calculation and report the answer to the operator with a popup window.
The values are typically on the order of .000020 - can vary from there.
If the value is out to 5 or 6 decimals, it seems to be a crapshoot as to whether it displays in decimal or scientific notation.

Most operators have no idea what scientific notation is, so I’d like to keep it in standard decimal form.

Is there any way to control this?

If it’s on a fixed order of magnitude like that, can you just multiply by the precision and say it’s in a different unit? Like just multiply by 10^6th and display it as 20 microns or whatever the unit is?

Otherwise, search for HTML formatting styles. There are some other examples on the forum here. The popups can take HTML formatting so that will probably get you whatever you need. For example this discussion:

Eventually we do swap units, but at the time this number is displayed, I’d like it to match what they’ll be seeing on the gage.
I’ve done a little searching on this topic, but I"m not seeing a straightforward html solution - most of what I’ve come across seems to involve javascript.

Did a little more digging, and it looks like the to_str() function will do what I need.
Per the manual, “Float numbers will be formatted with 6 decimals, and trailing zeros will be removed.”

so, this code seems to work:

#val_1 is number to be displayed

global val_string=to_str(val_1)
popup(val_string, title= “value”)

I can round to 5 decimals first if I want