WALTHAM, MASS. -- The man who designed some of the world's most advanced dynamic robots was on a daunting mission: programming his creations to dance to the beat with a mix of fluid, explosive and expressive motions that are almost human.

The results? Almost a year and half of choreography, simulation, programming and upgrades that were capped by two days of filming to produce a video running at less than 3 minutes. The clip, showing robots dancing to the 1962 hit "Do You Love Me?" by The Contours, was an instant hit on social media, attracting more than 23 million views during the first week.

It shows two of Boston Dynamics' humanoid Atlas research robots doing the twist, the mashed potato and other classic moves, joined by Spot, a doglike robot, and Handle, a wheeled robot designed for lifting and moving boxes in a warehouse or truck.

Boston Dynamics founder and chairperson Marc Raibert says what the robot maker learned was far more valuable.

"It turned out that we needed to upgrade the robot in the middle of development in order for it to be strong enough and to have enough energy to do the whole performance without stopping. So that was a real benefit to the design," Raibert says.

The difficult challenge of teaching robots to dance also pushed Boston Dynamics engineers to develop better motion-programming tools that let robots reconcile balance, bouncing and doing a performance simultaneously.

"So we went from having very crude tools for doing that to having very effective rapid-generation tools so that by the time we were done, we could generate new dance steps very quickly and integrate them into the performance," Raibert says.

The quality of the robots' dancing was so good that some viewers online said they couldn't believe their eyes. Some applauded the robots' moves and the technology powering them. Others appeared to be freaked out by some of their expressive routines.

Others added that what they were seeing was probably computer-generated imagery, or CGI.

Not so, Raibert says.

What was on display was a results of long, hard work fueled by a determination to program the robot to dance to the beat, he says.

"We didn't want a robot doing robotlike dancing. We wanted it to do human dancing and, you know, when a human dances, the music has a beat and their whole body moves to it -- their hands, their body, their head," he says. "And we tried to get all of those things involved and co-ordinated so that it, you know, it was ... it looked like the robot was having fun and really moved with the music. And I think that had a lot to do with the result of the production."

Teaching robots to dance with fluid and expressive motions was a new challenge for a company that spent years building robots that have functional abilities like walking, navigating in rough terrain, pick things up with their hands and use attached advanced sensors to monitor and sense many things, Raibert says.

"You know, our job is to try and stretch the boundaries of what robots can do, both in terms of the outer research boundary, but also in terms of practical applications. And I think when people see the new things that robots can do, it excites them," he says.

The advanced Atlas robot relies on a wide array of sensors to execute the dance moves, including 28 actuators -- devices that serve as muscles by converting electronic or physical signal into movement -- as well as a gyroscope that helps it to balance, and three quad-core onboard computers, including one that processes perception signals and two that control movement.

Still, the fact that video of the dancing robots has fired up the public imagination and inspired a sense of awe was gratifying, Raibert says.

"We hoped ... that people would enjoy it and they seem to. We've gotten calls from all around the world," Raibert says. "We got a call from one of the sound engineers who had recorded the original Contours performance back in the '60s. And he said that his whole crew of Motown friends had been passing it around and been excited by it."