This research project developed in order to to design localization system and also intelligent communications and control algorithms for multi agent environments sharing the medium . The goal of the project is to localize the trains as agents running on shared tracks and avoid any collision and schedule all of them on their specific path by switching tracks on real time. By using computer vision algorithms and mounting the camera on top of tracks plane control software in server side is able to find position of each specific train on tracks and then control algorithm process the data and after making decision it sends commands to trains and switching center to act .