Embedded Systems

Domo Arigato mruby Roboto

Domo Arigato mruby Roboto

by Yurie Yamane and Maysayoshi Takahashi

The video titled "Domo Arigato mruby Roboto," presented by Yurie Yamane and Maysayoshi Takahashi at RubyConf 2015, explores the development of self-balancing robots using the mruby programming language. The presentation opens by establishing the relevance of robotics in modern life, showcasing both fun and complex robots, including the Yamaha Motobot, which can ride bicycles.

A primary focus is the explanation of an inverted pendulum self-balancing robot, mirroring technologies like the Segway. The speakers describe two types of robots they developed:

  • LEGO Mindstorms EV3 Robot: This robot utilizes a G sensor for balance and a light sensor for line tracking. The EV3 traditionally employs languages like C and C++, but the presenters have created a functioning mruby environment that allows for programmatic interaction. An overview of the code, which runs tasks based on priority management, is provided. The balancing task is crucial, as it continually adjusts motor power to maintain stability by reading light sensor data. The robots were demonstrated at a regional competition, highlighting their real-time operational capabilities.

  • DIY Raspberry Pi Robot: The presenters share their experiences building a self-balancing robot from scratch using a Raspberry Pi A+. They discuss components necessary for construction, such as a gyro sensor to measure angles, emphasizing the difficulties faced during development. These include challenges with the hardware and ensuring all components are compatible. The use of PWM for motor speed control is also noted, allowing for versatility in the robot's movement.

Throughout the presentation, Yamane and Takahashi stress the rewarding yet challenging nature of creating robots, motivating the audience to engage in similar projects. They conclude by reaffirming their message that building robots is not just a technical task but also a source of enjoyment, encouraging viewers to explore the possibilities of robotics with mruby.

In summary, the key takeaways include:

- The application of mruby in robotics, particularly for real-time systems.

- Demonstration of both LEGO Mindstorms EV3 and Raspberry Pi robots, showcasing different approaches to self-balancing tasks.

- Emphasis on the practical challenges and joys of robotics development.

- Encouragement to experiment with building robots, highlighting the satisfaction derived from such projects.

00:00:16.279 Hello everyone. Unfortunately, we are not here with K, and Don't See song Kil is not here, but we would like to say hi. We are very happy to be here again and want to say thank you for giving us a chance.
00:00:47.160 The topic of this session is robots, and there are many robots in our lives now. We can buy giant robots on Amazon Japan, and some robots can ride bicycles. This is a Yamaha robot called Motobot. Motobot says there are probably some things in this world that only I can do.
00:01:18.200 This is moto by Yamaha, and it drives a bicycle. The bicycle is not modified.
00:01:36.479 Some robots are smart. Let's introduce ourselves. My name is Yurie Yamane, and my name is Maysayoshi Takahashi. Our cat is our mascot; unfortunately, he cannot travel by air, so he stays at home during this conference.
00:02:05.439 We have developed an MV application and tools for mruby just for fun. We will show you two types of robots. The first one is Lego Mindstorms EV3. In this session, we would like to talk about a self-balancing robot. Do you know what a self-balancing robot is? It's also called an inverted pendulum. A self-balancing robot has mass located above its pivot point, which can make the robot unstable.
00:02:41.080 This robot is a simple demonstration of control theory. In this session, we will make a self-balancing robot using mruby. Do you know about the Segway? The Segway is one kind of self-balancing machine. I had a chance to ride a Segway at Inama University in Hosomi Praim, which is next to Man Prector M. This area is called Ch Ch Andu.
00:03:32.159 At that time, I was a part of Fukuyama University as one of the staff for the Choku Regional Competition of the Ed Technology Robot Contest, officially known as the Ed Technology Robot Contest. The contest aims to develop advanced skills in Ed technology, such as modeling, designing, and developing Ed systems. It is a contest where robots have the same design hardware.
00:04:30.520 In this context, we use two types of robots. The robot we introduce here is called EV3. It has two modes: it uses a G sensor for balance and a light sensor to track a black line on the ground. EV3 traditionally supports programming languages such as C, C++, and Java. From this year, we can use mruby with EV3.
00:05:20.840 We made a mruby environment for EV3, and you can find the code available for research. Unfortunately, we cannot bring the EV3 robot here, so please watch this movie.
00:06:19.240 The movie was taken during the regional competition in the Ch area of the robot contest this year. The red light under the robot is an infrared sensor to track the black line with the light sensor. The robot follows the course and can turn right or left along the line.
00:06:52.440 Okay, you are going to explain how EV3 works. First, we need to introduce its operating system, ECRT. ECRT is one of the AR developed in the topart project. Topas stands for Toyohashi Open Platform for Embedded Real-Time Systems. Toyohashi is a city located in Japan.
00:07:19.319 The name was selected based on the project leader, Professor Takahashi, who is associated with Toyohashi University of Technology. The mascot character of Topas is called Topi. In English, you can read more about the Topas project.
00:08:05.039 The Topas project is widely used in applications; many companies leverage its products. Some examples include synthesizers from Casio, digital pianos, printers by Brother, and hybrid cars by Nissan. These are just a few of the Topas project users.
00:08:42.080 The Topas project has developed various drivers and APIs for devices you wish to connect. For instance, in our case, we already had EV3 connections and drivers. However, while working on this, I found some bugs in ECRT when using mruby, which led me to contribute to Topas.
00:09:33.160 We will be using ECRT's APIs in this presentation. The schedule for the tasks in our program is based on priority management in a real-time operating system. Each task has its own priority. Lower priority tasks do not execute when higher priority tasks are running.
00:10:12.480 As mentioned, we will use three tasks: the most important task is balancing. This task occurs over four microcontroller cycles. We set the balance task as the highest priority. Each task is written in Ruby.
00:10:27.000 The code for balancing reads the brightness of the light from the sensor, adjusting power to the motors accordingly. This process is continuous, allowing the robot to maintain its balance.
00:11:05.000 In addition, we introduce another task to monitor the buttons pressed on the controller. This task is responsible for activating and initiating other essential functions.
00:11:43.600 When designing real-time systems, the critical factor is ensuring that tasks finish within their deadlines. This involves managing tasks based on their priorities, making sure high-priority tasks execute consistently.
00:12:28.080 We utilize alarms in our system, which periodically trigger task executions. These alarms manage the balance task and the button watch task, ensuring that the necessary processes occur even under high-priority task loads.
00:13:02.350 MB EV has this classes; for more information, please check GitHub. Part two: DIY self-balancing robots.
00:13:33.240 EVC is not so popular among the makers. However, can we create our own robots from scratch? It’s not easy, but it’s possible. We faced many challenges during development, yet it is rewarding. Many examples are available online for reference.
00:14:27.760 To build our robots, we need three components: a target board, sensors, and motors. For our project, we used a Raspberry Pi A+, which is cost-effective and works well with smaller batteries.
00:15:17.000 Initially, we started with a Raspberry Pi B; however, due to a hardware failure, we acquired a new A+. We discovered that various microcontrollers might present unique challenges, making code sharing difficult.
00:15:46.719 If you want to create complex tasks, crafting them on the Raspberry Pi can be quite challenging, but we can successfully achieve self-balancing functionalities.
00:16:36.150 To measure the angle of our robot, we require a gyro sensor. We decided to use the LC GD20, a digital gyroscope. While using it, we found that the initial unit did not function properly. Fortunately, the second one worked as expected.
00:17:10.800 We placed the sensor at the center of the robot for stable readings. We also used a Tamiy Motor for propulsion. The actuator controls were wired to the corresponding ports.
00:17:35.480 After setting up the sensors, we utilized a test program to ensure functionality. The motor's speed is controlled through PWM, allowing for variable output based on the required power.
00:18:32.020 As we demonstrated, the robot can move forward and backward depending on the input received from the control board. The main task is to maintain the balance of the robot while executing these movements.
00:19:39.990 In conclusion, we've discussed two robots using mruby. Building robots can be challenging, but it is also incredibly enjoyable. If you are interested, we encourage you to give it a try. Thank you for listening!