Arduino

Summarized using AI

Dancing with Robots

Julian Cheal • October 28, 2014 • Earth

In the talk titled 'Dancing with Robots,' Julian Cheal explores the intersection of robotics and programming, primarily using Ruby through the R2 library. With a playful tone, he demonstrates how to control various devices, from simple LEDs to complex drones, showcasing the fun and creative aspects of coding for robotics.

Key points discussed in the talk include:

  • Introduction to Robotics with Ruby: Cheal introduces Ruby libraries like R2 for controlling robotics, mentioning alternatives like Sylon JS and Gobot for JavaScript users.
  • Basic Robotics Tasks: The presentation starts with the 'Blink' example, changing LED colors using Ruby code, demonstrating the simplicity and immediate feedback of robotics programming.
  • Advanced Examples: He discusses devices such as the Spark Core, which incorporates cloud functionality, and the DigiSpark, showcasing how these small devices can interact with complex APIs.
  • Demonstration of Drones: A segment centers on controlling a Parrot AR drone using simple Ruby commands. Despite some challenges with Wi-Fi interference, Cheal successfully demonstrates taking off and landing the drone, illustrating user control through programming.
  • Dancing with Robots: The highlight of the presentation is using a PlayStation dance mat to control the drone, merging coding with interactive fun. Cheal emphasizes the entertainment value of programming robotics.
  • Additional Controllers: He introduces other input devices like the Ouya and PS3 controllers, explaining how they can be integrated for robotic control, adding an element of playfulness to coding.
  • Leap Motion Integration: Cheal ends with a demo of the Leap Motion device, hinting at future possibilities for motion-controlled interactions in robotics.

The overarching theme of the talk revolves around making robotics accessible and engaging through programming, emphasizing creativity and fun in the coding experience. Cheal’s energetic presentation leaves the audience with the idea that with a few lines of code, anyone can create engaging, interactive robotic experiences.

Dancing with Robots
Julian Cheal • October 28, 2014 • Earth

Web apps are great and everything, but imagine using Ruby to fly drones and make them dance to the sounds of dubstep! Or to control disco lights and other robots! Sounds fun, right? In this talk, we will not only explore how we can write code to make this possible, but it will also be full of exciting, interactive (and possibly dangerous ;) ) demos!

Help us caption & translate this video!

http://amara.org/v/F2y0/

Rocky Mountain Ruby 2014

00:00:13.799 Hey!
00:00:27.119 Hey, this should be music. Oh, I think... the grand digital frontier. I picture clusters of information as they move to my computer. They look like ships, motorcycles, and foodways.
00:01:07.080 Let me just get started. Um, oh where's the mouse gone? There he is. I'm here today to talk to you about robotics, mainly involving R2, which is a Ruby library to control robots. If you're not so much into Ruby, there's also a JavaScript library called Sylon JS. Sorry, the screen doesn't quite fit. And if you're one of the new hipsters, you can also use Gobot. So you can actually now control robots with various languages.
00:02:04.719 Let's get started! When you use any programming language, the first thing you typically do is 'Hello World.' But in the robotics world, the first thing we do is Blink. So let's get this camera set up and plug this in. So many cables! Okay, let me just get set up over here. Oops! It would help if I could spell right. Let's see if this works.
00:03:02.480 Sorry, let me just plug this in. You'll be able to see everything in a second. For those of you who don't know, this is an Arduino. If I move my camera over here, can we see that? Here's a little Arduino with tons of cables and a little LED that shouldn't be on just yet. The code to turn an LED on and off with R2 is really easy. As you can see, it's just a few lines of code, and we're going to toggle the LED every second. Let's run that now and see if it works.
00:03:43.200 Yay! So that's basically the simplest thing you can do in robotics. To be honest, this is what most of your devices do; they just blink on and off. So we're pretty much there! That's all I got. As you can see, that's just a few lines of code to turn on one LED. You might be thinking, "Well, that's pretty cool, but wouldn't it be great if we could have different colors?" That was obviously just a green LED. It turns out that if you want to do an RGB LED, it's like having one LED but with three colors: red, green, and blue.
00:04:41.639 This code here is slightly longer but not really that different. It randomizes turning on and off the different RGB colors. Let me just plug this back in and move my link. I named all my files really helpfully, but I can never remember them when I'm up here. Okay, let's run that. You can't really see that on the screen. Maybe if I hold it up? So, in this few more lines of code, we're basically randomizing RGB colors, which is kind of cool. So with just a little Ruby, you've got your own built-in home disco. So that's pretty cool, right?
00:06:11.199 The really cool thing with R2 is that it's written in Ruby. A company called Hybrid Group, based in LA, has rewritten Ruby Serial, which makes all of this possible. Before, you had to have C bindings, but thanks to their hard work, Ruby Serial now works across MRI and JRuby. If you could do me a favor and tweet Ron, the developer, saying, "Hey Ron, thanks for Ruby Serial! You're awesome!" That would be brilliant. If it wasn't for this guy, I would just be standing here doing nothing.
00:07:05.280 Okay, so what have we done? We've turned on one LED and turned on three LEDs in one little box, and that's kind of cool. Let's have a look at my list to see what's next. Ah, yes! I've got my little box of tricks down here. Unfortunately, due to the Wi-Fi, I couldn't get this little guy working. I'll hold it up to the camera. This is a Spark Core—it's basically an Arduino-compatible device with built-in Wi-Fi.
00:07:39.440 The really cool thing with it is that it has a whole Cloud infrastructure behind it, allowing you to create an API for your LEDs. You can do all sorts of crazy things with that! For instance, people have used it so that when someone rings their doorbell, it will flash a light when they're down at the pub, letting them know someone is at their house. It's all kinds of crazy. Unfortunately, though, because the Wi-Fi is being a bit flaky, I couldn't get it working. You can come and have a look at this later; it's really cool. It's by an American company that started on Kickstarter, and it's pretty awesome!
00:08:27.120 Let me just unplug this. Okay, right, Google Chrome! This is a really nice and simple demo. I don't know if you can see this; it's basically two tiny little LEDs on something no bigger than a USB socket. It's called a DigiSpark. It's kind of like an Arduino but incredibly small. So if we just plug this in and run the code, you can see it's so small it just plugs right into your laptop, and you wouldn’t even notice it.
00:09:03.920 It would be really cool if you could have it connected up to something like Travis CI, so you'd know if your build is working or if it breaks. Let's just imagine we're running Travis: "Yay, it works!" or, "No, it doesn't!" So as you can see, it's just really simple. We just tell it which pins the LEDs are in, and we instruct it to toggle every second. You could connect this up to Travis or anything like that.
00:10:36.000 So, the cool thing about this is it's all just programming. This is an RGB LED strip with 60 LEDs on it, so you don’t need much more code than what we've seen. If you know how to use arrays in Ruby, you can pretty much control the whole thing. So if I find the other end of this cable... this RGB LED strip is from Adafruit, and they have a lot of C code for it. I'm currently porting it to Ruby, so I won’t show you the code because it’s really awful at the moment.
00:11:44.800 But if I plug this in, it should work if I connect it the right way around. Yay! Now, as I said, you can have your own disco at home, connect it to music, or connect it to some of my other toys I've got here. It's just so fun! It's really beautiful, and as soon as I release my Ruby library in a few weeks, it should be super simple and usable! So yay, that's great fun!
00:12:41.200 They couldn’t understand why I would want to come to a conference and why anyone would want to listen to me speak. I mean, I'm still wondering that, but I'm glad they let me in, which is really nice of them.
00:13:01.400 Right, okay, so this is a Parrot AR drone. Hopefully, I should be able to connect to it. The only problem is it's Wi-Fi, which tends to have a bit of interference. So, um, where is it? No, aha! Right, simple demo! Let’s see if this works. Again, this is all using R2. It's just a few lines of code, so if the demo gods are with us, it should be able to take off, hover, and then land. So everyone, fingers crossed that this works!
00:14:05.440 Um, where did I call my library? I named them after each device, and I still can’t find it. Sorry, you just look at the flashy lights while I... Oh no! I know it’s in here somewhere. Ah, maybe it’s just this. Oh, sorry, my case has gotten a bit crumpled with flight incidents over the past few months. Let’s put it on the floor. That's better. My case is broken. Sorry about this! Actually, let’s use this case.
00:15:26.480 While I’m finding this, basically, this is more or less like a mobile phone. It's got a camera, a magnetometer, and a sonar. Fingers crossed! Ah, demo Gods, please! Sorry, I think if you could turn off all your Wi-Fi stuff, that might help because it runs over UDP. You know that great... oh no! Sorry! Never work with children, animals, or drones.
00:16:29.360 That’s why I brought two for backup. Okay, last try! Hope this works! I actually live at sea level, and I didn’t realize we were like a mile up. There’s like no air here! I know people get high in Colorado, but I didn’t realize it was from lack of oxygen! Right, okay, let’s try this one.
00:20:00.000 While we're talking about that, I did actually give the wrong talk title. This is actually meant to be 'Dancing with Robots,' not 'Dancing with Drones,' because drones tend to be a loaded word. So every time you talk about it, remember it's robots, not drones. Right? So anyway, this is my PlayStation 2 dance mat, which I'm sure you all have at home.
00:20:40.480 If this works, we should be able to control the drone with a dance mat controller. PS! I’ve actually written the library for this, and I haven’t published it yet on GitHub. But I should probably show you the code, shouldn’t I? Where's the mouse? Oh, there it is! It’s called Drone Style, and basically, we just get the drone to take off.
00:21:59.040 When I press up, it goes up, and when I press down, it goes down! You know, it’s pretty simple stuff; it's not that complicated. This will all be on the R2 Library soon, and you can pick these dance mats up on eBay pretty cheap, which is cool! Let’s see—fingers crossed—let's see if this works!
00:24:06.120 But that's Celsius, so I think that’s hot in Fahrenheit. I’m not sure. Anyway, that’s all of that code. While we've got the drone, let’s find some more bits of toys in here.
00:25:00.640 I was one of the five people in the world who bought an Ouya, so this is actually an Ouya controller. Oh, you got one too? Awesome! I’ve actually written the Ruby library for this. Let me just get that set up.
00:25:55.600 Hang on, let’s just see. Let me just open up my show notes. Completely professional over here! Okay, right. I’ve lost the mouse. There it is! I’ve got a PS3 controller too, which you can use to fly the drone around. But it’s actually more fun to do it with the dance mat.
00:26:27.120 It’s cool because you’ve got the two thumb sticks and can control it. The code is pretty simple; it listens to which button is pressed.
00:27:00.240 If I load up the code, I can re-login, and hopefully, you can see that the O button is pressed when I press it. You can see the 'O' being printed to the screen when the trigger is pressed.
00:27:26.000 You know? The bumpers get pressed. You can use this to control anything. You might be at home wanting to listen to some music or maybe doing some dancing. So now we can listen to music at home. How cool is that? All just with a controller!
00:28:04.840 You could just be walking around and go to your friends and say, "Hey, how are you doing?" and then just control them from behind your back. That’s kind of cool, right? I like that! It’s really fun! As I show you, the code is super simple. It basically uses an evented system.
00:29:03.440 This publishes the event, R2 listens to it, and then the world is your oyster—not a Rocky Mountain oyster, but the world is your oyster! What you do with it is up to you.
00:30:04.480 So that’s controllers too! I’m sorry; I’m so haphazard today, but this is fun, right? Are you having fun? Oh, excellent! Okay, right, more toys! Let’s see if this works. Have any of you ever seen one of these before? Take that as a no. It’s called Leap Motion.
00:31:15.200 The Leap Motion is really cool. It has infrared and cameras that can detect your hand. People use them for games, and they’re now sticking them on the front of an Oculus Rift, which is kind of cool! So, you know, 3D immersion—you can see where your hands are! But me? I like having fun and music.
00:32:06.360 So, what would be cooler than making karaoke? Everyone likes karaoke, right? Let me see if this works. You know the song 'Harder, Better, Faster, Stronger' by Daft Punk? You often see videos of people with it tattooed on their arms doing body movements, and other people are doing all kinds of crazy things. So I thought, why not do it with a Leap Motion?
00:32:54.160 So, basically, it will detect when my hand is near and hopefully play the sounds for the song.
Explore all talks recorded at Rocky Mountain Ruby 2014
+22