Planes with pilots in them are mostly autonomous and can avoid each other as well as the ground.
https://en.wikipedia.org/wiki/Ground_proximity_warning_syste...
https://en.wikipedia.org/wiki/Traffic_Collision_Avoidance_Sy...
https://en.wikipedia.org/wiki/%C3%9Cberlingen_mid-air_collis...