Technology is a new thing for me. I don’t know yet if it’s a difficult thing for me but it’s definitely a new thing. If there was one lesson that I learned in my first semester at ITP it’s that it is a lot easier to learn something new when you put it through a comfortable lens. Now take a look around my website for a second and you’ll see a fair majority of the projects that I did involved baseball. That’s my lens. I never felt…anxious about learning tech in my first semester but I wasn’t totally in love with it either. I was in love with learning but I wasn’t in love with learning tech. Until we got a lesson on how to integrate json files into p5 sketches. That night I went home and spent hours integrating baseball data into code. I mean like, I left my friends alone at a bar for a good hour because I couldn’t stop. It wasn’t even learning anymore it was… I don’t know…exploratory?
This is a rather long winded way to say that now, when I’m learning something new, I often tend to do so through the lens of baseball. So for my first assignment, I wanted to gather all of the Major League ballparks into one document for no reason other than to learn how. There was no, “Oh, I wonder if there’s any correlation in their shapes?” or “How many seem to be located in other rural areas as opposed to urban?” it was just, “Oh, I wonder if I can do this at all.” The bigger questions will come later.
I’m having difficulty embedding the maps to the page so they can be viewed by clicking on each of the links:
In my last blog post regarding this project, I talked about the progress we’d made. We had fabricated a button into a baseball helmet, revamped the sketch so that it would run properly and built a home plate, which looked a little something like this:
At this time in our process, Grant and Katie and I had a sketch that – unbeknownst to us at the time – was about 85% done, a batting helmet that had functionality, and a hollowed out bat. Here’s what remained: coding the FSR’s, putting the vibrating motor sensor into the bat, mounting the Arduino 101 into the bat, making our code more specific and, most importantly, making sure that the bat, helmet and home plate worked in tandem with one another. We knew that in order to reach our goal of being done by Monday night – we wanted to give ourselves at least 24 hours of extra time – we had to start delegating certain tasks. Luckily for Grant and I, Katie is truly a master fabricator; she is the assistant technical director for the Tisch Grad acting program. It was decided that Grant and Katie would start to get more specific with the hardware while I would focus on the code. We would meet up this past Saturday and spend the weekend making sure everything worked together.
I knew that before I could start worrying about how to incorporate all three of the elements of the project together, they had to be working seamlessly individually. The helmet already done with, I focused first on the FSR’s. I wasn’t too concerned about the code on the Arduino side, I was more worried about making each FSR individually trigger something. Essentially, the FSR was going to need to act as a button; once it was pressed something would happen. But because the “button” needed to be on home plate and therefore needed to be stepped on, I figured it would be easiest and most in line with our ‘try-to-make-the-tech-hard-to-see’ aesthetic to stick with the FSR’s. I created some code in p5 from scratch to see if it would work and after tinkering for a few hours, each button triggered a different part of the sketch. Now onto the bat.
Precision, precision, precision. The biggest issue that I faced in my midterm is that there was way too much delay with the bat. You would swing and would have to wait a second before the bat would swing with you. If I was going to try to simulate getting a hit from a professional baseball player, timing would be of the utmost importance. After making sure my ‘handshaking’ was working and removing every console log from the code, I feel there has been a vast improvement in the precision of the bat. However, the issue now lay with a different element of the bat: the vibrating motor.
It was very important to me to make the user feel as if they really got a hit when playing this game. At first I thought I was going to need to use a haptic motor controller to set up different kinds of hits but resident Joe Mango showed me a much easier way: bypass the haptic motor controller and set a regular vibrating motor to a PWM pin. Switch back and forth between having it “high” and having it “low”. I was concerned that “high” wouldn’t be felt throughout the plastic bat but fortunately, the motor produced the perfect amount of vibration. My biggest issue now was how to let the arduino code know when something had been triggered in the p5 code. This lab proved to be instrumental in this working. There are still some issues with this vibrating motor that I will get to later.
Now that all three instruments were working separate from one another, it was time to try to make them work in unison. Daniel Shiffman informed us that in order to maximize efficiency, we would now need to consolidate our three huge pieces of code – we had a code for each mode and were triggering them in the html. While Grant focused on this, I tried to dig into how I was going to make the three elements work together. Turns out you cannot open multiple serial ports in the p5 editor. This was a very alarming shock. Here we were about a week away from everything being due and it just may not work. An hour and a half worth of office hours with Shawn Van Every – whom I cannot thank enough for all of his patience with me – all elements were running pretty well with one another.
Now on to fabrication.
I let Katie know that the vibrating motor needed to be in the lower shaft of the bat and the arduino needed to be at the top. She put an enclosure in the bottom of the bat to isolate the motor, insulated it with foam to prevent additional movement, and cut the bat in half. This way I could have easy access to the motor should it cease to work. With the other half, she made a circular piece of wood to stabilize the center, ran the wire from the motor through that and up to the top where she made a piece of wood to screw to the arduino. Did I tell you she was a genius? She then spray painted the bat to make it look more realistic and less plastic. I think she succeeded.
Onto the home plate. We decided on three colors, Grant fixed the home screen to adjust them while Katie and I spray painted them. Katie added wood paneling to the sides also to give it more of a sheen. She then turned it around and made an enclosure for the Arduino and breadboard that was operating the FSR’s which featured a long wooden piece to prevent the board from moving around at all. With all of the fabrication now done, we decided to spend our additional time on Saturday utilizing the free theater Katie had in the Grad building to film the commercial/instructional video that you saw at the top of the page.
The final step in the process was the perf board. The arduino and Bluetooth that was hooked up to it were going to be moving around a LOT as they are in the main shaft of the bat. Not only do they need to be very stabilized to the bat but the connections need to be super stabilized as well. My first perf board was an utter failure. My second was a success but the header pins on the male to female wires kept breaking off. By my third perf board I became a soldering pro though and I feel like it looks and works pretty well.
With everything done, Grant and I had a few hours to test out all the components together. While we were thrilled that they were working together, there is one area where there could be some improvement: the vibrating motor sensor. We just cannot get it to vibrate at the right time. It seems like there is too much happening even with all of the console logs removed. Perhaps it’s because there is too much in the preload but even when I removed the music files, there was still significant lag. At this point, I’m at a loss and I hope to pick your brain about how I can better correct this in the future.
At the end of the day, this has been an amazing project to work on. It’s so bizarre to look back on that first sketch I did about baseball and think about how far I’ve come. There are so many people that deserve acknowledgement: Joe Mango, Shawn Van Every, Tom Igoe, Dan O’Sullivan and Dan Shiffman, Kat Sullivan, Jingwen Zhu, Justin Peake, Or Fleischer, and I’m sure there are more. Of course, none of this would have happened if not for the dedication and commitment of my partners Grant Henry and Katie Takacs.
I was sitting in Maryland over Thanksgiving. Grant and Katie had decided to get together the weekend after to work on fabrication while I took a few extra days and focused on the coding side of things. At one point, I got a text from them. It was a photo of that grass batters box. I couldn’t believe it; I had a grin from ear to ear. It was so noticeable my dad asked me what was up. I turned my phone to him and showed him the photo. I was just blown away by how awesome it was. “Man,” he said, “this is some group you got, huh?” It sure was.
Virtual Batting Cage Updates
We’ve made a lot of progress in the past couple weeks on our project, mostly in terms of Fabrication and computing. We’ve constructed a helmet equipped with two buttons – one to toggle between pitchers and one to take you to the home screen. The purpose of the pitcher button – located on the brim of the helmet – is to simulate what a hitter may do physically while at the plate. While the .gif below is meant as a comedic exaggeration, it’s not uncommon for a batter to touch the brim of his helmet before taking a pitch; there may be some valuable tar there to make his hands stick to his bat better.
We’ve also constructed a place for the batter to stand when they are taking their ‘at-bat’. The next step for this will be to integrate FSR’s into the home plate. We would also like to signal where the batter should stand.
In terms of the coding, we are making some real great strides as well. Here is a sketch showing what the final background will look like:
And here is a video showing what the final code will look like in terms of pitchers.
Finally there is a preview of what this will look like when this is all tied together.
Virtual Batting Cage
The above video is from a midterm that was the first step towards creating an interactive batting cage that allows users to face off with real pitchers from Major League Baseball. The midterm featured a hollowed out plastic bat fitted with an accelerometer along with an Arduino Uno and is programed so that when a certain location is reached, a swing occurs in a p5 sketch. The p5 sketch itself is a rudimentary batting practice where a “fastball” is thrown at the same speed every few seconds.
While this was certainly enjoyable, it definitely was a bit easy. The next step is to take actual data from five separate pitchers – Noah Syndergaard, Clayton Kershaw, Yu Darvish, Mariano Rivera and Tim Wakefield – and code it into the sketch. Rather than use all of the data made available though – my source for all of this is Fangraphs – I boiled it down to what was essential for the sketch: the pitcher’s arsenal, the max/min velocity for each speed, the frequency which it was thrown and it’s xMov. The bat will also be fitted with a vibrating motor disc and haptic motor controller so that when the user gets a hit the bat will vibrate depending on if they made good contact or not. Let’s say the user is having too much difficulty hitting Clayton Kershaw. They can press a button located on the batting helmet they will be wearing to change pitchers. Let’s say the best the Show has to offer is too difficult for them. They can step on home plate to change game modes. Ultimately, when this is all said and done, I would love to take the final and make it a VR experience.
If you’re interested in seeing the final first hand it will be on display at the ITP Winter Show on December 18th and 19th and you can check my progress with it here.
P.S. In case you’re thinking to yourself: “Rivera? Wakefield?!” I’ve got two friends working on the project who are Yankees and Red Sox fans and while I am a die-hard Orioles fan, I couldn’t bring myself to put Dylan Bundy or Mike Mussina or like…Kevin Brown – can you believe he was an Oriole? – into the sketch. Though a part of me wanted to put Arrieta in there and just have him throw his cutter as a big middle finger to the Orioles pitching staff.
The below is an example and is much better viewed in full screen
So for this assignment I knew that I wanted to do something with baseball data. Luckily for me, baseball data is plentiful and easy to access; my go to is Fangraphs.
It’s easy to visualize baseball data but difficult to do so in a way that can be revealing. Anyone can great a histogram of all the HR’s that have been hit in June or by left handed batters, but that data visualization doesn’t really serve to reveal anything. I was curious in how the data can inform me of something that I didn’t know before.
In the past ten years or so, or definitely since the release of the novel and movie Moneyball, the baseball world has been obsessed with sabermetrics which is the application of statistical analysis to baseball. One of the key statistics to come out of the sabermetrics movement has been BABIP which can be described in depth if you click the link in the sketch. For better or worse though, it’s essentially a comparative statistic that reveals how lucky a batter has been in a given stretch. There is a career BABIP that is only created after 1,000 at-bats, and a players more recent numbers are compared to his career numbers to see if he’s getting luckier than usual or not.
This sketch is the beginning of what I hope to be a bigger project which is generating my own Fantasy Baseball draft software. I’d love for users to be able to have these sort of visual comparisons for a lot more fields than just BABIP.
Baseball is a huge part of my life. Growing up, I was – and still am – an avid Baltimore Orioles fan. While my interest in the team is yet to wain (despite the organization’s best efforts) my obsession has leaked out of Camden Yards and into the sport of baseball as a whole. Be it exhibition, regular season or playoffs, if there’s a baseball game on, I want to watch it. Rather then keep this to myself then, I decided to try my hand at writing and eventually talking about baseball. Enter Pitcher List.
Above is a .gif of a FILTHY Knuckleball that Steven Wright threw to Lorenzo Cain. While this wasn’t the exact .gif that brought me to pitcherlist, it was .gifs just like these that had me coming back to it every morning. On a whim, I decided to e-mail the creator of the site, Nick Pollack who was kind enough to let me write for the site. It’s important to know that the site is primarily focused – at least in it’s application – on Fantasy Baseball. Considering the site had been around for a while, most of the main content you’d want to read about Fantasy Baseball like who to stream or who was over/under performing, was already being written about so I decided to tackle a lesser discussed subject: the minors.
My section of the website – shown here – was published weekly and talked about which minor league pitchers should be on your radar. I was keeping track of the more obvious prospects like Julio Urias and Tyler Glasnow but I did my best to dig deeper. I’m proud to say that I called a few things, too: I was much higher on Jameson Taillon than Tyler Glasnow, I predicted that Lucas Giolito wasn’t going to have it this year, I warned everyone that Alex Reyes was going to primarily come out of the pen and even went so far as to convince some people that Joe Musgrove was a good idea.
No Laughing Matter
The first idea I had for this project came to me very quickly. Originally, I wanted to get a piece of wood, put two toy soldiers on opposite ends and use DC and Servo motors to have them pass something from the right side to the left. Knowing that would be very difficult in a short span of time, I simplified my idea. I would keep the object going from right to left but make it look like it’s orbiting! Maybe I could make a few planets pop out from the wood and orbit around one another? Nah, still too complex to do in less than a week. The idea of things popping out a bit really stuck with me though, it reminded me of old storybooks, which got me thinking about comic books. I used to be a big Batman nerd and the frame of the Joker laughing from “The Killing Joke” always stuck out in my mind so I figured why not try to do that.
I started by creating a model out of cardboard. I designed the background in illustrator and photoshop. Once I was happy with the background, I hand traced the Joker’s body onto the cardboard. This was just so I could get a reference of how much mat I needed to buy and how big I wanted my canvas to be. After the initial canvas was set I cut out a rough sketch of the Joker’s head on cardboard. I wanted the background to be the famous image but I wanted the project to have some depth hence making a different, slightly larger head. I knew I could take this head and put it on something – likely wood – that would have my motor enclosed in it.
Happy with the dimensions of all my things I made my Joker image on Photoshop/Illustrator which took quite a bit of time. Before I etched that on anything though I needed to decide what I was going to be etching on. I know I wanted to use mat board but how much and what color? I decided to have a green background covered up by a black mat board with the words HA cut out from it repeatedly. I figured this would give me depth and make the HA’s pop a bit more. I knew I had to incorporate the Joker Purple into the project too and that I would either want his face or his gloves to be white. So I went out and bought a bunch of green, purple, white and black mat from Blick.
I took my black mat and cut out the HA’s and it came out…ok. I was dumb and didn’t realize that the tiny part of the A’s would fall out because they wouldn’t be attached to anything. Also, because there were so many HA’s spread out over such a large canvas, some cut out very easily where as others were a bit more stubborn. With the HA’s cut out, rather then cut again I thought it would be cool to write in the section that was missing from the A’s myself. I thought by having a more human element, the HA’s would convey a tone closer to that of the Joker’s than a clean and neat one.
With the background done, I etched the Joker’s body and face for the background. Instead of using the laser to cut this though, I cut it out by hand with a box cutter, which went through the mat really easily and saved me a lot of time; it would’ve taken forever to cut out the joker the way I wanted I think. With the background fully done, all I needed to do now was find something that would let me attach a servo to it and elevate the Joker’s head and make the actual Joker head. I found perfect wood block in the shop and bore a 1” hole into it with the drill press (I measured the servo before hand to make sure the size was correct). I then bore a 0.5” hole into the side so that I could run my wire through it. Originally I was going to drill my servo into the block of wood but there was no need as the servo fit snuggly into the hole.
I measured out a proper size for the Joker’s head and etched it in purple and green mat. I wanted to cut out the hair from the green mat and cut out the space where it would go in the purple but when I tried to do it by hand it was super sloppy and didn’t look too great. By this point in the project, I hadn’t used the white mat at all and I was curious to see what the etch would look like on it. What came out was sort of glossy and had a nice…sheen to it I guess you could say. I figured I could take the purple gloves from the purple mat, cut them out and glue them to the white head to continue to add depth and when I tried it I was really pleased with the result.
With all the different components now made, all that remained was figuring out positioning for the wood block. I glued one of the plastic detachable servo motor pieces to the point on the Joker’s head that I wanted it to pivot from and attached it to the servo. I moved the block to a place where I was happy with and glued it with wood glue to that spot. There was so much surface area to cover with glue so I knew that the slightly heavy block wouldn’t be going anywhere.
Once the glue was set, I programmed the servo and gave it a test run and it turned out really well!
When I first got hired to work at PitcherList, founder Nick Pollack asked me about what additions I wanted to see to the site. My first answer: a podcast.
I admit, this was a bit selfish of me. I had wanted to start a baseball podcast for some time and I knew that Nick would be the perfect co-host to do it with me.
As of this week , we have recorded 16 episodes, and are looking forward to podcasting once a week once the 2017 season kicks off.