Using a pressure sensor to control the gripper

I’ve put together a module that will open the gripper and also close it until a pressure sensor meets the given threshold. It’s nothing too complicated and it was fun to make.
Gripper.fsm (288 KB)

I’ve made a huge change to the gripper control, it now uses a counter instead of arrays to generate the servo pulses. it is now much more stable and reliable!
Gripperv3.fsm (285 KB)

This go around i’ve used a pid module to control the gripper movement. using the pulse widths as a target it calculates each step to open or close the gripper.
Gripperv4.fsm (287 KB)

This version of the module uses the pressure as the measurement. I’m having a problem with it oscillating open and closed. I believe the cause is due to the fact that the pressure sensor can’t be read constantly, only intermittently. I would appreciate any thoughts on this problem.
Gripperv5.fsm (288 KB)