It is now possible to count on one hand the months we have left until competition. At this time, we enter panic mode. Lucky for us, panic mode isn’t the only mode we will be using. We are going to tackle the programming of the robot with a modular structure, using different modes for the various situations the robot will be in.
Our current modes are Camera Mode, Obstacle Mode, GPS/Navigation Mode, Drive Mode, and Initialization mode.
Initialization Mode will only run when the robot is first turned on. This mode will check all of the sensors, read and parse the control file and then read the first instruction.
Drive Mode will be our least used mode. It simply tells the robot to drive a certain distance in a certain direction. We will use this mode if GPS signal is erratic or unavailable in any part of the course.
Our main mode will most likely be GPS/Navigation Mode. In this mode the robot will be navigating towards a GPS waypoint using GPS and an electronic compass to stay on course. The robot will exit this mode if one of two states are met:
- If the sonar sensors detect on object in front of the car the robot will go into Obstacle Mode.
- If the robot is navigating towards a cone and is within 5 meters of the GPS point the robot will enter Camera Mode.
In Obstacle Mode the robot will attempt to identify whether it will hit the detected object or if it can pass by it safely. If the robot will hit the detected obstacle, it will reverse in a semi-random direction and go back into the mode it was in previously.
In Camera Mode the robot will start receiving data from the camera. If an orange conical shape is detected, the robot will attempt to slowly move towards it. If no cone is detected, the robot will spin around and check if it detects a cone anywhere. If no cone is detected, the robot will go off in a random direction and then go back into GPS/Navigation Mode in order to repeat the process. If worst case scenario no cone is found once again, the robot will move onto the next instruction in the control file.
In Stop Mode our robot will power down and relax with a nice bottle of champagne, if and only if it completed the course.