Hello, is it possible to perform an MC_MoveAbsolute movement, and have the servo move using an external encoder (freeEncoder)? In my application, I have slippage on the main shaft of the servo motor, and I would like to add an encoder to measure the actual position of the material.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My first choice would be to check whether your servo drives supports an external encoder, connect the encoder to the servo and configure the servo accordingly. In this case, you would not need to change anything in the CODESYS application.
If that is not an option, you could use SM_DrivePosControl, a drive that closes the position loop in the PLC, and feed it with the external encoder positions. See (0). You can switch your servo drive to velocity control mode (SMC_SetControllerMode) and use SMC_FollowVelocity to apply the fSetVelocity of the SM_DrivePosControl to your servo. The MC_MoveAbsolute can then be performed on the SC_DrivePosControl
Hello, I made this configuration, I'm moving the encoder value to SM_Driver_PosControl.in.wActPosition. When I make the absolute movement of my PosControl axis, my physical drive axis rotates perfectly, but I noticed that the movement is not followed by the encoder. That is, if I hold the encoder and keep it in position 0, the PosControl axis makes the absolute movement of 314 mm and stops, which is strange because the encoder is at 0. Theoretically, the PosControl axis should accelerate to try to compensate for the movement error. I haven't yet achieved perfect functionality.
Georg, the encoder's actual position was -208 because I moved it manually for testing, but I managed to get it working. Your information is correct; there was a parameter error, Kp was at 0. After I adjusted it, it responded as expected. Thank you very much for your help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello, is it possible to perform an MC_MoveAbsolute movement, and have the servo move using an external encoder (freeEncoder)? In my application, I have slippage on the main shaft of the servo motor, and I would like to add an encoder to measure the actual position of the material.
Hi polyautomacao,
basically, there are two ways to approach this.
Hope that helps.
(0) https://content.helpme-codesys.com/en/CODESYS%20SoftMotion/_sm_example_poscontrol.html
Best regards,
Georg
Hello, I made this configuration, I'm moving the encoder value to SM_Driver_PosControl.in.wActPosition. When I make the absolute movement of my PosControl axis, my physical drive axis rotates perfectly, but I noticed that the movement is not followed by the encoder. That is, if I hold the encoder and keep it in position 0, the PosControl axis makes the absolute movement of 314 mm and stops, which is strange because the encoder is at 0. Theoretically, the PosControl axis should accelerate to try to compensate for the movement error. I haven't yet achieved perfect functionality.
Hi polyautomacao,
hmm, did you tune the PD parameters as shown in the link I posted above? One thing that could cause the behavior are bad parameters.
I also don't understand the screen shot: when you hold the encoder to 0, why is the actual position of the DrivePosControl -208?
Best regards,
Georg
Georg, the encoder's actual position was -208 because I moved it manually for testing, but I managed to get it working. Your information is correct; there was a parameter error, Kp was at 0. After I adjusted it, it responded as expected. Thank you very much for your help.