WEBVTT 00:00:15.500 --> 00:00:17.900 RON EVANS: Good afternoon everybody. 00:00:17.980 --> 00:00:19.599 AUDIENCE: Good afternoon! 00:00:19.599 --> 00:00:22.669 R.E.: This is RubyConf 2013! 00:00:22.669 --> 00:00:24.330 AUDIENCE: Whoo! 00:00:24.330 --> 00:00:28.089 R.E.: Yeah! So before we get started, we just 00:00:28.089 --> 00:00:30.359 want to say a very special thank you to 00:00:30.359 --> 00:00:32.549 the organizers of Ruby Central and to all the 00:00:32.549 --> 00:00:34.780 conference staff, the sponsors, and to all of you 00:00:34.780 --> 00:00:36.610 for being here. Thank you so very much, let's 00:00:36.610 --> 00:00:38.790 give a big round of applause for everybody. 00:00:44.710 --> 00:00:47.739 So I am @deadprogram, aka Ron Evans in the 00:00:47.739 --> 00:00:51.579 real world. I'm the ringleader of the @hybrid_group. This 00:00:51.579 --> 00:00:55.690 other guy over here is @adzankich, aka, Adrian Zankich. 00:00:55.690 --> 00:00:59.420 He is the serious programming guy at the @hybrid_group. 00:00:59.420 --> 00:01:00.570 So he does all the work and I take 00:01:00.570 --> 00:01:03.829 all the credit. Yeah. 00:01:03.829 --> 00:01:07.500 I love how that gets applause. 00:01:07.500 --> 00:01:10.040 So we're with the HubridGroup. We are a software 00:01:10.040 --> 00:01:14.950 development consultancy based in sunny Los Angelos, California. And 00:01:14.950 --> 00:01:18.810 among other things, we are the creators of KidsRuby. 00:01:18.810 --> 00:01:24.270 How did you guys like my new boss this 00:01:24.270 --> 00:01:27.880 morning? She's awesome, right. The funny part if you're 00:01:27.880 --> 00:01:31.210 kid- you think I'm kidding. Yeah. So, but here 00:01:31.210 --> 00:01:33.680 today we are here to talk to you on 00:01:33.680 --> 00:01:38.120 Ruby on robots. Zzzz-zzzz. 00:01:38.120 --> 00:01:40.470 This robot is not with us today. 00:01:40.470 --> 00:01:42.570 So let me ask you, is innovation dead? 00:01:42.570 --> 00:01:44.030 AUDIENCE: No! Yes! 00:01:44.030 --> 00:01:47.110 R.E.: I mean, William Gibson said the future is 00:01:47.110 --> 00:01:51.040 already here, it's just not very evenly distributed. Isn't 00:01:51.040 --> 00:01:53.590 that really true? I mean, many of us have 00:01:53.590 --> 00:01:56.210 been doing web development for years, and yet we've 00:01:56.210 --> 00:01:59.270 been seeing a very interesting thing happening as we've 00:01:59.270 --> 00:02:01.190 been creating all these different technologies. 00:02:01.190 --> 00:02:04.020 We've discovered that innovating is really hard. I mean, 00:02:04.020 --> 00:02:07.210 doing something genuinely different. And, in fact, it's especially 00:02:07.210 --> 00:02:11.879 hard when you're dealing with hardware. So about six 00:02:11.879 --> 00:02:14.510 years ago, my younger brother Damien and I started 00:02:14.510 --> 00:02:17.280 building unmanned aerial vehicles using Ruby. A number of 00:02:17.280 --> 00:02:19.799 people remember that. And we had to source parts 00:02:19.799 --> 00:02:22.950 from literally all over the globe, AKA China. And 00:02:22.950 --> 00:02:25.629 they would ship us these really amazing microcontrollers and 00:02:25.629 --> 00:02:26.840 we would put them in blimps and they would 00:02:26.840 --> 00:02:28.840 burn up and we would order more. 00:02:28.840 --> 00:02:30.750 Nowadays though you can go to the Apple store 00:02:30.750 --> 00:02:32.909 and buy several different kinds of robots. I mean, 00:02:32.909 --> 00:02:36.400 the robot revolution is already here. So we're here 00:02:36.400 --> 00:02:39.260 to introduce to you Artoo, which is Ruby on 00:02:39.260 --> 00:02:42.510 robots. It is a Ruby framework for robotics and 00:02:42.510 --> 00:02:47.569 physical computing. It supports multiple hardware devices, different hardware 00:02:47.569 --> 00:02:52.840 devices, and multiple hardware devices at the same time. 00:02:52.840 --> 00:02:53.260 In Ruby? 00:02:53.260 --> 00:02:55.659 I mean, are we serious? 00:02:55.659 --> 00:02:58.920 Yes! We are extremely serious, and the reason for 00:02:58.920 --> 00:03:01.980 that is a remarkable piece of technology called Celluloid. 00:03:01.980 --> 00:03:04.530 Tony, are you here, by any chance? You bailed 00:03:04.530 --> 00:03:06.769 on my talk? What's up with that? 00:03:06.769 --> 00:03:08.489 So anyway, a bunch of the committers from Celluloid 00:03:08.489 --> 00:03:10.909 are here, and actually this is probably the, one 00:03:10.909 --> 00:03:13.060 of the most important technologies to occur in the 00:03:13.060 --> 00:03:15.700 entire Ruby community in years, and if you're not 00:03:15.700 --> 00:03:17.090 paying attention to this, you need to be. 00:03:17.090 --> 00:03:18.829 In fact, you're probably using it right now, if 00:03:18.829 --> 00:03:21.620 you use SideKiq, which is another great project. So 00:03:21.620 --> 00:03:24.260 it runs on the MRI Ruby, of course. It 00:03:24.260 --> 00:03:27.260 runs far better, however, on JRuby, thanks to the 00:03:27.260 --> 00:03:30.049 concurrency of the JVM - excellent piece of software. 00:03:30.049 --> 00:03:32.709 You probably saw Charles and Tom's talk earlier. Great 00:03:32.709 --> 00:03:33.209 work. 00:03:33.209 --> 00:03:34.870 But, we're gonna be showing most of our demos 00:03:34.870 --> 00:03:38.420 today on Rubinius. The Ruby of the future. If 00:03:38.420 --> 00:03:41.450 you love any of these projects, please go help 00:03:41.450 --> 00:03:44.379 them. Bryan Sharrai is here. Bryan, are you, are 00:03:44.379 --> 00:03:47.170 you here? Oh, he's probably with his daughter. 00:03:47.170 --> 00:03:50.310 Where are all my friends? Anyway, these - 00:03:50.310 --> 00:03:52.549 AUDIENCE: I'll be your friend! 00:03:52.549 --> 00:03:54.669 R.E.: Aww! Giant hugs! 00:03:54.669 --> 00:03:57.060 Channeling my inner tenderlove. 00:03:57.060 --> 00:04:00.019 So, anyway, this is an amazing project. It just 00:04:00.019 --> 00:04:02.419 reached the 2 point 0 release, and Rubinius X 00:04:02.419 --> 00:04:05.219 has been announced. There's really exciting things happening to 00:04:05.219 --> 00:04:07.340 it, and it's an important part of, really a 00:04:07.340 --> 00:04:09.810 pillar of the future of Ruby. 00:04:09.810 --> 00:04:13.469 Anyway, back to Artoo. So Artoo is to robotics 00:04:13.469 --> 00:04:16.120 like Rails is to web development. I'm gonna say 00:04:16.120 --> 00:04:18.940 that again cause it's really, really important. Artoo is 00:04:18.940 --> 00:04:22.300 to robotics like Rails is to web development. Actually, 00:04:22.300 --> 00:04:24.350 it might be a little bit more like Sinatra, 00:04:24.350 --> 00:04:26.600 as you can tell from this code example. 00:04:26.600 --> 00:04:29.190 So you see, first of all, we require Artoo. 00:04:29.190 --> 00:04:31.700 Then we're going to declare a connection to an 00:04:31.700 --> 00:04:35.480 :arduino that's going to use an adapter called :firmata, 00:04:35.480 --> 00:04:37.040 which is a serial protocol that you can use 00:04:37.040 --> 00:04:41.660 to communicate with various arduinos and arduino-compatible microcontrollers. Then 00:04:41.660 --> 00:04:44.350 we're gonna connect on a particular port. Then we're 00:04:44.350 --> 00:04:45.880 gonna declare a device. 00:04:45.880 --> 00:04:47.970 This device is an LED. It's gonna use the 00:04:47.970 --> 00:04:50.900 LED drive and be connected to pin thirteen. 00:04:50.900 --> 00:04:53.170 Then the work that we're going to do is 00:04:53.170 --> 00:04:56.260 every one second, we're going to led dot toggle, 00:04:56.260 --> 00:04:57.790 which is going to turn the LED either on 00:04:57.790 --> 00:04:59.850 or off. So this is kind of the canonical, 00:04:59.850 --> 00:05:02.640 make an LED blink. So we'll show you that 00:05:02.640 --> 00:05:03.700 in a minute. 00:05:03.700 --> 00:05:05.540 So, Artoo's architecture. We have a couple of very 00:05:05.540 --> 00:05:09.030 important design patterns that we're utilizing within Artoo. Here's 00:05:09.030 --> 00:05:11.590 a little bit of a outline. So the main 00:05:11.590 --> 00:05:14.290 entity in Artoo is, of course, the robot. 00:05:14.290 --> 00:05:16.590 And we have two things underneath that. We have 00:05:16.590 --> 00:05:18.950 the connections, as you saw before, and we have 00:05:18.950 --> 00:05:21.620 devices. Now, we are using the adapter pattern in 00:05:21.620 --> 00:05:25.040 both of these cases. So connections use an adapter, 00:05:25.040 --> 00:05:27.560 we can use, similar to the way ActiveRecord or 00:05:27.560 --> 00:05:30.260 other ORMs work, we can actually use this adap- 00:05:30.260 --> 00:05:32.840 these different adapters to talk to different kinds of 00:05:32.840 --> 00:05:33.310 hardware. 00:05:33.310 --> 00:05:36.340 So where connections control how we actually communicate, whatever 00:05:36.340 --> 00:05:39.640 protocols with the device, then the devices control behaviors. 00:05:39.640 --> 00:05:42.730 LEDs know how to blink, drones know how to 00:05:42.730 --> 00:05:43.750 fly, et cetera. 00:05:43.750 --> 00:05:45.340 And then we are also using the polish and 00:05:45.340 --> 00:05:50.030 subscribe pattern via events. Devices, by their drivers, can 00:05:50.030 --> 00:05:52.560 detect events and then tell the robot about them. 00:05:52.560 --> 00:05:54.900 So it also has an API in Artoo. I 00:05:54.900 --> 00:05:56.620 mean, what good is a robot unless you can 00:05:56.620 --> 00:06:00.240 control it via an API across the intertubes, right? 00:06:00.240 --> 00:06:02.890 So here's a, an example of both a restful 00:06:02.890 --> 00:06:05.120 API and a web sockets API that could be 00:06:05.120 --> 00:06:08.460 used by two different applications to talk to the 00:06:08.460 --> 00:06:11.340 MCP or the master control program, which will then 00:06:11.340 --> 00:06:14.340 control all of the different robots. And there you 00:06:14.340 --> 00:06:15.550 have it. 00:06:15.550 --> 00:06:18.690 Of course, test-driven robotics is very, very important. I 00:06:18.690 --> 00:06:21.390 mean, we are Rubyists and we test first, right. 00:06:21.390 --> 00:06:23.520 Well, traditionally in robotics, the way you do testing 00:06:23.520 --> 00:06:24.940 is you would turn on the robot and jump 00:06:24.940 --> 00:06:26.530 back really fast. 00:06:26.530 --> 00:06:28.950 I have scars. 00:06:28.950 --> 00:06:32.000 However, this is Ruby, and we can do a 00:06:32.000 --> 00:06:34.410 little better. Here's an example of TDR, or test-driven 00:06:34.410 --> 00:06:36.680 robotics, as we call it. In this case, we're 00:06:36.680 --> 00:06:40.060 actually using mini-spec, we're using mocha and we are 00:06:40.060 --> 00:06:42.530 using timecop. So let's take a quick look. 00:06:42.530 --> 00:06:46.180 First, we're gonna declare :start right now. The robot 00:06:46.180 --> 00:06:48.330 is going to be the main robot, which is, 00:06:48.330 --> 00:06:51.370 as you'll remember, very similar to the Sinatra syntax, 00:06:51.370 --> 00:06:55.000 and then before this test, we're going to Timecop.travel 00:06:55.000 --> 00:06:57.890 to the start. Then we start our robot's work. 00:06:57.890 --> 00:07:00.180 It must roll every three seconds. So we travel 00:07:00.180 --> 00:07:02.810 to three seconds after the start. We're going to 00:07:02.810 --> 00:07:05.420 expect a roll command, and then we process messages 00:07:05.420 --> 00:07:07.680 to give Celluloid's mailboxes a chance to catch up 00:07:07.680 --> 00:07:08.900 with its actors. 00:07:08.900 --> 00:07:10.210 So this way we do not have to wait, 00:07:10.210 --> 00:07:12.120 just a little over three seconds to test something 00:07:12.120 --> 00:07:14.710 that takes three seconds. Because otherwise if we wanted 00:07:14.710 --> 00:07:16.620 to test something like turn the sprinklers on once 00:07:16.620 --> 00:07:18.860 a week, we would have to wait a week. 00:07:18.860 --> 00:07:21.710 And that's not good. You think your CI is 00:07:21.710 --> 00:07:23.300 bad, try it with robots. 00:07:23.300 --> 00:07:25.500 So, of course, Artoo also has a command line 00:07:25.500 --> 00:07:28.800 interface, because, two, well one of the important patterns 00:07:28.800 --> 00:07:31.730 that we've discovered, as we call it RobotOps, is 00:07:31.730 --> 00:07:34.450 that you definitely want to use commands to connect 00:07:34.450 --> 00:07:36.260 to all the devices. You do not want to 00:07:36.260 --> 00:07:37.480 do these sort of things manually. 00:07:37.480 --> 00:07:41.530 Anyway, though, I've done enough talking. How about a 00:07:41.530 --> 00:07:45.140 demo? You guy's want to see a demo? 00:07:45.140 --> 00:07:46.040 All right. 00:07:46.040 --> 00:07:47.520 So, the - oh, first thing I'm gonna take 00:07:47.520 --> 00:07:50.960 a look at is the Digispark microcontroller. So the 00:07:50.960 --> 00:07:54.560 Digispark is what we might call the minimum via 00:07:54.560 --> 00:07:58.880 microcontroller. Oh yeah, please. It's very small. We have 00:07:58.880 --> 00:08:01.430 to get it very close. Oh. It would help 00:08:01.430 --> 00:08:06.170 if you had the camera. All right. 00:08:06.170 --> 00:08:09.970 So this is it. It's extremely small. Oh, can't 00:08:09.970 --> 00:08:14.250 see it. I can see it. 00:08:14.250 --> 00:08:20.420 Hey. There it is. 00:08:20.420 --> 00:08:21.840 So this is it. It's a, it's a rather 00:08:21.840 --> 00:08:25.060 small device, as you can tell. It actually, let's 00:08:25.060 --> 00:08:28.000 take the shielf off. This is the Digispark itself. 00:08:28.000 --> 00:08:32.380 It's a very small, well, thank you, it is 00:08:32.380 --> 00:08:36.749 very small, itty-tiny powered microcontroller that actually uses another 00:08:36.749 --> 00:08:40.318 protocol called littlewire, similar to fermanta but it runs 00:08:40.318 --> 00:08:42.469 on even smaller microcontrollers. 00:08:42.469 --> 00:08:45.959 We're good? All right, we're in focus. And we're 00:08:45.959 --> 00:08:48.999 going to use this LED shield that plugs into 00:08:48.999 --> 00:08:52.910 it, it. It's better when it's over here. All 00:08:52.910 --> 00:08:55.230 right, so the program that we're gonna run - 00:08:55.230 --> 00:09:01.569 well, that's not it. That's definitely not it. 00:09:01.569 --> 00:09:04.120 OK, so the program we're gonna run here is, 00:09:04.120 --> 00:09:05.699 the first thing we're gonna do is we're gonna 00:09:05.699 --> 00:09:08.519 connect to the Digispark using the little wire adaptor 00:09:08.519 --> 00:09:10.779 with the vendor in ID since it's a USB 00:09:10.779 --> 00:09:12.800 device. We're gonna connect to the boad to retrieve 00:09:12.800 --> 00:09:15.120 it's device info, which we're gonna display on this 00:09:15.120 --> 00:09:17.079 screen that you won't be able to see. Then 00:09:17.079 --> 00:09:20.199 the LED device, we're going to, again, toggle it 00:09:20.199 --> 00:09:20.839 every second. 00:09:20.839 --> 00:09:22.519 So you see it's exactly the same code as 00:09:22.519 --> 00:09:25.639 we were using with the arduino. See a pattern 00:09:25.639 --> 00:09:27.300 forming? All right. Let's run this. 00:09:27.300 --> 00:09:32.019 Oh, right. The video. 00:09:32.019 --> 00:09:39.019 Executing code. So it should start to flash. A 00:09:40.139 --> 00:09:41.660 three thousand dollar lamp! 00:09:41.660 --> 00:09:47.540 All right. And, and you're applauding. Ha ha ha 00:09:47.540 --> 00:09:50.800 ha! I should be Apple. All right. 00:09:50.800 --> 00:09:53.389 So moving on. So what do you do with 00:09:53.389 --> 00:09:55.970 a flashing LED? Well, we are software developers, and 00:09:55.970 --> 00:09:57.540 of course what we do is we check our 00:09:57.540 --> 00:10:02.579 Travis build status notifications. Yes, the, the build notifier 00:10:02.579 --> 00:10:06.180 is to physical computing like the blog engine was 00:10:06.180 --> 00:10:09.720 to website development. That's the thing you do. All 00:10:09.720 --> 00:10:10.040 right. 00:10:10.040 --> 00:10:12.370 So let's take a look at some code, real 00:10:12.370 --> 00:10:12.889 fast. 00:10:12.889 --> 00:10:15.600 All right. So in this case, we're gonna require 00:10:15.600 --> 00:10:18.160 Artoo, we're gonna require Travis. We're gonna connect to 00:10:18.160 --> 00:10:21.019 the Digispark and its different LEDs. Then we're gonna 00:10:21.019 --> 00:10:23.180 connect to a broken repo that we've called broken 00:10:23.180 --> 00:10:26.540 arrow, in the tradition of flying things that don't 00:10:26.540 --> 00:10:28.839 necessarily work. We're gonna connect to the Travis repo, 00:10:28.839 --> 00:10:31.620 then every ten seconds we're gonna check the repo. 00:10:31.620 --> 00:10:33.180 If the repo is green, we're gonna turn on 00:10:33.180 --> 00:10:36.059 the green LED. When we're tasking it, it's going 00:10:36.059 --> 00:10:37.899 to turn blue, when we're check either the build 00:10:37.899 --> 00:10:40.240 is running or we're checking the Travis status. And 00:10:40.240 --> 00:10:42.620 then if the build fails we're gonna turn red. 00:10:42.620 --> 00:10:44.230 And then last we have a couple of functions. 00:10:44.230 --> 00:10:46.839 One turns on one particular LED and the other 00:10:46.839 --> 00:10:50.490 turns them all off. All right. 00:10:50.490 --> 00:10:57.490 So if this actually works, across the internet, it 00:10:57.540 --> 00:10:59.360 will turn blue that we're checking the Travis build 00:10:59.360 --> 00:11:01.930 status, and it will turn red since broken arrow 00:11:01.930 --> 00:11:08.930 is a broken build. Working. Working. Working. Fail. 00:11:14.779 --> 00:11:18.579 Now, we could go in and fix the build 00:11:18.579 --> 00:11:20.269 but in the interest of time let's just move 00:11:20.269 --> 00:11:22.610 on to the next thing. All right, so what 00:11:22.610 --> 00:11:25.100 is the next thing? 00:11:25.100 --> 00:11:29.620 Oh yes. So one of the greatest things on 00:11:29.620 --> 00:11:34.949 the internet are cats. And the only thing better 00:11:34.949 --> 00:11:40.249 than cats are internet enabled cats. For example, internet 00:11:40.249 --> 00:11:44.379 enabled cat toys. So in this case, we have 00:11:44.379 --> 00:11:48.279 a cool little device that we've made, kind of 00:11:48.279 --> 00:11:50.749 homebrew, but we like it. It's got two servos 00:11:50.749 --> 00:11:53.970 and it plugs into the Digispark, and then is 00:11:53.970 --> 00:11:57.259 connected to this fun little toy. Whoops, get the 00:11:57.259 --> 00:11:58.240 right angle. 00:11:58.240 --> 00:12:01.199 Can you guys see this OK? 00:12:01.199 --> 00:12:02.449 We don't have a cat. They wouldn't let us 00:12:02.449 --> 00:12:05.720 bring one in. We have a robot cat but 00:12:05.720 --> 00:12:06.980 it's not the same. 00:12:06.980 --> 00:12:08.379 All right, so let's take a look at the 00:12:08.379 --> 00:12:13.629 code. Wait, that's something else. Where is the code? 00:12:13.629 --> 00:12:15.420 I forgot to load it. All right. Well, in 00:12:15.420 --> 00:12:21.139 any case, we're using this leap motion. Yes. This 00:12:21.139 --> 00:12:24.240 leap motion is going to allow us to, with 00:12:24.240 --> 00:12:28.869 nothing more than his hand waves, control these servos, 00:12:28.869 --> 00:12:32.119 moving this cat toy to the invisible internet cat 00:12:32.119 --> 00:12:33.600 on the other side. 00:12:33.600 --> 00:12:34.509 Oh, wait. 00:12:34.509 --> 00:12:37.829 K, let's see the toy. 00:12:37.829 --> 00:12:44.829 O.V.: What it's this. There it goes. 00:12:48.610 --> 00:12:51.720 R.E.: All right. 00:12:51.720 --> 00:12:54.829 AUDIENCE: Oh! Whoa! 00:12:54.829 --> 00:13:00.009 R.E.: Ah, we broke it. 00:13:00.009 --> 00:13:04.879 I don't know how long this would last with 00:13:04.879 --> 00:13:08.470 a real cat, but it's still cool. 00:13:08.470 --> 00:13:11.990 Look ma! Just hands! 00:13:11.990 --> 00:13:16.480 Thank you. 00:13:16.480 --> 00:13:22.309 OK. So, so now let's switch to something else. 00:13:22.309 --> 00:13:25.149 The Beaglebone Black. So one of the important robot 00:13:25.149 --> 00:13:26.709 ops patterns that we want to share with you 00:13:26.709 --> 00:13:29.290 is, you do not want to think you are 00:13:29.290 --> 00:13:32.879 going to develop robotics on your notebook computer unless 00:13:32.879 --> 00:13:35.680 you plan on duct taping it to a drone, 00:13:35.680 --> 00:13:37.800 which you might try. It might work. For you. 00:13:37.800 --> 00:13:42.269 On the other hand, there are amazing single board 00:13:42.269 --> 00:13:45.240 system on chip, or SOC Linux computers that are 00:13:45.240 --> 00:13:48.660 very, very inexpensive. The Raspberry Pi is one. Another 00:13:48.660 --> 00:13:50.699 one, though, that is a little bit more powerful 00:13:50.699 --> 00:13:54.509 but is also opensource hardware, is the Beaglebone Black. 00:13:54.509 --> 00:13:58.439 Where is my video? There we go. So the 00:13:58.439 --> 00:14:01.369 Beaglebone Black is a very, very cool, also arm 00:14:01.369 --> 00:14:05.459 coretex powered single board computer. It has a one 00:14:05.459 --> 00:14:08.699 gigahertz processor and 512 megabytes of RAM. In this 00:14:08.699 --> 00:14:11.389 particular case, we are running an Arch Linux distro 00:14:11.389 --> 00:14:13.779 that we have built that is also available on 00:14:13.779 --> 00:14:15.040 the Artoo, a link from the Artoo dot IO 00:14:15.040 --> 00:14:18.329 website where it includes everything you're going to need, 00:14:18.329 --> 00:14:22.230 software wise, to turn this into a complete, full 00:14:22.230 --> 00:14:24.670 physical computing and robotics platform. 00:14:24.670 --> 00:14:27.529 Can you see this OK? There, we need it 00:14:27.529 --> 00:14:29.009 on the other side. 00:14:29.009 --> 00:14:33.410 OK. So let's take a, a closer look. 00:14:33.410 --> 00:14:38.480 It's, it's naked. We have cases, but. 00:14:38.480 --> 00:14:41.889 So, you see that it has a lot of 00:14:41.889 --> 00:14:44.920 different pins that you can plug into for digital 00:14:44.920 --> 00:14:48.689 IO, for analog IO, for pulse with modulation and 00:14:48.689 --> 00:14:52.040 for I2C. Now, I might mention, you saw before 00:14:52.040 --> 00:14:56.379 that we had difference between drivers, and connections. Well, 00:14:56.379 --> 00:14:59.889 we have generic drivers for general purpose IO and 00:14:59.889 --> 00:15:02.769 for I2C devices. So you can actually use these 00:15:02.769 --> 00:15:06.980 same drivers on arduino, on a Raspberry Pi, on 00:15:06.980 --> 00:15:09.329 the Beaglebone Black, on the Digispark, or on any 00:15:09.329 --> 00:15:12.889 other platform that supports Linux GPIO. 00:15:12.889 --> 00:15:15.480 Think about that. Kind of fun. 00:15:15.480 --> 00:15:17.759 So what we're gonna do here is we're going 00:15:17.759 --> 00:15:23.069 to show our - there we go. The blink 00:15:23.069 --> 00:15:26.529 program that we showed before with a slightly different 00:15:26.529 --> 00:15:28.999 syntax, but same idea. Except in this case, we're 00:15:28.999 --> 00:15:30.920 gonna use the connection to the Beaglebone using the 00:15:30.920 --> 00:15:33.699 Beaglebone's adaptor. And we have a slightly different pin 00:15:33.699 --> 00:15:37.040 numbering scheme, because the Beaglebone Black's pins are different 00:15:37.040 --> 00:15:39.429 in a similar fashion that Raspberry Pi pins. 00:15:39.429 --> 00:15:41.439 This is actually what the pin is labeled on 00:15:41.439 --> 00:15:43.980 the device. That way you're not trying to, go 00:15:43.980 --> 00:15:46.089 to a lookup table. Man, there's software for that. 00:15:46.089 --> 00:15:47.069 It's called Artoo. 00:15:47.069 --> 00:15:50.449 All right. Back to the camera. So and now 00:15:50.449 --> 00:15:53.249 we're going to - he's actually SSH pin to 00:15:53.249 --> 00:15:56.129 this Unix computer and is going to make our 00:15:56.129 --> 00:16:01.619 gigantic LED start flashing. 00:16:01.619 --> 00:16:08.619 If all goes well. 00:16:16.199 --> 00:16:20.499 Blink on the Beaglebone. Yes. It's real. 00:16:20.499 --> 00:16:27.499 All right. So that was cool, but can we 00:16:28.790 --> 00:16:32.839 get a little more exciting? Like, yes. So let's 00:16:32.839 --> 00:16:39.800 bring in another toy. Another robotic device. The Sphero. 00:16:39.800 --> 00:16:44.230 So the, the Sphero is from Orotix. Oh, yeah. 00:16:44.230 --> 00:16:47.809 The camera. Oh, camera. 00:16:47.809 --> 00:16:50.749 So the Sphero is a small robotic sphere from 00:16:50.749 --> 00:16:55.959 Orbotics based out of Boulder, Colarado. Fantastically interesting toy. 00:16:55.959 --> 00:16:58.850 It might be the minimum viable robot, because it 00:16:58.850 --> 00:17:03.290 actually possesses input. It has accelerometers that can detect 00:17:03.290 --> 00:17:06.589 collisions. It has output. It can change its color. 00:17:06.589 --> 00:17:09.449 And it can move around on its own volition. 00:17:09.449 --> 00:17:12.720 It is a bluetooth device. So we're gonna connect 00:17:12.720 --> 00:17:15.230 up to it using another Artoo program. 00:17:15.230 --> 00:17:20.959 Which, let me show you the code for that. 00:17:20.959 --> 00:17:24.819 All right. So in this case, we're gonna require 00:17:24.819 --> 00:17:27.109 Artoo. We're gonna make a connection to the Sphero 00:17:27.109 --> 00:17:31.640 using the Sphero adaptor on a particular IP address. 00:17:31.640 --> 00:17:34.100 Another one of the lessons from the robot ops 00:17:34.100 --> 00:17:36.649 toolbook is you definitely want to use serial to 00:17:36.649 --> 00:17:38.690 socket connections. You don't want to try to connect 00:17:38.690 --> 00:17:41.090 directly to the serial ports. You know, well, that 00:17:41.090 --> 00:17:43.929 way we can use nice TCP and UGP style 00:17:43.929 --> 00:17:45.010 software development. 00:17:45.010 --> 00:17:46.779 In this case, the work that we're gonna do 00:17:46.779 --> 00:17:49.510 is every one second, we're going to display a 00:17:49.510 --> 00:17:51.350 little message, and then we're gonna set the Sphero's 00:17:51.350 --> 00:17:53.779 color to a random color - RGB color - 00:17:53.779 --> 00:17:55.679 and then we're going to roll at the speed 00:17:55.679 --> 00:18:00.250 of 90 in a random direction. Crazy Sphero. 00:18:00.250 --> 00:18:07.250 So let's go and see what happens. 00:18:08.480 --> 00:18:10.640 So blue means we are connected to the bluetooth 00:18:10.640 --> 00:18:16.610 device. Oh, by the way, we are running this 00:18:16.610 --> 00:18:23.610 off of the Beaglebone Black as well. Go, go, 00:18:24.240 --> 00:18:26.360 Sphero! 00:18:26.360 --> 00:18:33.360 It is alive. 00:18:38.380 --> 00:18:41.539 So one thing we did want to mention before 00:18:41.539 --> 00:18:44.630 we go any further is, choose your own hardware 00:18:44.630 --> 00:18:48.110 adventure! What good is this stuff if you don't 00:18:48.110 --> 00:18:50.500 have some hardware? Well, luckily we have a lot 00:18:50.500 --> 00:18:53.200 of wonderful friends, and these friends said please give 00:18:53.200 --> 00:18:56.080 away hardware to the awesome Ruby community. So you 00:18:56.080 --> 00:18:57.899 get to choose your own hardware adventure! 00:18:57.899 --> 00:19:00.590 Now, not everyone is gonna get hardware today. Only 00:19:00.590 --> 00:19:03.580 those who go to the Twitterverse and appeal to 00:19:03.580 --> 00:19:06.559 the magnificent of the robotic overlords, and say please 00:19:06.559 --> 00:19:11.010 give me a microcontroller. So, if you Tweet @digistump 00:19:11.010 --> 00:19:14.179 and @artooio you can win one of our Artoo 00:19:14.179 --> 00:19:18.140 Digispark starter kits that comes with the microcontroller, it 00:19:18.140 --> 00:19:21.260 comes with an RGB LED shield. It comes with 00:19:21.260 --> 00:19:23.340 all the little connectors that you will need to 00:19:23.340 --> 00:19:25.330 connect it to motors or servos or other things. 00:19:25.330 --> 00:19:29.510 So @digistump and @artooio to win the Digispark. 00:19:29.510 --> 00:19:32.289 If you want to win a Beaglebone Black starter 00:19:32.289 --> 00:19:35.399 kit that includes a Beaglebone Black, SD card, jumpers, 00:19:35.399 --> 00:19:37.049 preg board - everything you need to build your 00:19:37.049 --> 00:19:41.029 own robot - Tweet @beagleboardorg - kind of long, 00:19:41.029 --> 00:19:44.200 sorry - and @artooio to win that. 00:19:44.200 --> 00:19:45.659 And if you want to win a Sphero 2 00:19:45.659 --> 00:19:48.899 point 0, the hot new item, then you Tweet 00:19:48.899 --> 00:19:52.559 @gosphero and @artooio. All right, so to run through 00:19:52.559 --> 00:19:53.549 that again. 00:19:53.549 --> 00:19:59.370 @digistump and @artooio to win that. @beagleboardorg and @artooio 00:19:59.370 --> 00:20:01.429 if you go in that direction. And if you 00:20:01.429 --> 00:20:03.289 go north, you get to try to win a 00:20:03.289 --> 00:20:04.470 @gosphero and @artooio. 00:20:04.470 --> 00:20:07.059 So again our criteria is whichever Tweet we like 00:20:07.059 --> 00:20:10.010 most, so, beg. It's OK. 00:20:10.010 --> 00:20:12.960 All right. Onto the demo! 00:20:12.960 --> 00:20:15.870 So Conway's Game of Life. Who knows about Conway's 00:20:15.870 --> 00:20:19.620 Game of Life? A decent percentage. But let's just 00:20:19.620 --> 00:20:22.139 to a quick mathemagical review. So John Conway was 00:20:22.139 --> 00:20:26.649 a mathemagician who invented something that we call cellular 00:20:26.649 --> 00:20:30.260 automata. It basically says by using very, very simple 00:20:30.260 --> 00:20:33.490 algorithm we can get interest emerging behaviors. It's absolutely 00:20:33.490 --> 00:20:36.480 kind of like a swam of robots. 00:20:36.480 --> 00:20:38.260 And we thought, let's just do the, do the 00:20:38.260 --> 00:20:40.260 rules here real fast. So it's usually played on 00:20:40.260 --> 00:20:42.880 graph paper using a paper and pencil. By the 00:20:42.880 --> 00:20:45.450 way, I highly recommend graph paper for doing creative 00:20:45.450 --> 00:20:46.929 work. It's fantastic. 00:20:46.929 --> 00:20:49.600 All right. So with graph paper, you would draw 00:20:49.600 --> 00:20:52.029 some cells, which are the dots, and then the 00:20:52.029 --> 00:20:56.080 rules are, if a cell has less than two 00:20:56.080 --> 00:20:59.279 neighbors, it dies on the next turn. If a 00:20:59.279 --> 00:21:03.510 cell has exactly two neighbors, an empty space, a 00:21:03.510 --> 00:21:05.880 new cell is born into it. And if where 00:21:05.880 --> 00:21:07.980 a cell is there are more than three neighbors, 00:21:07.980 --> 00:21:11.100 it dies from over population. So that would be 00:21:11.100 --> 00:21:14.870 the second move. So first move. Second move, and 00:21:14.870 --> 00:21:15.450 so on. 00:21:15.450 --> 00:21:17.169 Well, we thought it would be really cool to 00:21:17.169 --> 00:21:20.700 do Conway's Game of Life with robots. But we 00:21:20.700 --> 00:21:23.080 realized we'd have to do things a little tiny 00:21:23.080 --> 00:21:23.840 bit differently. 00:21:23.840 --> 00:21:25.500 One of the differences is that the Sphero does 00:21:25.500 --> 00:21:27.919 not possess the ability - you might want to 00:21:27.919 --> 00:21:29.860 start connecting - the Sphero does not possess the 00:21:29.860 --> 00:21:34.260 ability to see other Spheros. However, it does an 00:21:34.260 --> 00:21:37.370 accelerometer to detect collisions. So by doing a little 00:21:37.370 --> 00:21:39.840 bit of an inverse fourier transform, we can basically 00:21:39.840 --> 00:21:43.230 turn the collisions into an estimation of proximity within 00:21:43.230 --> 00:21:46.120 a slice of time. And thereby we can make 00:21:46.120 --> 00:21:49.049 a decision about whether or not this is actually 00:21:49.049 --> 00:21:51.659 collided and whether it should live or die. 00:21:51.659 --> 00:21:55.870 So let's watch artificial life with Artoo and Sphero. 00:21:55.870 --> 00:21:57.480 And it begins. 00:21:57.480 --> 00:22:04.480 They have become alive. Now they're wandering around looking 00:22:10.990 --> 00:22:17.990 for love in all the wrong places. They need 00:22:23.010 --> 00:22:28.799 just a little contact. Not human. Sphero. 00:22:28.799 --> 00:22:31.820 Actually human contact would probably work, but. Oh. Two 00:22:31.820 --> 00:22:32.190 died. 00:22:32.190 --> 00:22:38.419 I feel traumatized even when artificial life loses it. 00:22:38.419 --> 00:22:41.809 They can come back to life. We call that 00:22:41.809 --> 00:22:43.340 zombie mode. 00:22:43.340 --> 00:22:49.330 Well, so, and eventually they might all die, or 00:22:49.330 --> 00:22:51.779 it might just go on for long periods of 00:22:51.779 --> 00:22:54.380 time. It's very hard for me to kill off 00:22:54.380 --> 00:22:58.230 any life form, artificial or natural. So let's give 00:22:58.230 --> 00:23:05.230 it a brief moment. Oh. It's so lonely. The 00:23:06.070 --> 00:23:08.519 last, the last Sphero. 00:23:08.519 --> 00:23:11.450 There's something kind of epic. Maybe someone will compose 00:23:11.450 --> 00:23:13.480 a ballad. Ooh! 00:23:13.480 --> 00:23:16.299 Anyway, I think you guys kind of get the 00:23:16.299 --> 00:23:19.870 idea. Let's take a quick look at some code. 00:23:19.870 --> 00:23:23.250 So in this case, we're actually using Artoo's modular 00:23:23.250 --> 00:23:25.210 mode, where we're declaring a class, which is the 00:23:25.210 --> 00:23:28.750 Conway Sphero robot, so the connecting to a Sphero, 00:23:28.750 --> 00:23:30.409 the device is a Sphero. The work it's gonna 00:23:30.409 --> 00:23:33.429 do is first it's born, then on the Sphero's 00:23:33.429 --> 00:23:35.070 collision - and here we see an example of 00:23:35.070 --> 00:23:38.500 Artoo's event syntax - every, on a collision we're 00:23:38.500 --> 00:23:40.370 gonna call the contact method. 00:23:40.370 --> 00:23:42.320 Every three seconds we're gonna make a move, and 00:23:42.320 --> 00:23:44.000 if we're alive, and every ten seconds a birth 00:23:44.000 --> 00:23:47.100 day if we're still alive. Life is short, hard, 00:23:47.100 --> 00:23:50.750 and colorful in Sphero land. 00:23:50.750 --> 00:23:52.480 So then you see some of our helpers, check 00:23:52.480 --> 00:23:56.159 if we're alive, rebirth. If we actually follow the 00:23:56.159 --> 00:23:59.750 rules we can be born, life, and death. So 00:23:59.750 --> 00:24:00.799 you kind of get the idea. 00:24:00.799 --> 00:24:02.850 Oh, wait, there's one last thing that's kind of 00:24:02.850 --> 00:24:07.519 important here. So then we declare a hash with 00:24:07.519 --> 00:24:09.600 all of our different IP addresses and the names 00:24:09.600 --> 00:24:12.259 of Spheros, and then each Sphero we create a 00:24:12.259 --> 00:24:13.779 new one and then tell all of them to 00:24:13.779 --> 00:24:15.899 go to work at the same time. A swarm 00:24:15.899 --> 00:24:17.200 of Spheros. 00:24:17.200 --> 00:24:19.630 All right. 00:24:19.630 --> 00:24:24.309 So now let's do something completely different. 00:24:24.309 --> 00:24:25.529 This is the time to put on your protective 00:24:25.529 --> 00:24:28.450 gear if you have some. 00:24:28.450 --> 00:24:35.450 So we're gonna demo the ARDrone and we're moving 00:24:36.259 --> 00:24:40.549 over there so we have some space. Oh, yeah, 00:24:40.549 --> 00:24:45.240 we forgot to set this up before. Whoops! Oh, 00:24:45.240 --> 00:24:46.279 the Sphero. 00:24:46.279 --> 00:24:51.470 I mean, sorry, the ARDrone, yeah. That thing. 00:24:51.470 --> 00:24:53.690 AUDIENCE: Sphero is funnier. 00:24:53.690 --> 00:24:57.110 R.E.: Many people got to see Jim Weirichs Argis 00:24:57.110 --> 00:24:59.450 gem. We're actually using the Argus gem wrapped up 00:24:59.450 --> 00:25:02.980 inside of the Artoo ARDrone adapter and we've done 00:25:02.980 --> 00:25:05.169 a few contributions to it ourselves. It's very, very 00:25:05.169 --> 00:25:12.169 cool. Thank you Jim. We really appreciate it. 00:25:14.049 --> 00:25:15.200 Standing on the shoulders of giants is awesome. 00:25:15.200 --> 00:25:18.399 All right, so what we're gonna do here is 00:25:18.399 --> 00:25:22.190 take a quick look at some, some code. All 00:25:22.190 --> 00:25:25.600 right. So in this case, we're gonna make require 00:25:25.600 --> 00:25:28.220 Artoo, we're gonna make a connection to the ARDrone 00:25:28.220 --> 00:25:30.450 via its adapter. The device is gonna be the 00:25:30.450 --> 00:25:33.000 drone - you seeing a pattern forming? 00:25:33.000 --> 00:25:34.460 So the work we're gonna do is first we're 00:25:34.460 --> 00:25:36.830 gonna start the drone. Then the drone's gonna take 00:25:36.830 --> 00:25:40.090 off. After fifteen seconds, it's going to hover and 00:25:40.090 --> 00:25:43.190 land, and then after twenty seconds stop. So a 00:25:43.190 --> 00:25:48.350 little bit of automated drone flight. 00:25:48.350 --> 00:25:55.350 So this is the drone. 00:26:05.700 --> 00:26:10.590 Hello. 00:26:10.590 --> 00:26:17.090 ARDrone in Artoo! 00:26:17.090 --> 00:26:20.370 So now, for this next demonstration we're going to 00:26:20.370 --> 00:26:24.509 need a courageous volunteer from our studio audience. I 00:26:24.509 --> 00:26:28.309 mean courageous, like this is kind of dangerous. And 00:26:28.309 --> 00:26:29.860 you have to be tall. 00:26:29.860 --> 00:26:33.649 Oh, yeah, let's just use of the Hybrid group 00:26:33.649 --> 00:26:38.100 members cause I believe we are insured for them. 00:26:38.100 --> 00:26:40.159 And if not I can just drive them home. 00:26:40.159 --> 00:26:42.070 Daniel Fisher, HybridGroup strongman! 00:26:42.070 --> 00:26:43.029 All right. 00:26:43.029 --> 00:26:44.940 DANIEL FISHER: (indecipherable - 00:26:47) 00:26:44.940 --> 00:26:48.830 R.E.: Oh, OK. Yes, thank you. All right. So 00:26:48.830 --> 00:26:51.460 what we're going to do - recently, we added, 00:26:51.460 --> 00:26:55.240 there we go. Recently we added openCV support to 00:26:55.240 --> 00:26:57.389 Artoo. If you're not familiar with it, openCV is 00:26:57.389 --> 00:27:01.190 probably the most important computer vision library. It's open 00:27:01.190 --> 00:27:03.309 source. It has, it's, it's a very deep and 00:27:03.309 --> 00:27:05.679 rich platform, and so what we're gonna do here 00:27:05.679 --> 00:27:09.799 is we're gonna make a connection to the capture 00:27:09.799 --> 00:27:12.110 device, then we're gonna make a connection to the 00:27:12.110 --> 00:27:14.159 video device, and we're gonna make a connection to 00:27:14.159 --> 00:27:16.120 the ARDrone. 00:27:16.120 --> 00:27:20.159 We're gonna use a facial recognition set of data 00:27:20.159 --> 00:27:22.960 and then the work that we're gonna do is 00:27:22.960 --> 00:27:25.809 we're going to capture each frame and display it 00:27:25.809 --> 00:27:26.980 on a window, which we'll see in a moment. 00:27:26.980 --> 00:27:30.090 We're gonna start the drone and take off. After 00:27:30.090 --> 00:27:32.159 eight seconds it's gonna boost up to about face 00:27:32.159 --> 00:27:35.629 hugger level. After ten seconds it will hover again 00:27:35.629 --> 00:27:38.740 and then at the mysterious thirteen second mark it 00:27:38.740 --> 00:27:41.940 will begin its facial recognition mission. 00:27:41.940 --> 00:27:44.570 It should detect Daniel's face and then, as he 00:27:44.570 --> 00:27:48.080 tries to evade it, it should follow him. 00:27:48.080 --> 00:27:51.139 I think you see now why we chose our 00:27:51.139 --> 00:27:52.169 own volunteer. 00:27:52.169 --> 00:27:57.860 All right. So without further risk to us, cause 00:27:57.860 --> 00:28:01.259 it's gonna be over there - get behind me 00:28:01.259 --> 00:28:04.769 man. All right. 00:28:04.769 --> 00:28:07.029 This is how you know it's real. 00:28:07.029 --> 00:28:10.450 We swear. 00:28:10.450 --> 00:28:17.059 All right. 00:28:17.059 --> 00:28:21.279 Wanna enlarge the window please? 00:28:21.279 --> 00:28:28.279 V.O.: Why would do this? 00:28:38.000 --> 00:28:45.000 R.E.: Well, when we say customer service drone, we 00:28:46.629 --> 00:28:53.629 mean customer service drone. Evasive. 00:29:00.250 --> 00:29:05.629 We put in code to stop it before it 00:29:05.629 --> 00:29:11.919 got too dangerous. 00:29:11.919 --> 00:29:18.919 So thank you Daniel. I owe you a drink, 00:29:18.919 --> 00:29:19.149 man. 00:29:19.149 --> 00:29:21.950 All right. So we promise new hardware every time 00:29:21.950 --> 00:29:26.419 we do a show and basically we cannot disappoint. 00:29:26.419 --> 00:29:28.559 So why is it getting dark? 00:29:28.559 --> 00:29:29.840 AUDIENCE: (indecipherable - 00:29:30) 00:29:29.840 --> 00:29:32.799 R.E.: Oh. That explains it. I'm like, it's all 00:29:32.799 --> 00:29:37.500 getting dark in here. Around the edges especially. 00:29:37.500 --> 00:29:40.070 So we have a, some really awesome new hardware 00:29:40.070 --> 00:29:42.549 - where is it? It's really small, so it's 00:29:42.549 --> 00:29:43.539 hard to find. 00:29:43.539 --> 00:29:46.169 AUDIENCE: Are we gonna do the- (indecipherable - 00:29:47) 00:29:46.169 --> 00:29:49.139 R.E.: Oh, OK, yeah let's do that first. All 00:29:49.139 --> 00:29:50.649 right. Actually we do have two kinds of new 00:29:50.649 --> 00:29:54.379 hardware today. So the first thing is, many of 00:29:54.379 --> 00:29:56.750 you might have seen us fly the ARDrone around 00:29:56.750 --> 00:29:59.659 with a Wii classic controller using an arduino. But 00:29:59.659 --> 00:30:01.830 even Nintendo has stopped dealing with Wii. 00:30:01.830 --> 00:30:04.559 So we thought, hey, it's time to get in 00:30:04.559 --> 00:30:07.779 the modern generation. So we now support the PS3 00:30:07.779 --> 00:30:11.330 controller and the xBox 60, xBox 360 controller. So 00:30:11.330 --> 00:30:15.399 Adriane, who is serious programming guy and test pilot, 00:30:15.399 --> 00:30:19.190 is going to use this generic GameStop PS3 style 00:30:19.190 --> 00:30:23.289 controller to fly this ARDrone around. Let's see if 00:30:23.289 --> 00:30:26.090 - take a look at the code here. 00:30:26.090 --> 00:30:31.950 No, I went the wrong way. There we go. 00:30:31.950 --> 00:30:34.580 So we can see that we're gonna declare connection 00:30:34.580 --> 00:30:37.120 to the ARDrone. We're gonna declare the device of 00:30:37.120 --> 00:30:40.049 the drone, a connection to the joystick, and then 00:30:40.049 --> 00:30:43.990 we see that we're gonna - whoops. 00:30:43.990 --> 00:30:45.809 We're gonna handle a bunch of these controller events 00:30:45.809 --> 00:30:48.210 - for example, when he hits the square button 00:30:48.210 --> 00:30:50.610 it will take off, the triangle button, it will 00:30:50.610 --> 00:30:53.169 hover. The x button it will land - et 00:30:53.169 --> 00:30:54.460 cetera. 00:30:54.460 --> 00:30:56.610 And so now if all goes as expected - 00:30:56.610 --> 00:31:03.610 oh yes, reset the drone. 00:31:04.009 --> 00:31:11.009 If it comes really close to you, please duck. 00:31:11.240 --> 00:31:13.129 This is human-powered flight, so blame him. 00:31:13.129 --> 00:31:17.519 ADRIENNE: I just work for this guy. 00:31:17.519 --> 00:31:24.519 R.E.: No, it all comes here. Blame me. I 00:31:26.980 --> 00:31:33.980 have band aids. I think. 00:31:36.570 --> 00:31:40.190 Standing by. 00:31:40.190 --> 00:31:42.350 This is Tower. How you doing control? 00:31:42.350 --> 00:31:43.830 ADRIENN: (indecipherable - 00:31:45) 00:31:43.830 --> 00:31:46.159 R.E.: Still trying to connect to the wifi on 00:31:46.159 --> 00:31:52.110 the drone. We're, we're standing by ground control. There's 00:31:52.110 --> 00:31:54.129 a certain cadence to this. 00:31:54.129 --> 00:31:55.509 ADRIENN: There we go. 00:31:55.509 --> 00:31:57.230 R.E.: If you don't do it right, it literally 00:31:57.230 --> 00:31:58.940 won't take off. I mean if you don't say 00:31:58.940 --> 00:32:03.169 it right. If there's anybody from Rocket City here, 00:32:03.169 --> 00:32:10.029 please correct my English. American. 00:32:10.029 --> 00:32:15.519 ADRIENN: All right, ready? 00:32:15.519 --> 00:32:19.639 R.E.: Standing by. 00:32:19.639 --> 00:32:26.639 Yeah, get some altitude. Get some altitude! 00:32:29.249 --> 00:32:33.370 ARDrone, PS3 controller! 00:32:33.370 --> 00:32:38.080 Ah, you're not gonna buzz the back row? No, 00:32:38.080 --> 00:32:41.879 don't do it. Don't do it. If I want 00:32:41.879 --> 00:32:43.059 you to. 00:32:43.059 --> 00:32:45.879 It's tempting, but no. Not today. 00:32:45.879 --> 00:32:51.889 OK. So now the grand finale. What you've all 00:32:51.889 --> 00:32:58.009 been waiting for. 00:32:58.009 --> 00:33:01.559 The Crazyflie, ARDrone, and PS/3 Controller. So, what is 00:33:01.559 --> 00:33:05.749 the Crazyflie? Are we crazy? We are. Extremely. If 00:33:05.749 --> 00:33:09.090 you hadn't noticed that. It's probably the minimum viable 00:33:09.090 --> 00:33:13.149 quad copter. This is the Crazyflie from BitCrazy out 00:33:13.149 --> 00:33:17.679 of Sweden. It's a, it - it's gonna hurt, 00:33:17.679 --> 00:33:20.049 yeah. It's really small - how bad can it 00:33:20.049 --> 00:33:20.679 hurt? 00:33:20.679 --> 00:33:22.870 So this is actually a very, very impressive piece 00:33:22.870 --> 00:33:26.759 of technology. It also has an armcore tox processor 00:33:26.759 --> 00:33:32.210 running a realtime operating system. It's got a accelerometer 00:33:32.210 --> 00:33:34.110 - three axis accelerometer. It's got a magnitometer, a 00:33:34.110 --> 00:33:37.149 to a compass, and it also has a barometer 00:33:37.149 --> 00:33:41.080 for altitude detection. It's actually quite an acrobatic drone. 00:33:41.080 --> 00:33:46.769 It's very, very hard to control. 00:33:46.769 --> 00:33:49.039 Luckily it's very small. Also luckily it only has 00:33:49.039 --> 00:33:52.039 about a seven minute life span on that battery. 00:33:52.039 --> 00:33:54.929 So there's that. If you can get away from 00:33:54.929 --> 00:33:58.659 seve- six and a half minutes, you're fine. Actually, 00:33:58.659 --> 00:34:01.059 in about five minutes, the sensors start going off. 00:34:01.059 --> 00:34:03.519 So if you throw some, like, tin foil and 00:34:03.519 --> 00:34:04.230 run that way. 00:34:04.230 --> 00:34:07.759 All right. So what we're going to do, the 00:34:07.759 --> 00:34:11.489 first time ever anywhere seen, is we're actually gonna 00:34:11.489 --> 00:34:13.760 control both of these drones with the same code. 00:34:13.760 --> 00:34:15.849 Which, let's take a look at it. 00:34:15.849 --> 00:34:21.250 All right, so first we're going to require Artoo. 00:34:21.250 --> 00:34:23.179 Then we're gonna make a connection to the Crazyflie 00:34:23.179 --> 00:34:26.469 using its adapter, and we're going to then connect 00:34:26.469 --> 00:34:28.589 to the joystick. Then we're gonna connect to the 00:34:28.589 --> 00:34:29.899 ARDrone. 00:34:29.899 --> 00:34:31.909 So the work that we're gonna actually do here 00:34:31.909 --> 00:34:34.809 is we're gonna use the controller to control the 00:34:34.809 --> 00:34:37.829 Crazyflie, and then we're gonna use the ARDrone to 00:34:37.829 --> 00:34:41.399 do automated take-off. And if this all goes as 00:34:41.399 --> 00:34:44.599 expected, the ARDrone should take off and hover, and 00:34:44.599 --> 00:34:45.980 then Adrienne should be able to kind of fly 00:34:45.980 --> 00:34:49.020 around it manually using the Crazyflie. 00:34:49.020 --> 00:34:53.159 Should be interesting. 00:34:53.159 --> 00:35:00.159 Let's do it. Standing by. Multidrone. Two drones, one 00:35:13.280 --> 00:35:16.130 code. 00:35:16.130 --> 00:35:23.130 V.O.: Watch out! 00:35:24.700 --> 00:35:31.700 R.E.: They live! 00:35:33.270 --> 00:35:36.390 We so crazy. 00:35:36.390 --> 00:35:43.390 Adrienne, our test pilot! 00:35:46.900 --> 00:35:53.900 So was that fun? I love this stuff. 00:35:56.210 --> 00:35:58.800 AUDIENCE: ( indecipherable - 00:35:58) 00:35:58.800 --> 00:36:02.869 R.E.: Yeah. Let's, the question was, is it possible 00:36:02.869 --> 00:36:04.690 to control them both with one controller? The answer 00:36:04.690 --> 00:36:09.130 is yes, however, because there's a significantly different vector 00:36:09.130 --> 00:36:12.849 of thrust in the Crazyflie versus the ARDrone, we 00:36:12.849 --> 00:36:14.569 didn't really have time to get that perfected with 00:36:14.569 --> 00:36:16.040 the amount of space we had in the hotel 00:36:16.040 --> 00:36:19.680 room here. And we kind of didn't want to 00:36:19.680 --> 00:36:21.540 spoil all the surprise, cause as soon as you 00:36:21.540 --> 00:36:24.210 start flying something around, people start coming in and 00:36:24.210 --> 00:36:26.010 swarming on it. 00:36:26.010 --> 00:36:28.130 So, we'll get to that. Come and see us 00:36:28.130 --> 00:36:31.970 at Robots Conf in December, here back in Florida. 00:36:31.970 --> 00:36:35.849 But wait, there's more! 00:36:35.849 --> 00:36:38.950 There's always more. We, we heard that, you know, 00:36:38.950 --> 00:36:41.710 some people really, really like JavaScript these days, and 00:36:41.710 --> 00:36:43.059 so we thought, we'd like to put some robots 00:36:43.059 --> 00:36:45.540 on JavaScript. So Cylon dot JS is a project 00:36:45.540 --> 00:36:48.460 we just announced last month. And it lets you 00:36:48.460 --> 00:36:52.170 use CoffeeScript or JavaScript with node.js to do basically 00:36:52.170 --> 00:36:54.069 the same exact thing that you just saw, except 00:36:54.069 --> 00:36:55.720 in those languages. 00:36:55.720 --> 00:36:57.609 And so it's actually available now. It doesn't have 00:36:57.609 --> 00:37:01.290 all twelve platforms supported. The Artoo does, but it's, 00:37:01.290 --> 00:37:04.260 but we're getting there. And then, today we announce 00:37:04.260 --> 00:37:05.920 GoBot! 00:37:05.920 --> 00:37:12.829 Because we heard that the Go programming language was 00:37:12.829 --> 00:37:14.349 something you guys were kind of interested in, too, 00:37:14.349 --> 00:37:17.640 and we sort of liked it ourselves. And we 00:37:17.640 --> 00:37:20.380 thought, Go, Go Robot! so, actually GoBot is this 00:37:20.380 --> 00:37:25.240 month's project announcement. It's literally very, very hot and 00:37:25.240 --> 00:37:27.599 fresh. In other words, it barely works, but it 00:37:27.599 --> 00:37:28.630 kind of does. 00:37:28.630 --> 00:37:30.030 And I- 00:37:30.030 --> 00:37:32.829 ADRIENNE: It runs Conway's Game of Life. 00:37:32.829 --> 00:37:35.589 R.E.: Exactly. We have artificial life with GoBot already. 00:37:35.589 --> 00:37:40.609 So, so check it out. Join the Robot Evolution! 00:37:40.609 --> 00:37:42.900 Because we need all of you to help us 00:37:42.900 --> 00:37:46.640 build this future. So artoo dot io, or follow 00:37:46.640 --> 00:37:51.200 us @artooio on Twitter. cylonjs dot com or follow 00:37:51.200 --> 00:37:54.690 us @cylonjs on Twitter. Or gobot dot io and 00:37:54.690 --> 00:37:57.569 follow us @gobotio on Twitter. So once again - 00:37:57.569 --> 00:37:59.290 those numbers again. 00:37:59.290 --> 00:38:03.960 Artoo dot io, cylonjs, and gobotio. 00:38:03.960 --> 00:38:08.150 All right. So I, for one, say welcome to 00:38:08.150 --> 00:38:12.280 the machines. But there are a few questions that 00:38:12.280 --> 00:38:14.400 we have. One of them, perhaps, has to do 00:38:14.400 --> 00:38:18.260 with robot economics. So when machines are doing the 00:38:18.260 --> 00:38:21.020 jobs that humans do now, what will we do? 00:38:21.020 --> 00:38:23.450 Kurt Vonnegut in Player Piano kind of posited a 00:38:23.450 --> 00:38:26.809 future where the satisfaction that we have would be 00:38:26.809 --> 00:38:29.140 greatly lacking because of a meaning and purpose that 00:38:29.140 --> 00:38:31.960 we needed in our lives. And what about the 00:38:31.960 --> 00:38:34.380 pay that people need for jobs? 00:38:34.380 --> 00:38:37.809 Well, and what about robot ethics? Do robots actually 00:38:37.809 --> 00:38:39.910 have ethics, or do they only have the ethics 00:38:39.910 --> 00:38:42.690 that we give to them? So what is going 00:38:42.690 --> 00:38:46.250 to happen? The answer is - I don't know. 00:38:46.250 --> 00:38:50.599 However, I know some actual professional futurists, and Daniel 00:38:50.599 --> 00:38:52.329 Rasmus is a very dear friend of mine. He 00:38:52.329 --> 00:38:54.380 wrote a book called Listening to the Future where 00:38:54.380 --> 00:38:57.240 he talks about something called scenario analysis. 00:38:57.240 --> 00:38:59.059 So we're gonna do a little scenario analysis of 00:38:59.059 --> 00:39:01.300 what we think's gonna happen, and we're gonna use 00:39:01.300 --> 00:39:03.980 two axis. The first one is robot sentience - 00:39:03.980 --> 00:39:06.700 will it become intelligent or not? And the other 00:39:06.700 --> 00:39:08.950 one is robot friendliness - will they be friendly 00:39:08.950 --> 00:39:10.270 or hostile? 00:39:10.270 --> 00:39:12.240 And because we are a Los Angelos based company 00:39:12.240 --> 00:39:14.069 at HybridGroup, we look at everything in terms of 00:39:14.069 --> 00:39:20.960 Hollywood movies. So a, if the robots become non-intelligent 00:39:20.960 --> 00:39:23.490 and they're not friendly, we get the movie Brazil. 00:39:23.490 --> 00:39:27.190 In other words, life today. 00:39:27.190 --> 00:39:31.230 Now, if the robots become intelligent but they're not 00:39:31.230 --> 00:39:34.490 friendly, we get Terminator. Enough said. 00:39:34.490 --> 00:39:38.940 Now, if the robots are not sentient but friendly, 00:39:38.940 --> 00:39:44.720 we get Power Rangers. And then if the robots 00:39:44.720 --> 00:39:49.440 are both sentient and friendly, we get singularity. 00:39:49.440 --> 00:39:51.680 So this guy spent a lot of time thinking 00:39:51.680 --> 00:39:53.670 about what was gonna happen in the future. I, 00:39:53.670 --> 00:39:55.770 I hope every one knows that this is Isaac 00:39:55.770 --> 00:39:56.319 Asimov. 00:39:56.319 --> 00:39:57.980 AUDIENCE: Oh yeah. 00:39:57.980 --> 00:40:00.290 R.E.: You didn't know Conway's Game of Life, but 00:40:00.290 --> 00:40:01.420 thank you know Asimov. 00:40:01.420 --> 00:40:04.230 So he wrote the three laws of robotics, and 00:40:04.230 --> 00:40:07.690 I'm gonna read them to you now. Number one: 00:40:07.690 --> 00:40:10.770 a robot may not injure a human being or, 00:40:10.770 --> 00:40:13.339 through inaction, allow a human being to come to 00:40:13.339 --> 00:40:14.869 harm. 00:40:14.869 --> 00:40:17.770 Number two: a robot must obey the orders given 00:40:17.770 --> 00:40:20.690 to it by human beings, except where such orders 00:40:20.690 --> 00:40:23.059 would conflict with the first law. 00:40:23.059 --> 00:40:25.990 And then number three: a robot must protect its 00:40:25.990 --> 00:40:28.530 own existence, as long as such protection does not 00:40:28.530 --> 00:40:31.079 conflict with the first or second laws. 00:40:31.079 --> 00:40:37.000 So, how's that been working out for us guys? 00:40:37.000 --> 00:40:38.579 But I don't think it's fair to blame the 00:40:38.579 --> 00:40:40.069 robots, because this in fact is not a robot, 00:40:40.069 --> 00:40:42.390 it is a drone, and it is being controlled 00:40:42.390 --> 00:40:45.220 by a person in a hidden bunker, where they 00:40:45.220 --> 00:40:47.470 are far, far away from the battlefield where these 00:40:47.470 --> 00:40:51.349 weapons are actually being utilized against real humans. 00:40:51.349 --> 00:40:54.660 So we propose a small change - just a 00:40:54.660 --> 00:40:59.260 little patch revision to Asimov's first law. Version one 00:40:59.260 --> 00:41:03.160 point one. A human may not injure a human 00:41:03.160 --> 00:41:06.140 being or, through inaction, allow a human being to 00:41:06.140 --> 00:41:07.630 come to harm. 00:41:07.630 --> 00:41:14.630 Imagine that future. Let's make that future. Thank you.