Set of Infrared photocells are used to create a safet zone near the gate called an Entrament zone.
A pair of photo cells can be installed between the gate posts outside of the gate to prevent anyone being trapped by a closing gate. Breaking the infrared beam prevents the gate from opening if closed or closing if already open.
A second pair of photocells can be installed inside the property and again breaking the beam create the entarpment zone.