Mandy Rosengren
Final Project: Mini Golf
5/1/2020
Goal
This robot was part of a large Rube Goldberg Machine that spanned across the United States. The goal for this robot was to move a ball from one place to another in an interesting way. This portion of the Rube Goldberg machine is inspired by a mini golf game. The ball is hit by the mini golf club, passes through the windmill, rolls around and hits the ultrasonic sensor utilizing System Link Cloud and machine learning to do so.
​
The Process: Version 1 and 2
Version 2

Version 1

Truck Design
The second version of the mini golf track featured a motor to hit the ball, and an ultrasonic sensor to determine the end of the track. Originally, the program ended with a touch button sensor, but the ball was too light for the touch sensor to recognize it. This track also brings the ball back to the beginning due to the uneven floor and the position of the track. The original track consisted of a "truck" that would move out of the way of the touch sensor when the ball was about to pass. Unfortunately, the truck was eliminated from the mini golf course, as the wires connecting it to the EV3 became a problem in the movement of the ball, and the track was too short for the ultrasonic sensor to work well.
The Process: Version 3

The final version of the mini golf course included all of the features in Version 2 as well as the addition of a windmill. This version incorporates machine learning using K Nearest Neighbors to choose the optimal time to hit the ball and avoid the turbines of the windmill. The windmill begins to move when the System Link Cloud tag labeled "Start03" is set to true. When this occurs the machine learning with KNN begins. Once the program is trained, the ball is hit by the miniature golf club at the right time. The ball travels to the C shaped Styrofoam and around to hit the ultrasonic sensor. Once it travels 5 cm close to the ultrasonic sensor, the key tag for the next portion to the Rube Goldberg machine is set to 'true' and the 'Start03' tag returns to false.
​

Training the Robot


To train the robot, I created the train function that stores the value of the ultrasonic sensor when the windmill turbine is in different locations. The robot first records the ultrasonic sensor when turbine is in the path of the windmill. With each loop, the angle of the turbine rotates by one degree, and this continues for 22 degrees. Then, the training collects the data when the path is open to the ball. This data is stored in wm_open or wm_closed and these two categories are used for K Nearest Neighbors. I chose to collect data 44 times at each angle because there were four wind turbines, so data only needed to be collected from one eighth of the rotation.
Machine Learning
Once there was data for the reading when the ultrasonic sensor was open or closed, I used K Nearest Neighbors to determine when the path was open. If the passage was open, then the golf club would hit the ball. The time to hit the ball and have the ball roll to the windmill correlated well with when the windmill was open. However, in future iterations when the windmill can spin at different speeds, this process would not always work.This program successfully allowed the ball to pass 83% of the time over the course of 50 trials.


System Link Cloud
System Link Cloud was used to start and end the motion of the program. The windmill began to rotate when the tag "Start03" was set to "true". When the ball is 5cm away from the second ultrasonic sensor, the tag "Start03" was set to "false", and the next robot was triggered.

Challenges and Future Improvements
Because I was limited to objects in my house, I was unable to create a hole for the ball to fall into and get a "hole in one". I instead replaced this by having the ball hit the ultrasonic sensor. In the future when I have access to more tools, I hope to make a large mini golf course with many obstacles and a hole that the ball falls into and brings it back to the starting point for the mini golf club to hit. A challenge I also faced was the placement of the track on the floor in my living room. During my second iteration, I had placed the robot on the floor when it was just tilted enough for the ball to roll back to the starting point. However, I had to move my robot off the floor between Version 2 and 3 and could not find this part of the floor again. A challenge with the windmill occured because the starting place of the turbine had to be the same position each time at the start in order for data to be stored correctly as open or closed. To solve this issue, I marked on the floor the proper place for the turbine to be oriented. In future iterations, I plan to include more tags on System Link Cloud, so the user can change the speed of the windmill on their phone. I also would plan to take more training data and utilize different type of machine learning for the windmill to compare which is the most successful. It would also be interesting to utilize teachable machines to hit the ball when a user acts out the swinging motion.
Reflections
After the midterm project, I was determined to use K Nearest Neighbors -- something that I have been struggling with this semester. It is exciting to see K Nearest Neighbor work well, after so many times where it got the best of me. I hope to explore this project with the use of an Arduino Uno instead of a Lego Mindstorm and continue growing my 3D modeling and design skills along with my robotic skills in the future. If I had more time on this assignment, I would have added additional features to the track utilizing different sensors and incorporating teachable machines.
​
Videos
Below are some videos of the mini golf course in action with highlights on each feature. To achieve the cheesy mini golf theme, I included animated food creatures to the track. Watch as the ball avoids the super large coffee to head towards the doughnut!
All Videos
All Videos


VID_20200421_120748

VID_20200421_181050 (3)
