You may also want to add a sensor that sees you passing through to close the gate, and a sensor that makes sure no obstacles (you, the car, or the neighbour's cat) are in the gate's way when it closes - and maybe even yet another sensor that will stop the gate if it hits anything while closing or opening.
I read about a child getting killed by an automatic gate a few years back. I though gates might cause broken or amputated fingers but I was not expecting fatalities so I looked it up. It really was surprising how many deaths are caused by automated gates. Poor maintenance lead to a lot of people being killed by falling gates, and to some electrocutions, but there were a surprising number of people (usually children) trapped and killed by gates operating to design. The force the gate can apply needs to be considered and, if it does hit an obstacle it needs to back off a bit and stop, not repeatedly try closing.