State Machine Diagram
The system is initialized with the Servo door opened. After the Covid test is loaded we trigger the Ir sensor that goes into Ir Controlled Servo. The system checks whether the door is open or closed. If the Servo door is opened then the system will tell that Servo door to close and move forward until the perpendicular tape is not detected.
In our main system, we first check whether the Servo door is closed. During transportation, we do not want any Covid Test to spill out so when the Servo door is opened our system knows that it should not move at all. Once the system confirms that the Servo door is closed we check whether there are any objects in front of the system. If there is our system will wait until the object is removed from its course. This is to make sure that we do not hit any incoming person/object that is in our path. If there is no object then the system continuously read the two Ir sensors mounted in front of our system to keep the line in between the two sensors.
This subsystem controls what position the Servo will be at. The Servo is attached to a thing that moves the door up and down allowing us to put Covid test when needed and delivers them to its destination securely. This subsystem is triggered by an Ir Sensor(attached to the side due to lighting conflict) to avoid as much contact as possible.
This subsystem determines how the mobile system will follow the line. If the right Ir sensor detects the line then the mobile system will reverse the right motor’s direction decrease the right motor speed and increase the left motor speed. Additionally, if the left Ir sensor detects the line then the system will decrease the left motor speed and increase the right motor speed. This allows our system to adjust so that the line will always remain in-between the right and left Ir sensor. Lastly, if both Ir sensor detects the line, both motors will stop resulting in the vehicle braking and coming to a complete stop.
Sectioning Code by Components
By implementing code for each component individually not only do we test whether the component works, but we also minimize our future problems by putting together code that we know works.
Implementing Test Cases
In our case, we use print statements to troubleshoot certain sections of the code. This is helpful since we are able to check things like sensor data, determine whether the issue is hardware/software, or test whether our system is behaving as expected.