Ruby Programming

Summarized using AI

make mruby more portable: Why and How

Yurie Yamane and Masayoshi Takahashi • November 28, 2017 • Earth

The video "make mruby more portable: Why and How" presented by Yurie Yamane and Masayoshi Takahashi at RubyConf 2017 discusses the challenges of low portability in mruby, particularly in the context of developing applications for embedded systems. The presenters share their journey in creating a smart toilet application, "Satri," demonstrating the integration of mruby with hardware like LEGO Mindstorms.

Key points discussed include:

- Introduction to mruby: A lightweight Ruby implementation tailored for embedded systems, facilitating easier integration with hardware, however, lacking support for certain features like keyword arguments.
- Compatibility Layer Proposal: An essential aspect of their project is the development of a compatibility layer that abstracts hardware differences, allowing for a unified API. This would enable developers to easily switch hardware components while maintaining functionality.
- Memory Consumption Issues: They highlight the memory limitations of some microcontrollers, proposing solutions to make mruby more efficient and adaptable for various hardware platforms.
- Learning from Arduino: The presenters draw parallels to the Arduino platform, which has a successful library system and IDE that streamline development, advocating for a similar environment for mruby to enhance developer experience.
- Encouraging Adoption: Emphasis is placed on creating easy-to-use resources, tutorials, and documentation to foster a vibrant community around mruby, much like that of Arduino, thus facilitating innovation and reducing compatibility concerns.
- Challenges Encountered: The presenters share their experiences with memory limitations and initialization issues when deploying applications, pushing for continuous refinement of their approach and libraries.

In conclusion, Yurie Yamane and Masayoshi Takahashi express their belief that enhancing mruby's compatibility and library support can cultivate a robust ecosystem for developers, similar to what Arduino has achieved. They invite contributions to their project, hoping to inspire others to engage with mruby and further its development.

make mruby more portable: Why and How
Yurie Yamane and Masayoshi Takahashi • November 28, 2017 • Earth

make mruby more portable: Why and How by Yurie Yamane & Masayoshi Takahashi

Physical computing is very fascinating and fun, but there are also difficulties that were not found in normal Ruby programming. One of the issues is its low portability. Unlike PC, some computer boards that directly uses the devices use only small microcomputer whose memory is less than 1 MB. So most of the applications work only on specific boards. If we found an interesting project, we could not try it unless I had a target board. To solve it, I propose a plan of mruby platform, consisting of a group of mrbgems that absorb incompatibilities. I talk about the project and current progress.

RubyConf 2017

00:00:08.580 Thank you for joining us for this session. We will talk about the processes of making MVP applications. This is the application we will introduce today.
00:00:13.830 My name is Yurie Yamane, and my co-speaker is Masayoshi Takahashi from Japan. We have both developed a mobile application as part of our project.
00:00:21.630 Our application is called Satri, which is a model of a smart toilet. Do you know about Japanese toilets?
00:00:26.430 They automatically open and close the lid when a person approaches. The toilet features a warm water washer, so you can use water instead of toilet paper. You can see more details in our PDF or video, which are both available on the website.
00:00:40.380 Totoro is a famous maker of toilets, and this model is their trademark.
00:01:04.070 Now, I have created a model of this toilet using LEGO Mindstorms, as they are versatile for education. I developed teaching materials for embedded system developers. Learning materials are significant for students. This model illustrates how to use a state machine diagram to program behavior. This way, I can teach students how to implement these concepts using LEGO.
00:01:35.430 Here's a video of the model: when a person approaches, a sensor detects their presence, and the lid opens automatically. If they sit down and press a button, the toilet will activate. If they stand up, the sensor detects their departure, and the lid closes.
00:01:50.110 Next, let's talk about the programming language we used for development: Mruby. It is a new language designed for embedded systems. Mruby has a minimal implementation, which allows easier integration with specific hardware. However, it doesn't support certain features like keyword arguments yet.
00:02:16.050 Mruby is notably used across various applications, including web servers, games, and IoT devices. We aim to discuss the data structure of the Mruby application. This gives you an overview of how we integrate custom libraries into a single project. We utilize both standard libraries and custom gems for Mruby applications.
00:03:05.290 Let me explain a key concept: we want to unify the API for different hardware components. Developers should not need to worry about specific hardware details only relevant for their application. For example, the API for motor control should be similar across different devices, so users can easily swap one component for another while maintaining the same functionality.
00:03:55.000 To achieve this, we propose a compatibility layer. The goal is to abstract the hardware differences so that users can work seamlessly with different platforms and architectures. However, the integration process may require more effort, as various compatibility layers exist for different devices.
00:04:45.750 Another pertinent issue is the memory consumption of Mruby. While it is efficient, it may still be too hefty for some microcontrollers. We propose creating a compatibility solution to address this issue, making it easier and more efficient for developers to bring their applications to a broader range of hardware.
00:06:01.600 We also need to ensure that this compatibility layer is easy to use. If developers can navigate our API without extensive learning curves, we believe we can encourage them to adopt Mruby for their projects. It is crucial to ensure that tutorials, documentation, and examples are readily available for all components involved.
00:07:03.910 One existing platform we can learn from is Arduino. Arduino has a well-established library system that provides a unified interface across various boards. Additionally, the Arduino IDE streamlines the process of developing applications, making it more accessible for enthusiasts.
00:08:56.920 The ease of use and extensive community support for Arduino mean that many users can get their projects up and running quickly, even if they do not have a background in programming. We should strive to make the same kind of environment for Mruby.
00:09:52.580 Further, supporting multiple hardware platforms with a singular codebase can generate a more incredible developer experience. We can also better facilitate innovation when developers spend less time figuring out compatibility issues and more time on creating unique applications. By developing more libraries and resources like Arduino, we can enhance the Mruby ecosystem.
00:10:51.540 We faced various challenges of memory limitations while deploying applications onto multiple boards. In particular, we have noticed memory issues during initialization phases, which may prompt us to modify the original code or configurations.
00:12:23.160 As we continue refining and deploying Mruby to more platforms, our primary goal remains to simplify the process for our users. We want our libraries to offer a clean interface while keeping the performance overhead manageable.
00:13:09.710 In conclusion, we believe that by improving Mruby's compatibility and library support, we can create an engaging and robust ecosystem similar to that of Arduino. If you feel inspired by our project and want to contribute, we welcome your involvement!
00:14:57.100 Thank you so much for listening to our presentation.
Explore all talks recorded at RubyConf 2017
+79