Collision detection for gates