top of page

Project Code

The project team began the coding process with the very basics: obstacle avoidance, A-star path optimization and weed detection. The first of these to be tackled was obstacle avoidance. The project team began with this to gain a better understanding of the LADAR sensor: what numerical angles extended in which direction and how close of a threshold was necessary to avoid hitting any obstacles in the course.  Doing this helped the project team eventually write code for the A-star path optimization and could still be included in the weed detection code later on to help avoid sharp corners when moving towards a weed. The obstacle avoidance code was developed using a case structure - if certain LADAR angle values were below a given threshold then the robot would either turn left or right and begin wall following until it was told to break out.  

 

Having developed this basic obstacle avoidance code, the project team turned to A-star to develop the most optimal path to all of the waypoints in the course.  This was done by first hard coding all of the obstacle locations. Obstacles are considered to be each side of a wall of the square crates that can be placed in the course.  The code marks the left, right and center point of each possible wall location. Seven of the LADAR angles were then chosen to use so that whenever an obstacle was detected in one of these LADAR angle locations, Robbie would mark the location on the A-star map. This map allows Robbie to store all of the obstacle locations so that as he goes throughout the course and collects all of this data, he can create the most optimal path for himself to reach different waypoints without running into any obstacles.  

 

The next task for the project team was weed detection. The first step in this process was using Robbie’s camera and a MATLAB program to take photos of the different weeds on the floor and then determine their HSV color values.  To ensure that this process was accurate the project team made sure to include other bright colors in the background, such as the bright green corner panels in the background of the blue weed photos or large sections of the curse walls in the background of the pink weed photos. After determining the HSV values the project team then worked on a turn function which would cause the robot to turn towards the centroid of a weed/color blob if it saw more than 35 pixels of blue or pink in its line of sight.  One neat feature the project team added was that if Robbie turned towards a weed he would calculate the distance from his center to the center of the weed, and then check if that weed location was in his “weeds-visited” array. If it was, he would ignore the weed and continue on to his waypoints. If it was not then he would drive towards it, stop directly over it for one second, exterminate it, and then continue on his way. The project team also included an overarching if statement saying that if the robot was outside of the course, he should not enter into weed detection because there will be no weeds located out there and the project team did not want him getting distracted by shoes.

bottom of page