LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Formula Node for Vector Subtraction


@deceased wrote:

@paul_cardinale wrote:

If you use built in support for physical quantities, you don't need to convert units.  Also, you can use the Quotient & Remainder function to keep the angle positive

va.png


I am wary of using LabVIEW units because I was always finding bugs with it in the past.

For example, the square primitive wouldn't square the units (you had to multiply the value by itself as the workaround).

I see that's now fixed in the newer versions, but there were so many issues I had to start manually keeping track of units.

 

I just made a control with units Deg, used the "convert units" primitive to convert to Rad.

The value is correctly modified but the unit type doesn't propagate to the indicator.

 

Its a nice trick for the conversion though. Kudos.

 

0xDEAD


Of course.  That's the intended behavior.  The control has a type of physical quantity of Angle (the units "Deg" exist only in the control, not in the wire).  When you use "Convert Units" to convert to Radians, it takes the angle value in the wire and converts it to a raw number (no physical quantity) whose value is the angle in radians.

 

The purpose of "Convert Units" is to convert between physical quantities and raw numbers; you feed it a physical quantity (e.g. Angle) and it returns a (dimensionless) raw number; or you feed it a dimensionless raw number and it outputs a physical quantity.

 

If you want code that takes a control value in degrees and outputs an indicator value in radians, all you need is this:

af.pngab.png

 

"If you weren't supposed to push it, it wouldn't be a button."
Message 11 of 12
(489 Views)

Thank you!  That solved my negative angle issues.

 

0 Kudos
Message 12 of 12
(479 Views)