I am new to PID controller, so I got very confused. I am trying to solve the Cartpole problem. I saw this simple solution for that. I don't understand why that guy used sigmoid to determine which action to take, does the PID controller work on every actuator? (in this case, he used sigmoid, which is so confusing)
does the PID controller work on every actuator?
The short answer to this is
PID controllers are used to stabilise a plant/system. They are heavily used in different industries, though they can be a bit costly to implement sometimes. Drone Industry (UAV / drones) is one of them. PID controllers would help them to stabilize and auto-hold (or altitude-hold some might say).
why that guy used sigmoid to determine which action to take
return 1.0 / (1.0 + np.exp(-x))
pid = np.dot(P * error + I * integral + D * derivative, desired_mask)
action = sigmoid(pid)
In these snippets, he/she/they
used the sigmoid function to limit the coefficients of the PID controller within the predefined range of the sigmoid function. This would help them to keep the PID coefficients within the stable range so that it doesn't get too high or too low to reach the verge of instability.