first tech challenge: thinking like a programmer

my journey with ftc

what is ftc?

ftc, or first tech challenge, is a high school robotics championship. for the last several years, i've been a member and captain of my school's ftc team.

as the only programmer on the team for several years, the burden falls on me to optimize the robot's code so as to avoid piling extrenuous work on future me. the skills i've learned from this apply not only to ftc, but to my primary focus on webdev.

how does this apply?

in one of the past challenges, there were a total of 12 possible positions for the robot to start in at the beginning of the autonomous driving period. rather than create 12 different sets of driving instructions, with one for each position, i went with a much simpler approach.

stepping outside of the box, the robot has several expansion ports for hardware devices. these hardware devices can be interacted with through the robot's software.

a servo is a simple low-power motor that can spin within a preset range between 0 and 1. thorugh testing, i noticed that disconnecting a servo and changing its value before reconnecting it will make the servo motor spin to the updated position upon being plugged back in. this is the key.

using an empty servo port, with a combination of hardware (or, ironically, the absence thereof) and software, temporary values can be stored in the robot's memory, until it loses power. and now that we can store positions as floating point ids, they can be retrieved and modified at runtime, allowing for a more condensed and optimized autonomous codebase.

view on github
does this really help?

absolutely! with this custom hardware interface logic in place, the resulting drive code can be reduced by at least 500%*!

view on github
what did i learn from my years in first?

my quest for optimizations on Popcorn's (our 2023-24 robot) codebase led to me learning many new skills. for example, while writing the object detection algorithm, i probably researched more about opencv than i have about any other singular programming topic.

through youtube tutorials, documentation, and trial and error, i managed to make a fully functional extremely accurate prop detection opencv pipeline.

view on github

making that opencv pipeline, as well as the data servo hack, were some of my most satisfying moments as a programmer. they showed me that i could reach out of my comfort zone to work with hardware components - something i've always been interested in doing.

my expansion to hardware, in combination with a really good ap computer science teacher who would take the time to explain to me some of the lower level operations a computer does, properly broke me into the world of hardware for the first time. i can say with confidence that i walked out of first with more technical knowledge in every area than going in.

thank you, first!

~ a soon to be first alumni