Learning by Doing
If these posts are interesting to you, please subscribe:
and share!
Introduction
I was planning to write about how the internet works, or glue companies (ex. TSMC, M/VC, Apple via the app store, Epic Games), but then I couldn’t stop thinking about how a project I’m working on to build an autonomous car (referred to as PiCar from now on) has interesting applications for school. Tons of noteworthy concepts have emerged during the build process, which left me wondering “Is there not a better way?” What I mean is, when we teach subjects, why not use more real-world applications. For example, building and programming this car could be used to put some applications behind the math we learn in high school.
If you’ve taken geometry, you’ve likely heard the term sohcahtoa. It’s an acronym for remembering how to work with right triangles to calculate the length of sides given one side and an angle (soh is sine(θ) = Opposite / Hypotenuse). This is a concept we can teach with PiCar and learn a whole lot more in the process.
The Setup
PiCar has a sensor on it that looks like the image below.
This is an ultrasonic sensor which measures the distance to an object through sound waves. The sensor records data for our car to know about its environment: the wave goes out, hits an object, and is sent back. The time it takes the wave to return gives us a distance. Math and formulas already! But also more applicable and more fun!
This information is critical for the car we are building because the car needs to know where an object might be to avoid wrecking. The way the sensor is used on our PiCar is to rotate at 180 degrees on top of the front hood:
Also, this is not too far off from how autonomous robots / cars actually work, which is really cool. But, back to the point: where does sohcahtoa come in? Well, our car operates in a grid that designates where it can and cannot move. Our sensor rotates, so we need to take the current angle of the sensor into account when we receive our distance data to map any objects the sensor detects onto a grid so the car can avoid the object. We do this using trigonometry.
Below is a whiteboard illustration outlining how we take a reading from the sensor and plot it on the grid.
In part A, our sensor (the orange polygon) sends out signals (blue arrows). This signal hits the red box labeled “Object”. One signal hits at -30 degrees and one at 0 degrees. We get two distances back, 10cm and 8cm, respectively. To make this information useful to our car, we need to map these points onto a grid, shown in part C. This is your XY coordinate plane from Algebra.
Part B, we get the location in the XY coordinate plane by using SOH and CAH, the first six letters in SOHCAHTOA. At a 30 degree angle, a hypotenuses of 10cm takes us 5 cm in the -X direction and 8.6cm (which we round down to 8) in the Y direction.
Then in part C, we represent this to our car by placing a 1 on the grid. We also place the 1 for the calculation involving 0 degrees and 8cm. Blank spaces are free for the care to drive on.
Finally for part D (below), we will calculate the slope of these two points.
point1 = (-5, 8)
point2 = (0, 8)
slope = rise over run = (8 - 8) / (-5 - 0) = 0
We calculate the slope because we are going to make the assumption that the two points are the same object and we need to connect the two points with a line. With the slope of 0, we simply fill in the box between the two points and let our car know that it cannot drive there. This means our car will need to go right or left to get around the object. Red arrows are a potential path.
In the Real World
What this looks like in the real life with the PiCar is the following:
The sensor sends data back to the computer allowing a path to be computed:
The blob of ##s is the dogs head (we do not want to hit the pup!) and the “X” are the cars planned path. From this path, we can give the car instructions
And voila, we have a rudimentary autonomous car. While I would not advise taking the car on the road, I do think we showed how math taught in high school can be shown to have exciting applications in the real-world!
Conclusion
The coolest part of all this is the application of the concepts that we learn in high school math classes. Memorizing sohcahtoa is not fun because it is really hard to see how it is useful and feels like memorization for the sake of memorization. But seeing a Tesla drive down the road and knowing that you have a slight idea about the design makes a concept stick a lot more.
Building the car by hooking together different hardware pieces / circuits and then programming the math into the software to send electrical pulses to control a tiny car is kind of a remarkable feat. I think doing this in high school would have led me to a much deeper appreciation of geometry and math. We actually applied the XY coordinate plane in this exercise, a staple of Algebra that we see throughout middle school and high school, to actually do something. y = mx + b
is basically drilled into our brains without much additional context. But here, it quickly comes to life! Feels a lot more fun than drawing on graph paper.
I think it is time we start putting a little more application behind our teaching. What you learn in geometry, algebra and more is happening all around you in the real world. Modeling the real world inside the classroom, makes learning more fun, more engaging and better for the students.
Blooper
And of course, it won’t always go perfectly, so keep learning!
Whoops!
Disclaimer: All opinions expressed by the author are his own opinions and do not reflect the opinion of Old Well Partners. This article is for informational purposes only and should not be relied upon as a basis for investment decisions nor constitute a general or personal recommendation or take into account the particular investment objectives, financial situations, or needs of individual investors. Old Well Partners may maintain positions in the securities discussed in this article.