Talks

Charming Robots

Charming Robots

by Julian Cheal

In the presentation titled "Charming Robots" at RubyKaigi 2015, speaker Julian Cheal explores the exciting integration of robotic control using Ruby programming, building on the foundation laid by previous talks. This session encompasses a variety of engaging demonstrations showcasing how easily one can use Ruby and other languages to control different types of robotic devices, including drones, lights, and sound systems.

Key points discussed in the presentation include:

- Introduction to R2 Framework: Cheal begins by referencing the R2 framework introduced in 2013 for controlling robots with Ruby. He highlights advancements, indicating that Ruby programming has extended to work with other languages such as JavaScript and Go.

- Basic Robotics Demonstration: He illustrates fundamental programming concepts in robotics, like blinking an LED with an Arduino, which serves as an entry point to hardware programming.

- Control of Multiple LEDs: Cheal shows how to control multiple LEDs using a DigiSpark microcontroller and discusses the potential of utilizing Travis CI for monitoring coding results through LED indicators.

- Synchronized Visual Displays: Cheal uses an RGB LED strip that changes color based on sound volume, creating an example of how music can synchronize lighting for events.

- Hardware Accessibility: The focus shifts towards affordable hardware like Raspberry Pi, emphasizing the relationship between web technologies, microcontrollers, and robotics programming using Ruby.

- Fun with iBeacons: Utilizing a sonic screwdriver to detect iBeacons demonstrates the outcome of combining fun devices with Ruby programming.

- Karaoke using Robotics: An innovative karaoke setup showcases a Leap Motion controller, allowing users to interact with the karaoke system without traditional microphones.

- Music Generation via Ruby: Through Sonic Pi, Cheal demonstrates how Ruby can be used to compose music, highlighting the creative potential of coding for sound.

- Drone Control: A significant portion of the talk is devoted to controlling an AR Drone using Ruby, culminating in a demonstration that melds technology with artistic expression, including drone piloting via a dance mat.

- Integration of Technologies: The presentation culminates in a live demo that combines the control of a drone, lights, and music into one cohesive performance.

In conclusion, Julian Cheal expresses enthusiasm for the future of Ruby and robotics. He emphasizes the endless creativity that arises from integrating these technologies, suggesting that innovations will continue to emerge, helping to inspire the next generation to engage with programming through exciting platforms like Minecraft. The closing message advocates for the friendly nature of robots when programmed creatively with Ruby.

00:00:00 Hello everyone, my name is Julian Cheal, and today I would like to talk about robots.
00:00:06 Back in 2013 at RubyKaigi, Ron Evans and Ankush made a presentation about a new framework they developed called R2, which allows us to control robots using Ruby. Today, I want to show you how R2 has progressed since that time and what we can do with it.
00:00:28 In the present day, not only can we use Ruby to control robots, but we also have frameworks that allow us to control them using JavaScript and Go. This opens up exciting possibilities for integrating robotics with web technologies.
00:00:47 Now, let’s begin with a classic example. In programming, the first thing you often do is print "Hello, World!" In the world of robotics, the equivalent is blinking an LED. I'll demonstrate this using an Arduino that I have connected to my laptop.
00:01:15 As you can see, I am connected to an Arduino and an LED. We'll run a simple code that will instruct the Arduino to blink the LED. Let's give it a try.
00:01:38 Great! It seems that my Arduino is successfully blinking. So now we can see that with just a few lines of code, we can control an LED. This is essentially the foundation of hardware programming in robotics.
00:02:00 Once we can control one LED, we can easily extend this to control multiple LEDs. I have a small microcontroller called a DigiSpark connected, and with some code adjustments, I’ll show you how we can control more than one LED at a time.
00:02:31 Here, I have two LEDs connected to the DigiSpark. When I run this specific code, both the red and green LEDs should blink on and off. This small microcontroller is incredibly handy!
00:03:02 By connecting this to the internet, we could monitor the status of LEDs, for instance, using Travis CI to get notifications when our tests pass or fail. It’s a simple yet effective way to visualize coding results.
00:03:38 Next, I want to show you an RGB LED strip I have connected to another Arduino. This strip has 60 LEDs and can change colors based on the sound level around it.
00:04:04 Let’s plug in some music to see how the LED responds. As the volume of the music increases, you’ll notice more LEDs getting lit up.
00:04:28 The basic idea is that the loudness of the music controls how many LEDs are activated, allowing us to create light displays synchronized to the sound.
00:04:49 Using similar code, we can extend this to create large visual displays with thousands of LEDs. This could help create an immersive experience for events or parties.
00:05:12 Switching gears, I want to share that R2 can be used across various platforms. You can run it on laptops, Arduino boards, Raspberry Pi devices, and more!
00:05:29 These days, you can get very affordable hardware, like Raspberry Pi, for about five dollars! Imagine having an internet-connected device that can run Ruby and control various devices.
00:05:57 Now, has anyone here heard of Apple iBeacons? They send out notifications to devices when nearby. This technology can create interesting and interactive experiences.
00:06:27 I thought it would be fun to scan for iBeacons using a sonic screwdriver, a classic tool from Doctor Who. Let’s see if it can pick up nearby iBeacons as I wave it around.
00:06:56 As you can see from the output, we are indeed detecting iBeacons! We can measure the strength of the signals to identify how far away they are, all thanks to Ruby.
00:07:14 Now, as many of you know, karaoke is a major part of Japanese culture. I thought it might be interesting to build a karaoke machine using robotics.
00:07:41 In my setup, I have a Leap Motion controller, which detects hand movements. This means you can control the karaoke experience without needing to sing into a microphone.
00:08:20 This allows you to interact with the system in a more engaging way, making the karaoke experience less intimidating.
00:08:43 Moving on, I believe it would be fantastic if we could generate our own music using Ruby. Thankfully, we can do just that using a tool called Sonic Pi.
00:09:04 With Sonic Pi, we can create music by writing Ruby code. To illustrate this, I have a MIDI control device here that can send commands to Sonic Pi.
00:09:32 Let’s load the code and see if we can produce some sound!
00:09:41 As you can see, it takes just a few simple commands to create music! The integration between hardware and Ruby programming makes it accessible.
00:10:26 In addition to Ruby, we can also use Go for controlling robots. Go has a framework similar to R2, which opens up the possibilities for even more projects.
00:11:02 For example, I have a program written in Go that connects to a brain sensor. Let’s see what we can extract from this gadget.
00:11:33 With just a few lines of code, we can gather data from the sensor and use it to trigger other actions, like turning on lights!
00:11:54 This brain sensor can be a fun tool for collecting data and making interactive experiences. Now, I mentioned earlier that there might be some potentially dangerous demos.
00:12:12 To demonstrate, I have an AR Drone that we can control via Ruby. This drone has a lot of functionalities and a user-friendly API.
00:12:44 I’ll show you how we can make it take off and land with just a few lines of code. Let's connect it to our laptop.
00:13:06 Once I'm connected, I'll instruct the drone to take off and hover. Fingers crossed, we’ll be able to do this smoothly.
00:13:47 There we go! The drone is flying! As you can see, programming provides a fascinating way to interact with technology and robotics.
00:14:18 Of course, simply taking off and landing isn't the most exciting demonstration. Let’s see if I can control the drone using a PlayStation 2 controller instead!
00:14:45 This setup makes it easier to pilot the drone, much like a video game! However, the Bluetooth connection is sometimes unreliable.
00:15:18 We can also use dance mats as controllers, which adds an even more entertaining layer to piloting the drone.
00:15:39 Let’s plug in the dance mat and see if we can control the drone using our feet! Here we go!
00:16:02 As you can see, I'm now running the code while dancing on the mat. The drone is responding to my movements! This is a fantastic way to combine dance with technology.
00:16:45 So, by using music, dance, and interaction, we can create a unique and engaging experience with robotics.
00:17:12 Let’s move on to combine all our efforts: robot control, lights, and music into one cohesive performance.
00:17:37 I’ll set everything up and load the code to see if we can create a live DJ experience while flying the drone simultaneously.
00:18:03 Alright, let’s try one more time to get some spectacular visuals along with the drone's movements.
00:18:32 Unfortunately, programming can be quite unpredictable at times, so let’s just see how this goes!
00:19:01 As we explore the future of robotics and Ruby, one thing stands out: the integration of these technologies allows us endless creativity.
00:19:24 I believe that as Ruby continues to evolve, so will our capabilities with robotics. We won't just control these devices; we'll interact with them in innovative and exciting ways.
00:19:56 In closing, I want to express my excitement for future developments with Ruby in robotics, including integrations with platforms like Minecraft! This can make coding enjoyable for future generations.
00:20:18 Let's inspire kids to not only play games but to learn programming languages and build their own experiences. Thank you for joining me today!
00:20:42 Just remember, robots can be nice too, particularly when programmed with Ruby!