How do I find a cover position for a shooter AI?

Please help. All progress I’ve made is a way to see on which side of a wall should the npc hide and a really bad way to find the corners of a part.