I have a few experience in robotic projects. It needs a lot of trial run and testing with the robot while fixing all the sensors together. The sensor's reliability and sensitivity need to be adjusted together with your Robot chassis after the programming part has been done, tested, and fool proven. In many occasion, field testing is a must to work on the Robot and do adjustment toward the program because no two sensors are perfectly identical. The orientation, direction, level, position and so on need to fine tune on the field.
Programming is just one part which we write the command to instruct the Robot to follow the desired performance in an ideal situation. Many a time practical testing and adjusting of program will take more time to fine tune the behavior of the Robot toward what is instructed.