I am working on a pid code for DC servo motor drive. It takes step/dir signals as input and calculates the PWM to correct the position error with taking into account the encoder feedback. It works fine but I think something is missing. Do I have to use another pid code for the velocity in order to drive the motor with constant speed to move to the desired position?
secondly without using the step/dir signal as input I want to use the target position value as input with max velocity and accelaration data for a trapozoidal motion profile How do I modify my position pid algorithm to handle that issue?