ML Nexus

Howdy folks! I’ve been thinking about and studying Machine Learning off and on for a year or more now, and have recently started writing another blog covering my thoughts on that subject. If you’re interested in that sort of thing and would like to follow along, come join me at ML Nexus! I’d be glad to have your perspective on the things I’m covering there.

New Chapter at Banjo Digital

I’m happy to share the news that I’m joining up with Banjo Digital, an AR/VR firm in Austin that creates experiences for simulation/training, education, product design, and marketing. I’ll be serving as Technical Director, and will be starting next week. I’m excited about the move and look forward to doing great work together there!

The Electrics: A Long-Winded Story in Three Acts

Act I: 2007

If it weren’t for Ben Mengden, I’d probably never hear any new music. Though I play with various musicians fairly often, I don’t actually turn on the radio and listen to new stuff very frequently at all. (I listened to nothing but The Beatles for about nine months in high school.) Fortunately, I have a few comrades who have both good taste and enthusiasm for sharing, Ben foremost among them.

On a Stupid Guy Trip about 10 years back, several of us were traveling from central Texas to Santa Fe. The drive was long, and we had ample opportunity to visit, to stop and pose with a giant roadrunner sculpture (thanks Stockton!), to play various games in dubious taste, to eat three pounds of beef jerky, and to dig deep into Ben’s CD collection.

“I’ve got a few bands you need to hear!” Ben exclaimed as he led us on a tour through his current listening. Among them were two that I immediately became a fan of: Bright Eyes’ “Balance Beam” instantly caught my attention with Conor’s breaking, nearly out-of-control vocals and the subtle ostinato of the hammered dulcimer — an instrument one almost never hears in popular music — woven subtly into the mix. 

The other was The Electrics.

I’d started playing some traditional Irish with Robert Leahey and Steve Johnson several years previous, with some later encouragement from Brandi Midkiff. Robert and I even went so far as to build some our own pennywhistles out of PVC pipe and wooden dowels. (My hideously ugly low E was still in service until very recently.) But The Electrics took those traditional sounds and added electric guitars, drums, and a whole load of energy and enthusiasm. They were my first introduction to Irish rock, and I loved it. I forced the other passengers to listen to the entirety of their “Livin’ It Up When I Die” album twice more on the trip, and then Ben, ever a generous soul (or possibly wanting to avoid yet another listening session), gave me the disc to take with me. I wore it out.

Act II: 2017

Kris and I got married at the end of April and decided that, since her dear friends Beki Hemingway and Randy Kerkman were living in Wexford, and because it’s a beautiful place to which neither of us had even been, we would go to Ireland for our honeymoon. We took two weeks to tour the Emerald Isle, visiting the Giant’s Causeway, enjoying Guinness and Bulmer’s, seeing the ravages of The Troubles in Belfast, listening to traditional music, flying hawks in Cong, befriending sheep, and hiking through an enchanted forest adjacent to Ashford Castle.

We spent the first days of the trip, however, in Wexford with Randy & Beki. One evening as we were returning from a day trip, Beki asked “Should be stop by and see Sammy and Kylie? They’re married friends of ours, musical missionaries who perform together as a couple. They’re terrific people, and great musicians. You guys should meet them!” A few quick texts verified that they were at home and up for company, so we stopped by.

We pulled up, piled out, and knocked. Sammy immediately answered the door and gave us the warmest welcome imaginable, introducing us to Kylie and regaling us with tales of Ireland and sharing his store of Plopp, the unfortunately-named but delicious Swedish candy. After about thirty minutes of spirited conversation, in the midst of telling us about some of the work that he and Kylie are doing together, Sammy mentioned in passing “my old band.” Wanting to be an engaged guest, I politely asked when the next pause in the conversation came, “What was your old band?”

“The Electrics.”

“WHAT?!?”

“The Electrics. Have you heard of us?”

“You’re freaking KIDDING me. I LOVE The Electrics. You guys were my introduction to Irish rock, and my gateway drug to The Pogues, Dropkick Murphys, and that whole Boston Celtic punk scene. Holy Plopp, that’s fantastic!”

I fanboyed continuously at Sammy for about 5 minutes, after which he very graciously wiped off my enthusiastic spittle and gave us, not only the remaining Plopp, but also the CDs of the The Electrics that I didn’t already have and a thumb drive with all of his and Kylie’s music. The discs were a delight, and became the soundtrack for the rest of our honeymoon, both because of the kindness and generosity they represented, and because they’re some darn fine tunes.

Act III: 2018

A few months ago, back in Texas, I saw that Randy had posted on Facebook: “Just finished co-writing a worship song with Sammy, and I’m pretty excited about it.” Because I’m a believer in the “show, don’t tell” principle of writing, and because I like to give Randy a hard time, I responded with something like “MP3s or it didn’t happen!”

Randy, very appropriately, ignored my jibe. But Sammy messaged me privately and said “Here’s the rough draft we worked on. Pretty jazzed about it!” I gave it a listen, and really dug it. “Great stuff!” I responded with a few details about the things I appreciated about the music and the songwriting. I wrapped up with “Hey, if you need a pennywhistle track, let me know!” (This was, of course, one of those situations where you actually mean it, but realize you’re being a bit pushy and obnoxious and pass it off as a bit of a joke to give the other person a graceful way out.)

Sammy, being a frightfully decent human being, responded with a diplomatic “Well, Tim from The Electrics is coming to record all of the Celtic instruments in a few weeks, but you can have a go if you want.” (Bear in mind that at this point, Sammy and I have never played together, so the possibly imaginary subtext I read here was “Ok, fanboy, settle down and let the grownups do their thing.”)

But I was still excited about the prospect, so I pulled out my Blu mic, stuck it on a stand in my closet among all of the clothes on their hangers to get the driest signal I could (science!), fired up Garage Band, and threw down a few whistle tracks, doing several takes to get them as polished as I was able. I had a grand time working out the parts and recording them, so figured even if Sammy wasn’t keen on them at all, it was still time well spent. 

A couple days later, I got a note back from Sammy. “Hey, there’s some good stuff in here. I think we might be able to use this!” (Possibly imaginary subtext: “Well, maybe you’re not a complete ninny fanboy! Well, not _just_ a complete ninny fanboy!”)

We went through another iteration or two as the song got rewritten a bit, but finally wrapped up that exchange with Sammy telling me “This is great stuff. You’re an honorary Electric!”

My forwarding address for several days was Cloud Nine. Not only had I gotten to meet one my major musical influences, but now through a phenomenally serendipitous series of events had actually gotten to collaborate on a musical project with him from across the ocean. What a treat!

So, if you’re curious about this track, go check out Sammy’s kickstarter for the upcoming 2 disc project Worship Like a Celt. He’s brought a large collection of musicians together to explore the ancient Celtic influence on spirituality and worship. Sammy’s been working terrifically hard to make this a really solid project (as have Kylie, Beki, and Randy), and I’m excited to finally hear the finished product. 

And if you’re ever an hour south of Dublin, you might stop by and say hello. Just don’t forget the Plopp.

On the Market

After 6 educational & exciting years at Mutual Mobile, I am once again officially on the job market!

My ideal position right now would be that of a Technical Director or CTO for a small company. However, I do love development, and would be glad to put my shoulder to the work in Unity, iOS, or web as well. I plan to stay in San Marcos for at least another year, so working remote, in San Antonio, San Marcos, or Austin would be my best options.

I’m currently updating my portfolio, and you can see my resume here. Please email at sean@mcmains.net if you spot anything you think I should have my eye on.

Using Swagger APIs with Unity

February 6, 2018 Update: I figured out a workflow with the experimental .NET 4.6 support in Unity to actually make this work with Daydream, and have updated the workflow here. This solves the annoying caveat that I’d previously posted.

Swagger (aka OpenAPI) lets you define API structure in a machine-readable way. This allows all kinds of cool functionality: automatic docs, code generation across languages, etc. Here’s the workflow we’ve devised for consuming Swagger APIs in Unity. (Note: I’ve tested this on a Mac, but haven’t tried it on a PC yet.)

  1. Load your Swagger specification into the editor at https://app.swaggerhub.com/. (The easiest way is just to copy and paste it into the editor window.)
  2. Verify that the auto-generated documentation on the right looks correct.
  3. Choose “Csharp” from the “Download → Client” dropdown.
  4. Unzip the downloaded csharp-client-generated.zip file.
  5. Open a terminal window.
  6. Go to the directory of the new unzipped download. (e.g. “cd ~/Downloads/csharp-client-generated/“)
  7. Build your DLL: /bin/sh build.sh or build.bat if you’re on windows.
  8. Your DLL is now in the “bin” subdirectory of the downloaded folder and is called “IO.Swagger.dll”. Copy this to your “Scripts” folder in Unity.
  9. Find “Newtonsoft.Json.dll” (packages/Newtonsoft.Json.10.0.3/lib/net45/Newtonsoft.Json.dll) and copy it to your “Scripts” folder in Unity.
  10. Find “RestSharp.Net2.dll” (packages/RestSharp.105.1.0/lib/net452/RestSharp.dll) and copy it to your “Scripts” folder in Unity.
  11. You’ll also need to round up the DataAnnotations DLL from somewhere in your Unity package (Unity.app/Contents/MonoBleedingEdge/lib/mono/4.5/System.ComponentModel.DataAnnotations.dll) and copy it into your “Scripts” folder in Unity.
  12. Unity loads the DLL and makes the IO.Swagger namespace available to you.

Using it:

Take a look in the docs folder of the project you downloaded from the Swagger editor. It includes nice Markup files with C# sample code documenting the APIs in your new DLL. The sample code makes a great starting point for accessing the DLL’s functionality.

Great Big Obnoxious Caveat:

This doesn’t currently work when running on Android due to this bug in Unity’s .NET implementation. We ended up doing a last-minute rewrite to use Best HTTP instead, which was a crying shame. Hoping this bug will indeed be fixed in the future and make this workflow viable on that platform.

 

Ofo Bike Sharing

Out for my morning constitutional in an unfamiliar Dallas neighborhood this morning, I stumbled across a couple of bikes that weren’t chained up, seemed in good repair, but were conspicuously not stolen. “Odd!” I thought, and slipped across the street to take a closer look.

Their frames were of the 40 pound, nearly-indestructible sort favored by bike rental companies and they were painted a bright yellow. As I got close enough to read the placard in the basket, I realized that’s just what they were. They were owned by Ofo, a company I hadn’t heard of, but which promised the first ride free, the drug dealer’s favorite promotional strategy. (They evidently just started operations in Dallas.) I downloaded the app, entered by credit card info, and used it to unlock the bike and tool around the neighboorhood for a while.

The ride was fun. A cheery bell on one handlebar and a three speed shifter on the other meant ensured that I didn’t run anybody down nor get going too fast — probably a sensible thing, given that Ofo neither provided nor encouraged helmets. The bike itself featured a sturdy basket and was big, heavy, and rigid — good for basic commuting tasks, but nothing you’d want for super-long distances. And the $1/hour rate was eminently reasonable and much more favorable than the other bike rental services I’ve tried.

Ofo’s big innovation seems to be not using docking stations. They rely on users to park the bikes legally wherever they end their trips. This doubtless saves costs, but does seem to open up the bikes for theft. They combat this by using bikes that are pretty clunky and unattractive (not a strategy that has worked completely effectively for bowling shoes). There’s already a cellular radio onboard to allow the bikes to be unlocked. While the app asks for GPS access on your phone, presumably there’s a GPS chip as well on the bike so if someone does toss one in the back of a truck, they can keep track of where it goes.

All in all, I think this is a great idea. Cheaper rates for bike rental combined with the broader distribution of the vehicles possible without the need for docking stations improved the bike renter’s experience markedly. Seeing bikes scattered around a neighborhood is visually charming in a way that dock-based rental systems aren’t. I think Ofo has a good idea and business model if they can turn a profit with their low rates. The 5 star reviews for their app on the app store would seem to agree.

Getting Unity and Arduino Working Together

Yesterday I set myself a goal of getting Unity talking to Arduino, the microcontroller that’s hugely popular in the maker community. I was interested in doing so because several of our VR projects have been site-specific installations that could benefit from a large LED scoreboard, physical actuators (rumble motors, heat lamps, fans, etc.) to heighten the experience, or just a “This person flailing his arms around can’t see you; please stand back!” warning light.

Fortunately, given than both Unity and Arduino are very popular, this path is fairly well-trodden already. The most common approach is to establish a serial connection between the computer running Unity and the Arduino board. This is straightforward to do, though it requires tweaking a few settings in Unity to allow access to the serial libraries.

For the Arduinos that have USB port, the physical connection is as simple as plugging in a USB cable. For the boards that have only serial pins, wiring in a converter chip will be necessary to bridge the two. I used the Arduino Uno since it supports USB and I didn’t feel like soldering.

The next decision is whether to write your code from scratch or to use a library to ease this task. If you’re more of a DIY person, the amount of code you have to write isn’t outrageous. Alan Zucconi has an excellent article that will guide you through what you need on both systems.

If you’re looking to get up and running quickly, however, you may prefer one of the options available in the Unity Asset Store. These come with all the code you need for many use cases already written, a variety of examples, and niceties like custom UI in the Unity editor. I ended up using Marc Teyssier’s excellent Uduino package, which has good documentation and supports digital input and output, analog input and output, and servo motor control out of the box.

(I ended up having trouble at first, as my board wasn’t setting the pin mode to digital output when the code commanded it to. I wasn’t sure whether this was a problem with my board or with the code, but adding some additional commands to the Arduino code to make sure that the pin mode got reset cleared up the problem.)

I rigged up a simple relay circuit, created a sample scene, and before too long, had a light in my living room turning on and off with the scene lighting in Unity. Viola!

This is merely a proof of concept — a technical spike to sort out some unknowns. Now that we’ve got these waters mapped, I hope to add some production physical effects to future projects. Excelsior!

Moving to VR

About a year ago, I decided it was time for a career shift. I managed a fabulous team of mobile developers who were a joy to work with, but I missed creating things. I talked to my boss at Mutual Mobile about the problem; he encouraged me to chart out a way back to an engineer role within the company.

I thought carefully about my options. I could go back to iOS engineering, which my previous boss had done. He was delighted with the change and had no regrets whatever about stepping down from management to an engineering job. But I enjoy learning and figuring out new things and, while iOS is a fantastically enjoyable platform to develop for, iOS 10 seemed pretty mature. I moved from web development to mobile because the web stopped feeling like the wild west. Now I had the same sense about mobile.

So I looked at alternatives. Mutual Mobile had a months-old Virtual Reality practice at that point that was gaining steam. While I hadn’t yet spent any serious time with Unity, which the team uses for its work, my son and some of my fellow engineers both had and were clearly enjoying the experience.

I floated my plan to retool myself into a VR engineer to my boss and the VR team, all of whom were gracious enough to give it an enthusiastic thumbs-up. So in early 2017, I began a self-administered crash course in Unity and VR. I found Unity’s online training materials to be excellent, and by the time we executed my official transition to the VR team, I was able to jump in and contribute to the team without a problem.

(I was still green compared to the other two excellent engineers working on our projects, but made up for it by continuing to do management of our engineering and project management teams.)

I’ve now gotten to contribute to a Cardboard project and do all the engineering for an Oculus Rift project. (The former should be available in the mobile app stores soon, and the latter will be installed in the Bass Pro HQ in Springfield in a few weeks.) The team’s also doing work with several other really interesting clients; I’m excited about the work ahead.

Now that I’m past the initial hurdles in Unity, I’m learning things I think might benefit other developers and/or VR enthusiasts. Accordingly, I’m going to post things here to document my learning. My areas of particular interest include: Good Software Architecture in Unity, Cool Stuff our Team is Doing, Using Physical Props in VR, and Accessibility in VR.

If you’re interested in any of these areas or just in creating VR, please get in touch or just follow along. I’m excited about this next phase of my career, and will be happy to have company!

Honeymoon, Day 5: The Giant’s Causeway and a Train Trip

We earmarked Friday for The Giant’s Causeway. We loaded up early and headed north, stopping only for a quick breakfast along the way. After our arrival and my first Irish Magners cider (which lived up to my friend Jason’s enthusiasm for it), we started our hike down to the Causeway.

I had, of course, heard about the site before, but was still amazed by the reality of it. The regular hexagonal basalt columns are like nothing I’d seen in creation before, and it was easy to see why it is one of Beki’s favorite places in the world. (As a reader, I gave it the highest praise I can offer a place: “I’d love to bring a book and sit here for hours.”) We clambered happily over the rocks for an hour or so, and then hiked up the hillside to enjoy some spectacular views overlooking the causeway and the land around.

We then dropped by the ruins of Dunluce Castle, a nearby site that was beautifully situated on a large outcropping over the sea. We learned a bit about the history of the place, read the slightly self-congratulatory quotes about the importance of the archaeology there, enjoyed more spectacular views, and dodged enthusiastic schoolchildren who were barreling around taking selfies in every cranny of the place.

Randy and Beki then dropped us off in Coleraine to pick up the train to Derry/Londonderry. (Evidently the Irish Republicans call it the former, Loyalists the latter, and there’s strong conviction about it. “There’s no such place as Londonderry, but I can sell you a ticket to Derry” ticketing agents might tell an unsuspecting traveler.) Michael Palin described this as one of the most beautiful rail journeys in the world. We enjoyed gliding past verdant green fields filled with content cows and sheep, as well as vibrant fields of yellow rapeseed crops, and lamented that we didn’t have time to explore Derry before hopping back on the train to Belfast.

Our last stop for the day was The Crown Liquor Saloon, a downtown pub that was restored in 2007. Decorated with elaborate tile, stained glass, and woodwork, and featuring a number of semi-private booths, it was an ideal place to enjoy a drink and dinner.

Honeymoon, Day 4: Travel & Belfast

Thursday was a travel day. We spent the earlier part of the day getting from Ballymoney to Belfast, where we’d be staying for the next couple of nights. The drive was lovely. More of the country unfolded before us as we listened to our new friends Sammy and Kylie. Kris was delighted by the signs that directed us not only to the nearest gas stations but also to the nearest castles, which seemed equally numerous.

Once we got to Belfast, we took a black cab tour around town. This brought home the history of The Troubles in a visceral way, as we saw shrines to those slain on both sides of the conflict. Our guide was in his teens during the peak of the tension and violence, and while he was careful not to skew his account, had clearly seen things that left a mark during that time. Sad and sobering that, while most of the violence in now nearly a generation in the past, that there are still Belfast residents who live in the shadow of “The Peace Wall” and who won’t go to the other side to have a drink. There are few past a certain age who haven’t lost someone to the violence of this conflict.

After the tour, we reconnected with Randy & Beki and enjoyed naps and a hike up the hill to Belfast Castle, a beautiful structure with a bistro and gardens overlooking the port and much of the rest of the city. We were struck by the cat motifs in the decor, and were later delighted by the discovery the legend that, like the ravens in the Tower of London, Belfast Castle would remain safe as long as a cat lived there.

We then headed back into town for dinner at “Made in Belfast,” a delightfully quirky restaurant with locally sourced deliciousness of various kinds. (My Ploughman’s Burger, with Irish beef, Irish cheese, and Irish ham was outstanding!) We then dropped in at The Dirty Onion for a couple pints (my first Irish Guiness!) and live music. It turned out, suprisingly, to be bluegrass. It also turned out, unsurprisingly, to be excellent.