Teaching A Robot To Dance

Reflections on my first hackathon


This past week I participated in my first hackathon as part of Developer Week NYC.

It was a great experience! I got to play with an awesome new robot and hang out with the people who made it, I got to work on a project with some people I didn’t know, and I even learned a few things.

After participating in the event, I made a list of some things that I think were essential to me having a good experience, as well as some things I could have done to make the experience better.

1. Go into the hackathon knowing what you want to get out of it

Do you want to focus on your front end skills? Maybe you want to experiment with Python. Decide what your personal goal is ahead of time. This is a piece of advice that someone gave me, and it was spot on!

For this hackathon, there were multiple sponsors, each running their own contest. I went into it knowing that I wanted to work with Misty Robotics and I made that my focus. Deciding this ahead of time made it easier to find a team to work with because I was able to zero in on others who wanted to work on the same thing. It also made it easier to set more specific goals as we progressed, because I already had the sense that I was achieving what I set out to do.

2. Don’t be intimidated

I’m pretty new to coding, so I was a bit intimidated walking into a room full of developers and looking for a team to join. In the back of my head I was worried about being the weakest link, and because of that, I felt really uncomfortable approaching people to form a team. Guess what, everybody was new to this once! It’s been my experience that the developer community is a super welcoming and friendly bunch of people. If your honest with the people you talk to about your skill level and what your goals are (see #1), it will be much easier to find a team that fits both your skill level and personality.

3. Once you have an idea stick with it

One of the first things your team is going to have to do is figure out what they’re going to build. Depending on the specifics of your hackathon, there could be a lot of different ideas, and a lot of features that people want to add to your project.

Time is limited, and it’s easy to be overconfident about what you will be able to get done. Just like in real life, it’s imperative to agree upon what your MVP and make sure you have that done before adding that new feature you just thought of.

4. Be organized

It’s also a good idea before you start, to take a minute to talk about the roles of everyone on your team and who is going to be responsible for what. This conversation can be as specific or loose as the situation warrants. It will help ensure that you don’t suddenly realize that you can’t present your project because nobody seeded your database when there are 15 minutes left in the challenge, and you are frantically debugging something.

Bring On The Dancing Robots

Like I said earlier, the project I chose to work on involved playing with Misty, a really cool robot made by Misty Robotics.

Misty has a bunch of capabilities (including proximity sensors, facial recognition, and changeable facial featuresjust to name a few) that respond to JavaScript. Misty’s commands can be sent over wifi, or saved on the robot as actions and executed by sending a POST request.

My partner and I spent most of the first morning of the hackathon just playing around with the robot and learning how she worked.

We brainstormed a bunch of ideas, trying to think of something fun and useful, that would show off the robots features and take advantage of the things that set her apart from other types of devices.

We started out with the lofty goal of trying to create a script that would allow Misty to lead people from one place to another while navigating around objects, kind of like a seeing-eye dog. As we began to explore how to do this, we ran into some difficulties that made this project impossible to pull off at the hackathon. The most significant setback was that Misty’s SLAM (simultaneous localization and mapping) functionality was still in alpha and couldn’t be persisted from one execution of our code to the next. After talking about what was possible with a couple of the Misty Robotics’ developers, we decided to save that idea for another day and go back to the drawing board. Our next plan was something a little more lighthearted. We decided to teach our robot to dance!

The main thing that sets Misty apart from other devices is her mobility, so building a series of steps timed to music seemed like a perfect exercise! After very little debate, we decided on The Hustle.

Our thought was that if you could write a script that made Misty play music and dance to it, you could send her out into your office and have her execute that code at certain times of day, or in response to calendar events and remind everyone to get up and move!

The Hustle.

The first thing we had to do was break the dance down into steps the robot could execute. This is what we came up with:

STEP 1: Play Song
STEP 2: Move backwards for 4 counts
STEP 3: Move forwards for 4 counts
STEP 4: Spin Clockwise for 4 counts
STEP 5: Spin Counter-clockwise for 4 counts
STEP 6: Turn 90 degrees clockwise and tilt head up
STEP 7: Turn 90 degrees counter-clockwise and tilt head down.
STEP 8: Spin for 8 counts and land facing 90 degrees counter-clockwise.
Repeat loop until Misty is facing center again.

Once we had the basic shape of the dance, we also added some decorations into the steps, like changing Misty’s facial expression or the color of the front LED.

There was a lot of trial and error involved. Even though the actions we were trying to get her to do were specific and timed to music, things like the texture of the floor and the speed with which commands were executed meant that we had to do a lot of experimentation and adjustment.

Luckily, the dev team from Misty robotics was sitting right behind us. They were extremely helpful and very eager to talk to us about our experience using Misty, including what kind of things we’d like to see her be able to do in the future. Ultimately, the experience of experimenting with a new piece of gear while having a dialog with her creators, was the most rewarding part of the whole event.

In the end, it turns out that Misty isn’t much better of a dancer than I am. Although, if I’m being completely fair, it may just be that I wasn’t a great teacher.