How to get the motor scaling value from code

viksym
2025-06-12
2025-08-19
  • viksym - 2025-06-12

    Is there a way to see what value is set as the "Work travel distance per motor rotation" that is set in the Scaling menu of the axis ? I am working on my own homing function block for sensorless (hardstop) homing and I want to make it be universal between different axes with different motor's scaling for distance per rev so I need to know this value from the axis itself. I know I could do it by just creating an input variable for the function block but I'm leaving that option as a last resort.

     
  • tk096 - 2025-06-13

    Hi, unfortunately, in Softmotion you have only access to the combined fraction - the scaling factor from user units to motor increments. It can be accessed using MC_ReadParameter with parameter number 1054.

    increments = user_unit_position * fScaleFactor

     
    πŸ‘
    1
  • viksym - 2025-08-19

    If anybody finds this in the future, I managed to do it like this:

    scalingValue := EncoderPulseCountPerRev / ABS(AxisName.fScaleFactor);

    No need to use MC_ReadParameter as I am able to read this value directly from the axis object. Using an absolute value of the fScaleFactor is there in case the axis is set as inverted, in which case it would be a negative value.
    I was not able to figure out how to get EncoderPulseCountPerRev programatically, but since all my servos use an encoder with pulse count per revolution of 16#800000, the final equation looks like this:

    scalingValue := 16#800000 / ABS(AxisName.fScaleFactor);

     

    Last edit: viksym 2025-08-19

Log in to post a comment.