Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added details for scale calculation.

...

See the definitions of encoder_header_t and encoder_channel_t in github: UdpEncoder.hh

Zach writes:

...we’re currently taking the PLC’s internal encoder numerator, which is a floating point number less than zero, multiplying it by 10^6, and sending it as an integer. So, the “unit” of the output is baked into the protocol.

Data Format 2.0.0 🆕

Version 2.0.0 of encoder_channel_t adds a uint16_t field 'scaleDenom.' If nonzero, it is the denominator of a rational scale value.

'encoderValue' (shape: 1):  23563414
'timing' (shape: 1):  505870
'scale' (shape: 1):  1
'scaleDenom' (shape: 1): 1500150
'mode' (shape: 1):  0
'error' (shape: 1):  0
'majorVersion' (shape: 1):  2
'minorVersion' (shape: 1):  0
'microVersion' (shape: 1):  0

Zach writes:

...if the denominator is used, we do no pre or post multiplication of the values. If I need to express something like numerator = 1.16 and denominator = 5.0, I would send 116 and 500 which maintains the same ratio as the original.

In the specific case of this encoder, I send 1 and 150 exactly and your code on the other side simply doesn’t do the *1e-6 step because a denominator is present.

Configuring the Timing System

...