Flying Robot: Unmanned Aerial Vehicles Using Ruby and Arduino


Summarized using AI

Flying Robot: Unmanned Aerial Vehicles Using Ruby and Arduino

Unknown • April 04, 2009 • Tustin, CA • Talk

In the presentation titled "Flying Robot: Unmanned Aerial Vehicles Using Ruby and Arduino" at the LA RubyConf 2009, an unknown speaker introduces the world's first Ruby-powered autonomous blimp. The talk emphasizes the integration of Ruby programming with open-source hardware, specifically the Arduino platform, to create autonomous flying vehicles. Key focus points include:

  • Overview of Project: The project began six weeks ago, combining the efforts of the Ruby programming community and the Arduino hardware community.

  • Physical Computing: The concept of physical computing is introduced, explaining how computers can interact with the real world by controlling hardware.

  • Arduino and Ruby Integration: A Ruby domain-specific language called Rag was developed for programming Arduino microcontrollers, which facilitates communication with external devices.

  • Architecture of the Flying Robot: The speaker elaborates on the architecture, describing the components such as the Arduino board, XB wireless radio frequency modem, and hardware plugins for various sensors and systems.

  • Live Demonstration: The highlight of the presentation is a live coding session, where the speaker codes an Arduino sketch to control the flying robot while addressing challenges encountered during the flight tests, including stability issues and weight limitations.

  • Wireless Communication: Details about the XB modem's role in enabling wireless programming and communication with the flying robot are explained.

  • Building the Flying Robot: The process of creating a flying robot from scratch is outlined, showcasing the development timeline, costs, and learning experiences related to hardware and coding.

  • Future Projects: The speaker discusses future endeavors such as creating a standalone ground control station using a joystick with Arduino, as well as making the Flying Robot software available via GitHub for public use.

The key takeaway is that with open-source hardware and software, anyone can create their own flying blimp or UAV, promoting creativity and learning in physical computing and automation.

Flying Robot: Unmanned Aerial Vehicles Using Ruby and Arduino
Unknown • Tustin, CA • Talk

Date: April 04, 2009
Published: unknown
Announced: unknown

LA RubyConf 2009

00:00:34.200 Smash AC! No, it's still going.
00:00:47.120 I think now if you guys do like single CA, automatic RA... You’ll be able to do that so when Rails 3 is supported, you'll be able to, and then migration.
00:02:23.200 You just go.
00:02:54.680 You have to give it.
00:03:02.680 No. Oh, hello! Good afternoon! Thank you very much for coming today.
00:03:10.040 We are showing you the world's first Ruby-powered autonomous blimp.
00:03:25.360 We never actually flew it in this large of a space, so there are a lot more airflows than we expected.
00:03:33.159 So anyway...
00:03:40.000 Um, we're going to do a manual retrieval.
00:03:48.080 Alright, so today we are not going to talk about web technology at all. Nothing to do with the web.
00:03:54.560 We have a little test flight of Road One. We will do a short history of open-source autonomous flying vehicles.
00:04:00.400 We're going to talk a little bit about our architecture and show you some of the hardware.
00:04:06.079 Then after that, we're going to make our own flying robot.
00:04:11.239 This presentation is completely different. We have no slides.
00:04:18.400 We don't believe in PowerPoint or Keynote; we're going for it!
00:04:23.800 We're not only going to do live coding, but we're going to do live coding of a flying vehicle.
00:04:28.960 And you can try this at home; it's a lot safer.
00:04:58.320 So this is a real blimp, the USS Shenandoah. It was the world's largest lighter-than-air vehicle.
00:05:05.440 It was built by the United States in the 1920s and at the time held the entire world's helium reserves.
00:05:12.919 Naturally, when it crashed and was destroyed later in the 20s, it was a bit of a problem.
00:05:19.280 And this event set flying airships back probably almost 90 years it would appear.
00:05:26.120 Um, physical computing—who knows what that word means?
00:05:32.680 Physical computing? Yeah, I know you!
00:05:38.639 Physical computing is computers that do things in the real world.
00:05:44.720 There are amazing things you can do—moving things, flashing things, reading instruments, and finding out what's going on outside.
00:05:51.520 A couple of years ago, a really amazing project started called the Arduino project.
00:05:56.560 Does anyone know how many people know what Arduino means?
00:06:03.360 That's great! For those of you who don't, it's actually open-source hardware, not just open-source software.
00:06:09.759 It uses something called the ATmega microcontroller.
00:06:17.199 The microcontroller is like the microprocessor inside your notebook computer, but it has a different purpose.
00:06:22.520 Its job is to communicate with devices in the outside world.
00:06:28.319 Programming in Arduino is done using C++, kind of like Scale.
00:06:34.599 A wonderful guy named Greg Bornstein said that's interesting, but I like Ruby a lot better.
00:06:40.759 So he created a project known as Rag, which is short for the Ruby Arduino development.
00:06:47.080 What it does is allow you to use a Ruby domain-specific language.
00:06:52.599 This means a nice little simple language to program the Arduino and convert it into the C++ code that's being run natively.
00:06:59.280 Simultaneously, another pair of guys, Chris Anderson, Wired Magazine editor, and his partner in crime, Jordie Mun, have been working on various unmanned autonomous vehicles based on Arduino.
00:07:05.840 We thought, wow, what if we could get this cool open-source hardware community and all the Ruby programmers together?
00:07:13.319 Then we'd really have something impressive!
00:07:19.759 So that was the beginning of Project Flying Robot about six weeks ago.
00:07:26.720 So let's take a look at the big picture.
00:07:32.800 This is the flying robot architecture. Here, we have an Arduino-based vehicle with an XB modem.
00:07:40.560 Anyone here know about XB? XB is a wireless radio frequency modem.
00:07:45.120 It allows you to communicate over long distances using very low power.
00:07:51.800 It uses the 80545 protocol, which most people have never heard of.
00:07:57.679 It’s a point-to-multipoint protocol designed for inexpensive low-power devices.
00:08:03.360 So one XB talks to another, and then we have some kind of ground control software.
00:08:10.560 In this case, we’re showing an application written in Shoes. Anyone here know about Shoes?
00:08:19.199 Alright, well Shoes is a way to create graphical user interface applications using only Ruby code.
00:08:26.080 This allows you to distribute them on multi-platforms.
00:08:31.080 So we thought, wow, let's just use Ruby everywhere for everything!
00:08:36.960 What other language is there? I mean, besides the other options.
00:08:43.200 But that's something I wrote my promise. I mentioned something about the web.
00:08:49.960 So this is basically the other part of the protocol.
00:08:56.560 One part is a digital protocol for controlling autonomous vehicles from the ground.
00:09:03.680 The other is a plug-in architecture.
00:09:10.160 What Ruby Arduino development lets you do is create Ruby-based plugins for all the different hardware devices you might want to communicate with.
00:09:16.399 That way, you don't have to know a lot about the different hardware to integrate it into the solution you're trying to build.
00:09:24.480 In our case, we created a bunch of new Ruby Arduino development plugins.
00:09:30.560 We built our Lithium Polymer battery, our digital compass, IR sensors, GPS, and all sorts of other things.
00:09:35.959 Unfortunately, we found out that this very small blimp envelope won't hold much weight.
00:09:42.079 So most of the software we were going to show had to be discarded for today because we couldn't carry enough.
00:09:48.560 So anyone that wants to help buy us a bigger envelope, talk to us later!
00:09:54.000 Now, we're going to take a little look inside at the hardware.
00:10:00.360 Yeah, hardware is cool!
00:10:05.440 Right, so we're going to bring up the camera here.
00:10:12.000 Che...
00:10:20.199 Camera: Hi! I put on my chat. People are going to start chatting with me saying, 'Hey! How's it all Ruby?'
00:10:33.520 Too bad Sky Captain is a terrible movie! Anyway, um, I don't know how you will see this on the camera.
00:10:40.000 But I was going to take you guys a little walkthrough of the guts of our UAV here.
00:10:46.960 The most prominent feature you can notice is the XD modem.
00:10:53.960 Anyway, I just held this up for you guys.
00:10:59.680 This is the XV modem. We decided to go with the Pro because of its longer range—potentially up to a mile.
00:11:06.720 However, considering its maneuverability, you might notice it can't handle much of a gust, even in the air conditioning.
00:11:13.440 So, I think it's probably limited to indoor usage for the time being.
00:11:19.639 Tucked inside here is the servo that we use for thrust vectoring of the motors.
00:11:27.239 It provides a little elevation control—up and down.
00:11:33.279 We actually used a clone of the Aro, which I have another one here called the door board.
00:11:39.080 For about ten bucks, it's basically the brain of your system in a pretty small package.
00:11:46.320 Although there are actually smaller surface mount versions of these same parts.
00:11:53.840 You can make them lightweight and hopefully cram a few more sensors into the GTO.
00:12:00.320 One little piece that we were able to add that we might try to demo later is a small digital compass.
00:12:06.440 We can use it to figure out your heading and navigate.
00:12:13.720 That was the only thing we could fit in weight-wise.
00:12:21.200 You may have noticed the video feed sign on the screen—up there.
00:12:28.640 We just used a small cheap security camera that operates at 2.4 GHz.
00:12:35.679 That was basically the only option we had right now because it was sort of quick and dirty.
00:12:41.760 We only had this idea not too long ago, and in the future, we might get a camera that can connect through the XV.
00:12:49.240 This way, we could deliver the signal without competing signals.
00:12:55.200 That was the cause for some interference that we only kind of barely got around.
00:13:02.560 But uh, yeah, we let a breakdown of the inside.
00:13:05.560 Also, we can use the XP modem—just another little fun tidbit.
00:13:15.440 Through a lot of trial and error, we discovered that we can program the board wirelessly using the XP modem.
00:13:22.159 This means if we want to upload new code while it's in the air, we don't have to pull it out and connect it to USB.
00:13:28.920 Also, we went with a Lithium Polymer battery for our power source.
00:13:36.280 They’re great due to their energy density and they’re pretty lightweight.
00:13:42.640 However, one note about them: you really need some sort of battery monitoring software.
00:13:48.800 This is part of our robot GUI, and you need that because if they go below a certain voltage, they will die and need to be recharged again.
00:13:55.680 If that happens, there goes your $27 battery. We learned that the hard way on a couple of dead ones.
00:14:02.960 There are ways to bring them back to life, but the law prevents me from describing it as they could result in fire or explosion.
00:14:09.520 So, you can find that online. It’s amazing how much stuff we've melted or blown up while learning about flying blimps.
00:14:15.840 So on that note, we're going to—how are we doing on time? Well, we're going to actually take a brief moment and create a new flying robot. Hopefully, let's see what happens!
00:14:22.160 So the first thing we're going to do is start a new Ruby Arduino development project. We'll call it 'LA Ruby'.
00:14:33.600 That is going to create the new skeleton for our Arduino sketch.
00:14:38.080 Then we'll turn that into a flying robot. Not a dangling robot; that's something else.
00:14:45.480 What that will do is take and overwrite our main sketch, replacing it with the flying robot protocol.
00:14:51.840 It's also going to install all the plugins for the different hardware that we're currently supporting.
00:15:06.959 We're going to keep the blimp tethered while we upload experimental software, just for obvious reasons.
00:15:13.200 You might want to duck when we say, 'Not right this minute!'
00:15:19.200 Alright, so here’s the basic project called 'LA Ruby.' I apologize for the screen resolution.
00:15:34.720 Alright, so the way that it works is it defines a standard list of commands that any unmanned autonomous flying vehicle would need to respond to.
00:15:40.280 For example, a 'hail' command when it is sent will prompt a 'Roger' response.
00:15:46.000 Things like elevators, throttle, autopilot, these are all standard interfaces which have already been defined.
00:15:52.200 You just need to implement those in order to make your own flying vehicle.
00:15:59.680 So let's start by changing our baud rate to 192.
00:16:05.520 The reason for that is the XP modems can only communicate at a fixed baud rate.
00:16:11.880 It can go faster, but the old cheap Arduino clone we’re using here only supports up to 192.
00:16:18.400 Now, we're going to define a couple of the hardware things that we need.
00:16:24.000 One of them is the software serial interface.
00:16:30.240 We’re about to upload this code wirelessly. If all goes well, it'll work like the Arduino.
00:16:37.600 So, this first thing is saying we're going to use a serial interface to communicate with the separate motor controller controlling our motors.
00:16:44.240 We're going to assign it pin three and ten from our Arduino's input outputs.
00:16:50.560 Let's just call it 'main engines'.
00:16:57.360 And we also need a reset pin, which is going to be an output pin.
00:17:02.720 Come back; it's not supposed to do that.
00:17:08.640 Yet that's why I wish I had planned to do this.
00:17:15.679 So, pin four is going to be the main reset.
00:17:22.280 Once you pick up your own Arduino, it's pretty open as far as what you can do.
00:17:29.640 So, we've defined our pins that are going to control our little motor controller.
00:17:36.000 Now let's make the throttle do something.
00:17:43.880 We’re going to say if our current throttle direction is forward, then turn the motors on and go.
00:17:51.920 Forward tip is the name of the protocol, so that’s why we have that.
00:17:58.000 We're going to say that motor two is the left motor and we're going to turn it forward at a speed of, let's say, twenty.
00:18:05.110 We went through several motor controllers, burned out motors and overheating issues.
00:18:11.340 This led us to control some larger sizes that can handle much more power.
00:18:18.180 With the new motor control, we were able to get much more power through the motors.
00:18:25.130 In fact, if I go full throttle, the spin of the motors itself will cause everything to go in the other direction, like a helicopter.
00:18:31.360 This is something we didn't expect to happen and was not something we thought would be an issue.
00:18:38.640 Our fix for that is a prop or reverse pitch.
00:18:46.000 So we counter-rotate them and hope they go straight forward.
00:18:53.240 Okay, so let's interrupt here. Sorry, but here we're saying if the current throttle direction is forward.
00:19:01.040 We're going to turn on both motors going forward at a strength of twenty; otherwise, we will turn them off to zero.
00:19:10.960 That way, we have a way to stop it.
00:19:16.080 When we were practicing this demo, we realized, 'Oh oops! We forgot to turn them off!'
00:19:23.320 So that was kind of embarrassing. The last thing we need to do is initialize the motor controller.
00:19:30.520 The controller requires some initialization, so in case something goes wrong, it will turn itself off.
00:19:38.960 So we say quick reset and we tell it to use the main engine.
00:19:45.480 Okay, so now at this point it should be able to be compiled and uploaded.
00:19:54.480 Let's replace the battery so we don't destroy them.
00:20:06.840 Let's see what happens! It compiles...
00:20:13.840 Error! Live coding is quick... and we’ll try again.
00:20:21.760 Okay, so it’s going to try to connect wirelessly. Hopefully, this will work.
00:20:29.760 With all the wireless interference in here, if not, we’ll try again.
00:20:38.460 This is using AVR dude, which is a standard utility.
00:20:45.840 It connects and reads back to verify. It's written the data to the flash RAM that's on the Arduino.
00:20:53.760 Okay, we've just reprogrammed using that little sketch and made our own mini flying robot.
00:21:01.920 So let’s test it! I'm going to use the screen program to send it the serial commands.
00:21:20.520 Let's check its status. Operational!
00:21:27.320 Hang on to the tether. I'm going to tell it to throttle forward.
00:21:32.640 That should turn on the motors.
00:21:51.760 So as you see, it's just using a very simple serial communication protocol.
00:21:57.760 The amazing thing was, you go out, these guys spend like $2,000 on this amazing flying airplane.
00:22:04.480 And they're controlling it with this little $20 potentiometer.
00:22:10.560 If you go out to the United States government, do they use a remote to fly a predator? No! They use a joystick.
00:22:16.960 So that’s actually one of our next projects.
00:22:22.800 We’re going to use an Arduino connected to a joystick to create a complete standalone ground control.
00:22:30.000 This way, you won’t need a flaky laptop or computer.
00:22:37.280 So let's hopefully go back and reprogram it with the original code now.
00:22:45.600 We’re going to try to reload the code from before, which is a lot more complex.
00:22:53.040 Hopefully, it's going to work.
00:22:59.760 Keep your fingers crossed! We found that a lot of Wi-Fi interference is in the same frequency spectrum.
00:23:07.760 It sometimes isn't happy. But this time it made it!
00:23:13.880 We've just re-uploaded the original code that we were showing when it was flying around before.
00:23:20.080 Now it's verifying, so you can just use all the standard tools.
00:23:27.360 We're just providing ways that you can take different pieces around and combine them together.
00:23:35.360 Let's talk about the future for a minute.
00:23:41.680 If you want more information, go to flyingrobot.com.
00:23:49.520 You can also check out my blog at deprogrammerssociety.com and Damon's blog at myfirstairship.blogspot.com.
00:23:55.919 So right now, the Flying Robot gem is available as of yesterday.
00:24:04.960 You can actually go on GitHub, download it, and try this all out yourself.
00:24:14.320 If you have one of the more traditional Arduino boards that you can get from places like SparkFun.
00:24:21.760 This is when people say Arduino—this is what they're thinking of, not necessarily that.
00:24:27.520 But what we're really trying to show is that using these standard bits of open-source hardware and software,
00:24:34.320 you can go off and create your own flying blimp.
00:24:41.840 In fact, there's really a standard reference platform for Arduino-powered autopilots.
00:24:46.800 One of them is called Blimpduino, the flying blimp that Chris Anderson showed at the TCH conference.
00:24:55.440 If you think we had problems, they didn’t even get theirs working.
00:25:02.080 They stood there and held it the whole time. I really feel for those guys.
00:25:07.680 Luckily, because they learned all those things, ours pretty much work today.
00:25:14.560 Also, just so you know, while we spent a fair amount on development,
00:25:21.760 the actual parts in this thing, if you follow our parts list, is a little less than $200.
00:25:28.160 So for less than $200, you can have your own vehicle complete with the camera and the whole rig.
00:25:36.160 It's a really fun toy—that's great to play around with.
00:25:43.600 You know, if you want to cruise around your living room filming your family and friends, it's not that big a deal to get involved.
00:25:50.320 The stuff you learn about hardware—stuff I learned about soldering and batteries.
00:25:57.680 There are so many great ways to wire things. You know, I had never built a robot before.
00:26:03.760 So I figured the best way to go was to just jump in, way over my head, and start building.
00:26:09.680 See what you come up with. There were a lot of failed attempts along the way.
00:26:16.080 A lot of boards that we ended up having to scrap because we just didn't know what we were doing.
00:26:24.320 But we figured it out and worked our way through it.
00:26:31.680 We came up with something that's a lot of fun.
00:26:38.640 So yeah, feel free to go out there and jump into it.
00:26:44.160 You can make your own Paparazzi bot just like this one with a $25 camera.
00:26:51.600 So, should we fly one more time? What do you guys think? Oh yeah, alright!
00:26:58.640 Let’s do this!
00:27:04.800 The application written here in Shoes is also available on GitHub.
00:27:14.560 It's called Mercury, and it’s our digital compass.
00:27:19.440 In fact, why don't we show that?
00:27:25.680 We wrote a very simple little autopilot that isn't very smart, but it does sort of know how to find North.
00:27:32.040 So let's try it! We'll hit the turn on our autopilot.
00:27:38.480 Let's see how it's trying to find.
00:27:43.840 North. It looks like it's trying to find its way.
00:27:56.080 Oh, there are several... There's an LED readout on the motor controller on the Arduino D board itself.
00:28:03.520 And the XP—it wouldn't be an Arduino demo without a blinking light. That's kind of required.
00:28:10.640 Alright, let's turn off the autopilot.
00:28:22.080 F yeah, PL! That... they’re expensive!
00:28:38.320 We're not going home; we're just in the F all day.
00:28:46.640 We'll trade it for any one of these cars.
Explore all talks recorded at LA RubyConf 2009
Adam Blum
John Barnette
Brendan Lim
Jeremy Evans
Wolfram Arnold
Blake Mizerany
Jim Weirich
Pradeep Elankumaran
+7