Control of 2 electric actuators using plc and encoder

Hello guys!
I'm new to this forum. English is not my main language so I apologize in advance for all mistakes.

I'm studying mechanical engineering and I don't really understand automation and control but I really need it for my bechelors thesis.
So I will try to explain my problem.

My problem is that I would like to use an incremental encoder as a sensor that detects a change in the direction of rotation. When the shaft on which the sensor is mounted turns clockwise, nothing happens. But when the direction of rotation changes, there is a signal to the PLC and this causes the pistons to extend from the electric actuators. And here's my question. Is it possible to somehow make the stroke of the actuator piston dependent on the number of revolutions of the shaft on which the encoder is mounted? In addition, is it possible for the piston to extend for e.g. for 5 seconds by 5 millimeters and then stop for e.g. 60 seconds (so that it does not move back, but is in the same position)? And then it comes out again for 5 second by 5 milimiters. And that it should be repeated for several minutes? Because in general, my point is that I have to somehow reduce the extension speed of the actuator piston to a minimum. Because this actuator is supposed to push the movable cover of the grease reservoir. And when the piston and the moveable cover don't move, the grease has a little time to drain before the cover is moved again by the actuator piston. The idea is quite stupid but necessary for my work.

If this can work, please help me choose the right components. Generally, the actuators will be powered by lithium-ion batteries. In addition, there is a plc driver and the incremental encoder on the shaft. Is there anything else needed besides this? Maybe some regulators?

Thank you in advance for your answer. Best regards.