Summary
Do you like Legos, robots, and Python? This week I am joined by David Lechner and Denis Demidov to talk about the ev3dev project and how you can program your Lego Mindstorms with Python!
Preface
- Hello and welcome to Podcast.__init__, the podcast about Python and the people who make it great.
- I would like to thank everyone who supports us on Patreon. Your contributions help to make the show sustainable.
- When you’re ready to launch your next project you’ll need somewhere to deploy it. Check out Linode at www.podastinit.com/linode?utm_source=rss&utm_medium=rss and get a $20 credit to try out their fast and reliable Linux virtual servers for running your awesome app.
- Need to learn more about how to scale your apps or learn new techniques for building them? Pluralsight has the training and mentoring you need to level up your skills. Go to www.pythonpodcast.com/pluralsight?utm_source=rss&utm_medium=rss to start your free trial today.
- Visit the site to subscribe to the show, sign up for the newsletter, read the show notes, and get in touch.
- To help other people find the show please leave a review on iTunes, or Google Play Music, tell your friends and co-workers, and share it on social media.
- If you work with data for your job or want to learn more about how open source is powering the latest innovations in data science then make your way to the Open Data Science Conference, happening in London in October and San Francisco in November. Follow the links in the show notes to register and help support the show in the process.
- Your host as usual is Tobias Macey and today I’m interviewing David Lechner and Denis Demidov about using Python with the ev3dev platform for programming LEGO robots
Interview
- Introductions
- How did you get introduced to Python?
- Can you explain what the ev3dev project is and some of the story about how and why it got started?
- What is LEGO’s opinion of the ev3dev project?
- For anyone who isn’t familiar with the MINDSTORMS EV3 product from LEGO, can you give a brief overview of the hardware that they come with?
- Other than allowing users to program in environments other than the block-based editor that LEGO provides, what capabilities does the ev3dev project add to the MINDSTORMS EV3 platform?
- How are the language bindings generated and how do the different implementations compare to each other?
- What are the most challenging aspects of building and maintaining the ev3dev distribution and various language bindings?
- One of the things that my son is curious about is the possibility for integrating his MINDSTORMS with projects such as Kalliope or Mycroft to allow for voice controlled robots. Are you aware of anyone having done so or how you would approach something like that?
- What are some of the most interesting or innovative projects that you have seen people make with the MINDSTORMS platform running ev3dev?
- Why would someone want to use MINDSTORMS instead of any of the other robotics platforms that are available?
- For someone who is interested in learning more about intermediate and advanced robotics, what are some resources that you would recommend?
Keep In Touch
- Denis
- @denis_demidov on Twitter
- ddemidov on Github
- David
Picks
- Tobias
- Denis
- David
- Local food
- LocalHarvest
Links
- ev3dev
- Lego MINDSTORMS
- BeagleBone
- Lego Mindstorms Community
- C++
- Jupyter Notebooks
- Ralph Hempel
- Forth
- RCX
- NXT
- EV3
- ARMv5
- Debian
- PiStorms
- BrickPi
- EVB
- UART
- EV3 Schematics Look for “EV3 Hardware Developer Kit” in “Advanced Users” section.
- I2C
- RPyC
- Laurens Valk
- Liquid Templates
- Delta Robot
- Quest For Space
- Lego Technic
- Mindsensors.com
- Cool robots built with ev3dev
- Micropython
The intro and outro music is from Requiem for a Fish The Freak Fandango Orchestra / CC BY-SA
[00:00:14]
Unknown:
Hello, and welcome to podcast.in it, the podcast about Python and the people who make it great. I would like to thank everyone who supports us on Patreon. Your contributions helped to make the show sustainable. When you're ready to launch your next project, you'll need somewhere to deploy it, so you should check out Linode at www.podcastinit.com/linode and get a $20 credit to try out their fast and reliable Linux virtual servers for running your next app. Do you need to learn more about how to scale your apps or learn new techniques for building them? Pluralsight has the training and mentoring you need to level up your skills. Go to www.podcastinit.com/pluralsite to start your free trial today.
You can visit the site to subscribe to the show, sign up for the newsletter, read the show notes, get in touch, and support the show. To help other people find the show, please leave a review on Itunes or Google Play Music, tell your friends and coworkers, and share it on social media. If you work with data for your job or want to learn more about how open source is powering the latest innovations in data science, then make your way to the Open Data Science Conference happening in London in October and San Francisco in November. Follow the links in the show notes to register. Your host as usual is Tobias Macy. And today, I'm interviewing David Lechner and Dennis Demidov about using Python with the ev 3 dev platform for programming Lego robotics.
So, David, could you please introduce yourself first?
[00:01:29] Unknown:
Sure. I'm David Lechner. I'm kind of lead maintainer of ev 3 dev. I've been doing that for the last 4 years. I'm also a freelance programmer, but I spend way too much time on e b 3 dev. And I'm also a LEGO Mindstorms community partner. That's a group of about 55 people from all over the world that work with Lego kind of indirectly through their marketing department to promote Lego Mindstorms magic as they call it. This last year, I guess, in my freelance work, I've gotten paid for doing more Mindstorms stuff than anything else. So I think I can just call myself a Lego mindstorms expert now.
[00:02:15] Unknown:
Is there a particular area that you specialize in for your freelance work?
[00:02:19] Unknown:
The biggest project I've had over the last year is working with a nonprofit company in California that has adapted the Lego Mindstorm software to the BeagleBone, and they're sending it up to the International Space Station. So they hired me to, do all the programming work of adapting the software to the new hardware.
[00:02:44] Unknown:
That sounds really interesting. Alright. Dennis, how about yourself?
[00:02:48] Unknown:
Hi. So I'm at Allego Mindstorms is just a small hobby of mine. I'm actually a researcher at Supercomputer Center of, the Russian Academy of Sciences. And, I think 2 years ago, we bought a LEGO Mindstorms set for our kids, and I had a small amount of experience with programming it through the official software, but unfortunately it didn't allow me to use Linux as an operating system so I started looking for other options and found out about the ev3df project, and then at some point I created a Python library for programming that, which was then later moved under Ralph Hempel account, who is another founder of the project I think, and so now I'm just 1 of the maintainers of the Python library that allows you to program the Lego Mindstorms.
[00:03:57] Unknown:
Yeah. I had a similar experience where I bought the Lego Mindstorms kit for my son and then found out that the only supported platforms for their, distributed programming environment with the block based syntax was Windows or Mac. And I have Windows computers, so that's what he's using currently, but that's what led me to discover the EV 3 dev project and definitely something that I'll be digging into more as I progress on, you know, the different projects that we work on with the mindstorms with him.
[00:04:26] Unknown:
And then programming by dragging blocks around with the mouse gets old very soon.
[00:04:36] Unknown:
Yeah. For me, who's used to working in a text based environment, it's definitely very it feels very slow and limiting having to, you know, drag around. And also, the fact that the laptop that I'm running it on is fairly underpowered just makes the whole thing very frustrating.
[00:04:51] Unknown:
That's the feedback we get quite often.
[00:04:54] Unknown:
Also, other other thing you do with, your mouse is, very hard to document to put into
[00:05:01] Unknown:
version control system to test. Yeah. So starting with you again, David, could you explain how you first got introduced to Python?
[00:05:10] Unknown:
Sure. It was actually through the e b 3 dev project. Being the maintainer, I have, you know, lots of mundane tasks to do. And eventually, I got to the point where shell script just wasn't cutting it anymore, and I needed something a little more powerful. So I started using Python to write scripts to automate tasks for putting together documentation or releasing software, things like that.
[00:05:35] Unknown:
And, Dennis, how about yourself? Yeah. I think it was about 15 years ago. I was working at a system integrator company at the time, and we were deploying a warehousing system for a bank. And they used Python as a scripting language, and I really hated Python at that at that time because it was very different from everything I programmed before, but yeah I just had to use it anyway and learned to love it, to love it, and today my main programming language is C plus plus but I use Python as an interface to my compute libraries. So I'm using, Jupyter Notebooks a lot, and I'm creating Python modules from c plus plus today. I really I really love Python today.
[00:06:28] Unknown:
So before we get too much further, I'm wondering if you can both give at least high level overview of what the e b 3 dev project is and some of the story about how and why it got started.
[00:06:40] Unknown:
The story of how it got started is starts with Ralph Hempel. He couldn't be here today because he actually works for Lego now. He just started there a year ago, but he's been involved in Lego Mindstorms for probably 20 years. And he's always had a big project with every version of Lego Mindstorms that, came out with the first generation. He wrote a 4th programming language library for the RCX, and then in the NXT, he wrote a 4th programming language library for it. And so if when the EV 3 came out, the EV 3 is a little different because the previous generations were just basic microcontrollers, but the EV 3 is basically a ARM computer, and it can run Linux. So the idea was that we wanted to make any programming language you want possible on the e v 3. And so Ralph started porting Debbie and Linux to the e v 3 since e v 3 has a ARM v 5 instruction set processor with no floating point unit.
So that's like a step down from a Raspberry Pi. So Debian is really the only Linux distribution that still supports a processor without a floating point unit. So it's kind of the only option, But that's kinda how it got started.
[00:08:12] Unknown:
And from what I understand, the e v 3 dev project also targets the Raspberry Pi as a possible deployment environment. And from what I've read, it requires an add on called Brickpy for being able to interface with the Mindstorm sensors and motors. So are there any particular challenges that come about from having to support both of those different platforms and the different instruction sets?
[00:08:39] Unknown:
Well, it's actually even more interesting than that. There's several third party products. There's the Brick Pi, Raspberry Pi, then there's also a PiStorms from mindsensors.com. That's also for Raspberry Pi. And a while back, there was also a Kickstarter for a it's called the Fat Cat Lab EVB. That's for beaglebone, which, unfortunately, it's not for sale anymore, but there's a few people out there that have them. So we support 4 different, platforms in total. The it definitely has been a challenge trying to get all those to work. The the biggest problem is that people just do this for fun, so they aren't buying all 4 different systems. So it's hard to find contributors to that understand how all the things work and fit together, but we've tried to make it a common software that runs on all 4 different devices so people don't have to know if you have an EV 3, it works this way. And if you have, highstorms, it works this way because they all have kind of fundamentally the same thing. They all have 4 input ports. They all have 4 output ports.
Most of them have a screen, things like that. So we can design software to that works basically the same on all of them.
[00:10:00] Unknown:
And, David, I think I saw somewhere on the on the site that you can, install the drivers on your normal PC and use them somehow with the Lego sensors and motors. Is that correct? Or do you have to hold something?
[00:10:17] Unknown:
The approach we've taken is we've made, you know, Linux hardware drivers so you can install them on any Linux computer, not just e v 3 or Raspberry Pi. Then how do you actually connect the sensors to your computer? Well, that depends on the type of sensor, but the LEGO Mindstorms EV 3 Sensors use UART. So if you get a USB to serial converter, you can connect those sensors to any computer with USB.
[00:10:47] Unknown:
So you can build yourself a little robotic legs platform for your laptop to follow you around?
[00:10:52] Unknown:
Sure.
[00:10:54] Unknown:
I'll maybe just smart home.
[00:10:57] Unknown:
So what is Lego's opinion of the b 3 dev project? Is it something that they, promote and contribute to? Or is it just something that they tolerate?
[00:11:09] Unknown:
Lego is very careful about never endorsing any third party products or even giving a official opinion on it. But back when the first generation, like, a mindstorms came out, people reverse engineered it right away, and Lego was panicking. They're like, oh my gosh. What do we do? But they made the decision of let's just let these guys go and see what happens. And, you know, people did all sorts of amazing things with it. So the next generation with the NXT and, again, 3rd generation EV 3, Lego has open sourced all their software. So, basically, they're encouraging people like us to do what we do and giving us the resources we need that we've got the schematic of what's inside of it and all the software that runs on the EV 3 brick itself is open source, so we can go through it and see how LEGO did it and copy it or improve it. Whatever.
[00:12:11] Unknown:
Yeah. I definitely think that that was a smart move on their part because from what I can tell and also from my personal perspective, having that ability to, you know, hack it and do unexpected things with the platform and the sensors is really what has caused it to be as much of a success as it is. Because whenever there's a platform that's locked down and people want to be able to extend it in their own ways and they're prevented from doing so, it generally, starts to create a certain amount of ill will towards the product. Whereas if the company either, you know, helps people, you know, add new capabilities to the system or at least, gives them the ability to do it and does it doesn't stand in their way, then it makes it much more, popular from, you know, hobbyists and people who are interested in exploring the boundaries of what's possible with the different hardware.
[00:13:04] Unknown:
Yeah. For me, that's definitely what got me interested is what can we make this do that it wasn't designed to do.
[00:13:12] Unknown:
David put link to a YouTube video of, various, projects that people did with the evil 3 diff and it's very interesting to see. Yeah. Definitely add that into the show notes. And for anybody who isn't familiar with
[00:13:25] Unknown:
the Mindstorms EV 3 platform, I'm wondering if you can give a brief overview of the hardware that it comes with and, maybe some of the 3rd party modules that people have built for it. The e v 3 is
[00:13:39] Unknown:
basically a they call it the intelligent brick because it's a Lego brick. You can hook Legos to it, and it comes with 4 sensor ports to attach different types of sensors. There's a light sensor that can also measure 6 7 different colors. There's a infrared sensor that can be used with the infrared remote control that comes with it, or it can also be used as a proximity sensor to measure distance. It comes with a touch sensor. It has 4 output ports that you can hook motors to to make your robot move, you know, hook it to wheels or levers, anything.
It also has a speaker so it can play sound, a black and white LCD displaying. It also has a USB port, which a lot of EV 3 dev users have fun trying to see what kind of devices, USB devices you can attach to it and make work. Since we're running Linux on it, anything that has a Linux USB driver, we can make it work. And it also has a SD card slot, which is
[00:14:52] Unknown:
how we install EV 3 dev on it. Yeah. The the SD card slot was, the decisive point for me because you can just put the EV 3 dev system on a SD card. Yeah. Insert the the card into the brick, and, boot it as a second operating system. You don't have to get rid of the stock system. And you can just plug the card out and then boot into the default system. So you don't have to
[00:15:19] Unknown:
There's an internal flash memory that the official LEGO firmware lives there. So e v 3 dev is kind of like dual boot where we're not riding over the flash memory. We're just booting from the SD card.
[00:15:33] Unknown:
So it's very easy both to try out the the 3 d f project and to go back to the original system.
[00:15:42] Unknown:
And from the hardware perspective, does the brick provide a certain level of abstraction sensor inputs, or is that, fully on the responsibility of e v 3 dev and the hardware drivers that you write to be able to provide a certain level of abstraction for the language binding so that you don't have to process all of the input signals and try and figure out what it's trying to tell you.
[00:16:06] Unknown:
Yeah. That's what we've done with the EV 3 dev is written drivers to add that level of abstraction because the sensor that that's work in different ways. Some sensors use UART. Some sensors use I squared c. Some are just a 0 to 5 volt analog signal. And the e v 3 actually has a clever sense system to automatically detect sensors that it can, for the most part, if you plug a sensor in, it knows which sensor you plugged in. So we've tried to keep that functionality and then, yeah, provide a abstract interface so that all the sensors look the same to the programmer, or you're just reading a value that's whatever kind of information that sensor is measuring, and you don't have to know about what type of communication or signal is being used.
[00:17:00] Unknown:
And how are the different language bindings generated? And I'm wondering how they compare to each other as far as whether any particular binding has certain capabilities that aren't present in the others?
[00:17:13] Unknown:
So the the the system, that, AVL3 dev uses is very convenient from the library developer point of view because it's just a set of files that you can, read and write to. The files are residing in, CSFS, file system. That's a virtual file system which is basically a window into, some kernel state. So you can, use any language that can read and write files. You can do it with, bash scripts, you can, currently we have I think, Python, C plus plus JavaScript, C, Java, dingjings. So basically people come and create dingjings in their favorite language. It's it's easy to do and, yeah, I think that was the great choice by Radolf and David to to come up with this system.
[00:18:08] Unknown:
And for people who want to use the Python language bindings, is there an additional step necessary beyond downloading ev3dev to be able to install the runtime for being able to execute the programs that they write on the logic brick?
[00:18:23] Unknown:
Well I think currently the, the library is included into the image by default so you just can fire off your Python interpreter on the break, and, yeah, try some programming. The biggest problem I think is the the fact that the brick comes with the ARM processor, which is very slow and makes things inconvenient to to develop and try out on the brick itself, so you most of the time you are trying to stay on your big computer, on your host computer, and then you transfer the Python scripts to the Greek and run them from there. So I think that was the 1 of the biggest hurdle for people that are not familiar with how things done on Linux and how how do you transfer files between your computers on Linux. I think the biggest amount of questions we we have all just was how to how to use the links on the brick, how to how do you transfer files to, how do you execute the files there, how, Yeah. This means
[00:19:48] Unknown:
Windows doesn't have executable bit. That's the biggest problem.
[00:19:53] Unknown:
That actually brings up an interesting question about whether there's any sort of, you know, testing harness or simulation environment to make sure that the code that you write on your host computer is valid and will produce at least reasonable outputs on the brick itself before you load it over? Or is it purely just a right load execute and then re retry kind of cycle?
[00:20:20] Unknown:
I think there were some ideas about coming up with some virtual environment, which, simulates the the brick, but, so far I don't think there is anything like that. Yeah. Not compatible with ev3dev
[00:20:36] Unknown:
anyway.
[00:20:37] Unknown:
And when I was going through the documentation, 1 of the projects that I saw actually mentioned the possibility of using something like our pie c running on the brick so that you can use your host computer as a command and control point and actually send commands interactively to the brick. Is that something that either of you have played with or have some more detail on?
[00:20:57] Unknown:
Yes. The the r rpyc project, allows you to fire a server script on your target computer then you can connect to that server from your client computer and then you basically have a Python interface to to your target computer, so you can, you could for example use an interactive Python shell like Jupyter Notebook or Spyder or, IPython, and you can interactively try commands. And the things that you are doing will be transferred, transparently 2 d brick, and run there, so I think it's 1 of the more convenient things to to try to work with the EVA3DF interactively.
Another option that people tried a lot is you can run IPython server on the ev3 and then you can connect with your just through web interface you can connect to the IPython notebook, which is running there, and actually I saw a video by Lawrence Volk where he connects to ev3dev through ipython, and that was my first introduction to evis3dev and, I switched to evis3dev immediately after I saw that video. And, but, IPython is, so the drawback of IPython is that it's pretty heavy, and it's not as responsive as with RPC, and I think the memory usage grows with time, and it becomes less and less responsive as you use it, as you use the interactive session.
So, yes, I would recommend ARPAYC as a driver for your interactive experiments.
[00:23:08] Unknown:
And what are some of the most challenging aspects of building and maintaining the, ev 3 dev distribution and the various language bindings?
[00:23:18] Unknown:
Well, for maintaining EV 3 dev itself, it's the breadth of knowledge that you have to have because, you know, it's a full Debian Linux distribution, including the kernel and everything. So I have to know everything from kernel hacking, how to write hardware drivers, to how to write user space software programs, and then how do you make a w in package for them, and then how you distribute it, and how do you maintain GitHub to get feedback from users. It's quite a wide range of of things to have to be an expert about.
[00:24:01] Unknown:
And I imagine that given the constrained optimize the CPU and memory usage of the, core distribution so that you have more space for users to actually perform the actions that they're interested in doing.
[00:24:23] Unknown:
Yeah. That's definitely been a challenge of figuring finding software that will run efficiently on the limited resources. The e v 3 is just a 300 megahertz ARM Processor with 64 megabytes of RAM. Debian actually has a 128 megabytes of RAM listed in their system requirements. So we're, like, already running on less than minimum.
[00:24:48] Unknown:
And then from the library developer perspective, it's it's I think it's less and less the case now but, the programming API of the EVSIDF used to change very fast, in the past and, we had to maintain different language bindings that we have, and, I think the system that, Kael and Landry came up with, where we just maintained a single specification in form of a JSON file, a JSON database, And then we generate each of the official libraries using liquid templates. So the source code for the libraries is just normal source code interspersed with pointers, where we just say 'here goes the definition of some device like motor or sensor' and then the templating system replaces the tags with the actual definition of the motor, and inserts all the different attributes that can change between driver versions.
So mostly maintenance between different kernel versions is equivalent to we just have to change the language building specification, the unified language building specification, and then we just have to run some scripts, and we are getting the updated language in buildings. Now I think, the API, does not change as frequently as it used to, so maybe the main challenge today is to, provide unified interface for different platforms that evcdef supports, because the ev3brick and the pystorms and the brickpy they have different variabilities in what they can do and what they cannot, and we somehow have to come up with a common interface or decide at runtime which features we are going to support and which we are not going to.
[00:27:01] Unknown:
And I imagine too that trying to come up with a, user usable user facing API for controlling the different sensors and motors is an interesting challenge as well because you want to make sure that the language is fairly intuitive as far as motor dot rotate 90 degrees or something like that, but also exposes all of the full capabilities so that people aren't limited by the API that is exposed.
[00:27:30] Unknown:
Yes, that that that is actually 1 of the more recent, discussions that we had on GitHub. I think David wants to come up with an interface that is as close as possible to the official software, so people coming from the official software are able just to replace their bricks in their graphs with simple commands in the library, but that is yet to come. For now we just have a unified interface, which is just, basically, reproduces the file system structure that we have in CSFS. But I think Python is, Python makes your life as a user of the library much easier than other bindings, I think.
The keyboard argument interface of Python functions was, I think, really helpful here. It, suits the programming interface of the u verse 3rdf really well.
[00:28:34] Unknown:
Yeah. Having the kw args, pass through for function definitions is definitely useful for being able to, expose the underlying bits and pieces while still providing a usable interface for the sort of general case of what people are going to be passing through.
[00:28:52] Unknown:
Yeah. And you can add to it without breaking it. I think that's the nice part.
[00:28:57] Unknown:
So for people who are using the brick that comes with the E B 3 Dev Kit who want to be able to pull in, additional Python modules to maybe add functionality for the software runtime or, you know, make some of their logic flow easier to manage. Is that something that they can do with eb 3 dev as far as just doing a PIP install, or are there limitations that are inherent in the platform that it's running on that would, sort of limit you to just using the Python standard library?
[00:29:29] Unknown:
Pip install is definitely possible, and there are just pre compiled libraries, like you can install Python NumPy, Python scipy, things like that. The main limitation of pip install is sometimes it tries to compile things on the fly from C plus plus and then it can take really long time on the brick, or maybe we can just exhaust the resources completely and
[00:29:59] Unknown:
the brick will reboot. But the nice thing about being Debian is that Debian has a lot of Python packages packaged up in a Debian package. So even if it is has native code, it's already been compiled on Debian build servers. So you can just apt get install Python 3 dash whatever your Python packages, and you could it's usually there already.
[00:30:32] Unknown:
Is is that true even for
[00:30:34] Unknown:
ARM system? Because Yes. Even for the ARM EL version of Debian.
[00:30:40] Unknown:
And, 1 of the things that my son was curious about when I was talking to him about, this interview was what the steps would be for integrating the, Python bindings for e b 3 dev with something like a, voice activated AI assistant such as Calliope or Mycroft so that you could build a voice controlled robot?
[00:31:02] Unknown:
Well, I haven't heard of anybody trying those specific programs yet, but I had a quick look at their documentation, and it looks like both of them are capable of running any shell command. So you can write a Python script and run it from a shell. So you should be able to quite easily integrate e p 3 dev with either of those, but you would have to write your own
[00:31:28] Unknown:
Python program to do whatever it is you're trying to do. Yeah. And I imagine too that those, run times would be limited to the Raspberry Pi or BeagleBone interfaces with the, interface boards for actually controlling the motors and sensors because I don't imagine that you would well, 1, the processing capabilities, but also the limitations of IO as far as the microphone input, would sort of prevent you from wanting to do that on the actual, stock LEGO brick.
[00:31:58] Unknown:
Right. Yeah. You wouldn't be running the the speech recognition or anything on your e p 3 itself.
[00:32:04] Unknown:
Here again, maybe RPC makes your life a bit easier because you can run, heavily, the problems that, programs that use heavy computations on your host computer and then, just control your evis3 break from from there through ARPIC.
[00:32:22] Unknown:
Yeah. That'd be another interesting approach that you can just have have have your, tell your Alexa to command your robot to come to a particular room or whatever it is that you want it to do. So, yeah, bring me a drink. Yeah. So on that note, what are some of the most interesting or innovative projects that you've seen people make with the Mindstorms platform and the e v 3 dev distribution and language bindings?
[00:32:47] Unknown:
For me, the the ones that really catch my eye are the Delta robots. I'm not really sure what it is about them. I think it's maybe because they can move in 3 d space, you know, freely in any direction. Most of the time, if you have a robot arm, it looks stiff because it's just moving along a single axis of rotation at a time. But when you have a delta robot, it has 3 arms controlling 1 manipulator or whatever, and they're just fun to watch. 1 of the very first things somebody built with EV 3 dev was a robot that catches a ball that he threw to it. It was pretty impressive.
[00:33:29] Unknown:
And, Dennis, are there any particular, projects that you've seen you'd like to call out? Yeah. I think,
[00:33:35] Unknown:
David, you talked about about it. What do they want to send, Lego brick for into space? Are they going to use m 3 d for
[00:33:46] Unknown:
Oh, yes. So, yeah, this project is called quest for space. The the basic premise of it is that, you know, schools already have Lego Mindstorms EV 3 kits and software, know how to use them. So this is kinda aimed at middle school age, 7th, 8th grade. And the idea is that kids in a classroom can design an experiment using their LEGO Mindstorms software. And we've taken all of that and made it run on the beagle bone. So, basically, what reason for doing that is sending stuff into space. It is very expensive, so we made it as small as possible. We took out the things you don't need. You don't need a speaker. You don't need the display screen, all that kind of stuff. So we've just taken it down to the bare minimum motors and sensors and the beagle bonus, the main processor. And, so they'll be able to take their program and upload it to the space station and run the same program that ran on their Lego MIND storms up on the space station on the BeagleBone platform to perform some kind of experiment in microgravity.
1 of the experiments they have going on right now is looking at convection currents in space because, you know, here on Earth, we say that heat rises. That's because cold air is more dense than hot air, and gravity pulls the cold air down so the hot air goes up. But when you don't have gravity, what happens?
[00:35:26] Unknown:
Yeah. That does sound really cool. Alright. So for somebody who's curious about robotics, why would they want to use the Mindstorms platform with or without e v 3 dev as opposed to any of the other robotics platforms that are available for consumers?
[00:35:41] Unknown:
Well, for me, the best part is that it's Lego. You can take all these LEGO parts. LEGO Technic sets have pneumatics. They have gears. They have all sorts of things. You can build almost anything out of it. You don't need a 3 d printer. You don't need a machine shop, and you can build incredible things. And then when you get tired of it, you can take it apart,
[00:36:05] Unknown:
and you can build something else new. You can actually build it, a 3 d printer from LEGO. It will I saw projects that, just use small Lego blocks as a printing medium, so they do not print, they just, assemble something from small LEGO blocks, but it works almost as a normal 3 d printer.
[00:36:31] Unknown:
And for somebody who's interested in learning more about more intermediate and advanced robotics, what are some of the resources that you'd recommend?
[00:36:40] Unknown:
That's a good question.
[00:36:42] Unknown:
I I could just strike that if you don't have an answer. That's fine too. I'm kind of a person that likes to figure it out for myself
[00:36:49] Unknown:
and, you know, I I learned through doing. But,
[00:36:53] Unknown:
for me, creating the library was much more interesting than, actually building the robots.
[00:37:00] Unknown:
But the the Layhost blog, that Layhost is another third party operating system for EV 3 and, like, a Mindstorms that's based on Java. They have a blog, and they've gotten into some of the more advanced topics you might call it, like computer vision and control algorithms. They have some some interesting articles there kind of on the the general principles of of those.
[00:37:27] Unknown:
So are there any other topics that we should bring up before we start to close out the show?
[00:37:32] Unknown:
Yeah. 1 of the things I'd like to talk about is micro Python. That's basically a version of Python 3 that is designed to run on microcontrollers. I discovered it recently because I was working on a new camera sensor for my sensors.com. They developed a new it's basically a little camera that can do fun things like track objects and follow lines and facial recognition, but the firmware for this little camera is based on MicroPython, which apparently was a Kickstarter thing that started a couple years ago. And so the software on this camera is written in Python, which is pretty impressive for, you know, not being a full blown computer. And since we've talked about, you know, the limited resources on the e v 3 brick, it's not nearly as powerful as a Raspberry Pi.
We've gotten micro Python running on the e b 3 now. So it currently takes about 8 seconds to start up a a Python program, in for EV 3 dev because it takes about 2 seconds to just get the Python 3 runtime up and running, and then it takes quite a bit of time to import the various modules. And so, you know, it's kind of a drag for when you're during your development cycle when you make a change and then you send it to the brick and then you have to wait 8 seconds for your program to start. You know what? Doing it once is not so bad, but when you're doing it over and over and over again, you get tired of it. So we're playing around with micro Python to see to, you know, improve the speed. But since it's not full Python 3, it you can't just import at any Python module, so it's a little limited.
And there's a few caveats, but more or less, it's basically Python 3, which is really cool.
[00:39:35] Unknown:
Yeah. Just today, Kaelin did some tests, and, running a simple hello world hello every 3 d f world, script on Python takes, 10 seconds on Python 3 and, I think 4 seconds on the MicroPython, So it looks very promising.
[00:39:53] Unknown:
Yeah. It's definitely an interesting distribution and and some interesting work that he did on it, and I actually interviewed him a while back. And at the time, he was working with the, EU Space Agency to see about, using it for soft real time systems in some of the experiments that they were getting ready to launch.
[00:40:12] Unknown:
Everybody wants to send their stuff to space.
[00:40:16] Unknown:
So for anybody who wants to get in touch with either of you and follow the work that's being done with e b 3 dev, I'll have you add your preferred contact information to the show notes. And with that, I'll bring us to the picks. And my pick this week is going to be the Raspberry Pi. It's something that has come up a lot of times on various episodes of the show, but it's a pretty great little computing platform for being able to do experiments and have throwaway environment that you can, you know, just load some Linux on, play with it for a while and if you break everything, well then you just wipe the card and try over. Most recently, I've been getting the Calliope project set up on it to experiment with some voice control and, introduce my son to doing some programming by adding some tasks to that. So I'll add that as my other pick. And with that, I'll pass it to you. Do you have any picks for us this week, Dennis? Yeah. For me, that would
[00:41:08] Unknown:
be PYBINT 11. That is a library that allows you to create, Python modules from c plus plus, and I'm using it a lot these days. You can just write some heavy duty computation that are running on, your CPU or even on your GPUs, and then import the library into Python with help of pybind11 and immediately gets the, the speed up from your computational resources, from inside Python. And it's very nice to it's nicely, coupled with the c plus plus, so very convenient.
[00:41:46] Unknown:
Alright. And David, do you have any picks? Yeah. My pick is local food. That's kind of my hobby besides robots is eating good food. My wife and I are part of the Oklahoma Food Cooperative, which is a organization that connects farmers and ranchers with consumers. So they have a monthly shopping system where farmers put on what they have this month, and you can order it, and it gets delivered to your local city. And we also this last week was our anniversary, and we went to a a restaurant in Luther, Oklahoma. It's on Route 66 about 30 minutes outside of Oklahoma City.
It's called, 615 Farmstead Market and Table. It was really great food. And I I think it's fun that, you know, when you get to know the people that are producing food around you, You know, we went to this restaurant, and they're getting their food from the same people that we already know from the farmer's market and other places where we get our food.
[00:42:51] Unknown:
Alright. Well, I appreciate the both of you taking time out of your days to tell us all about the work that you're doing with eb 3 dev and the Python bindings and playing around with the Lego robotics platforms. It's definitely something that, I've been finding personally interesting and something that I plan on exploring more as I, work with my son on learning how to build new robots. So I appreciate your time, and I look forward to seeing some of the work that you produce in the future.
[00:43:19] Unknown:
You're very welcome, and we hope to hear back from you on GitHub if you have any problems, have any suggestions on how we can improve things.
[00:43:28] Unknown:
Alright. Thank you and I hope you both enjoy the rest of your days.
[00:43:31] Unknown:
Alright. Thanks. Bye.
Hello, and welcome to podcast.in it, the podcast about Python and the people who make it great. I would like to thank everyone who supports us on Patreon. Your contributions helped to make the show sustainable. When you're ready to launch your next project, you'll need somewhere to deploy it, so you should check out Linode at www.podcastinit.com/linode and get a $20 credit to try out their fast and reliable Linux virtual servers for running your next app. Do you need to learn more about how to scale your apps or learn new techniques for building them? Pluralsight has the training and mentoring you need to level up your skills. Go to www.podcastinit.com/pluralsite to start your free trial today.
You can visit the site to subscribe to the show, sign up for the newsletter, read the show notes, get in touch, and support the show. To help other people find the show, please leave a review on Itunes or Google Play Music, tell your friends and coworkers, and share it on social media. If you work with data for your job or want to learn more about how open source is powering the latest innovations in data science, then make your way to the Open Data Science Conference happening in London in October and San Francisco in November. Follow the links in the show notes to register. Your host as usual is Tobias Macy. And today, I'm interviewing David Lechner and Dennis Demidov about using Python with the ev 3 dev platform for programming Lego robotics.
So, David, could you please introduce yourself first?
[00:01:29] Unknown:
Sure. I'm David Lechner. I'm kind of lead maintainer of ev 3 dev. I've been doing that for the last 4 years. I'm also a freelance programmer, but I spend way too much time on e b 3 dev. And I'm also a LEGO Mindstorms community partner. That's a group of about 55 people from all over the world that work with Lego kind of indirectly through their marketing department to promote Lego Mindstorms magic as they call it. This last year, I guess, in my freelance work, I've gotten paid for doing more Mindstorms stuff than anything else. So I think I can just call myself a Lego mindstorms expert now.
[00:02:15] Unknown:
Is there a particular area that you specialize in for your freelance work?
[00:02:19] Unknown:
The biggest project I've had over the last year is working with a nonprofit company in California that has adapted the Lego Mindstorm software to the BeagleBone, and they're sending it up to the International Space Station. So they hired me to, do all the programming work of adapting the software to the new hardware.
[00:02:44] Unknown:
That sounds really interesting. Alright. Dennis, how about yourself?
[00:02:48] Unknown:
Hi. So I'm at Allego Mindstorms is just a small hobby of mine. I'm actually a researcher at Supercomputer Center of, the Russian Academy of Sciences. And, I think 2 years ago, we bought a LEGO Mindstorms set for our kids, and I had a small amount of experience with programming it through the official software, but unfortunately it didn't allow me to use Linux as an operating system so I started looking for other options and found out about the ev3df project, and then at some point I created a Python library for programming that, which was then later moved under Ralph Hempel account, who is another founder of the project I think, and so now I'm just 1 of the maintainers of the Python library that allows you to program the Lego Mindstorms.
[00:03:57] Unknown:
Yeah. I had a similar experience where I bought the Lego Mindstorms kit for my son and then found out that the only supported platforms for their, distributed programming environment with the block based syntax was Windows or Mac. And I have Windows computers, so that's what he's using currently, but that's what led me to discover the EV 3 dev project and definitely something that I'll be digging into more as I progress on, you know, the different projects that we work on with the mindstorms with him.
[00:04:26] Unknown:
And then programming by dragging blocks around with the mouse gets old very soon.
[00:04:36] Unknown:
Yeah. For me, who's used to working in a text based environment, it's definitely very it feels very slow and limiting having to, you know, drag around. And also, the fact that the laptop that I'm running it on is fairly underpowered just makes the whole thing very frustrating.
[00:04:51] Unknown:
That's the feedback we get quite often.
[00:04:54] Unknown:
Also, other other thing you do with, your mouse is, very hard to document to put into
[00:05:01] Unknown:
version control system to test. Yeah. So starting with you again, David, could you explain how you first got introduced to Python?
[00:05:10] Unknown:
Sure. It was actually through the e b 3 dev project. Being the maintainer, I have, you know, lots of mundane tasks to do. And eventually, I got to the point where shell script just wasn't cutting it anymore, and I needed something a little more powerful. So I started using Python to write scripts to automate tasks for putting together documentation or releasing software, things like that.
[00:05:35] Unknown:
And, Dennis, how about yourself? Yeah. I think it was about 15 years ago. I was working at a system integrator company at the time, and we were deploying a warehousing system for a bank. And they used Python as a scripting language, and I really hated Python at that at that time because it was very different from everything I programmed before, but yeah I just had to use it anyway and learned to love it, to love it, and today my main programming language is C plus plus but I use Python as an interface to my compute libraries. So I'm using, Jupyter Notebooks a lot, and I'm creating Python modules from c plus plus today. I really I really love Python today.
[00:06:28] Unknown:
So before we get too much further, I'm wondering if you can both give at least high level overview of what the e b 3 dev project is and some of the story about how and why it got started.
[00:06:40] Unknown:
The story of how it got started is starts with Ralph Hempel. He couldn't be here today because he actually works for Lego now. He just started there a year ago, but he's been involved in Lego Mindstorms for probably 20 years. And he's always had a big project with every version of Lego Mindstorms that, came out with the first generation. He wrote a 4th programming language library for the RCX, and then in the NXT, he wrote a 4th programming language library for it. And so if when the EV 3 came out, the EV 3 is a little different because the previous generations were just basic microcontrollers, but the EV 3 is basically a ARM computer, and it can run Linux. So the idea was that we wanted to make any programming language you want possible on the e v 3. And so Ralph started porting Debbie and Linux to the e v 3 since e v 3 has a ARM v 5 instruction set processor with no floating point unit.
So that's like a step down from a Raspberry Pi. So Debian is really the only Linux distribution that still supports a processor without a floating point unit. So it's kind of the only option, But that's kinda how it got started.
[00:08:12] Unknown:
And from what I understand, the e v 3 dev project also targets the Raspberry Pi as a possible deployment environment. And from what I've read, it requires an add on called Brickpy for being able to interface with the Mindstorm sensors and motors. So are there any particular challenges that come about from having to support both of those different platforms and the different instruction sets?
[00:08:39] Unknown:
Well, it's actually even more interesting than that. There's several third party products. There's the Brick Pi, Raspberry Pi, then there's also a PiStorms from mindsensors.com. That's also for Raspberry Pi. And a while back, there was also a Kickstarter for a it's called the Fat Cat Lab EVB. That's for beaglebone, which, unfortunately, it's not for sale anymore, but there's a few people out there that have them. So we support 4 different, platforms in total. The it definitely has been a challenge trying to get all those to work. The the biggest problem is that people just do this for fun, so they aren't buying all 4 different systems. So it's hard to find contributors to that understand how all the things work and fit together, but we've tried to make it a common software that runs on all 4 different devices so people don't have to know if you have an EV 3, it works this way. And if you have, highstorms, it works this way because they all have kind of fundamentally the same thing. They all have 4 input ports. They all have 4 output ports.
Most of them have a screen, things like that. So we can design software to that works basically the same on all of them.
[00:10:00] Unknown:
And, David, I think I saw somewhere on the on the site that you can, install the drivers on your normal PC and use them somehow with the Lego sensors and motors. Is that correct? Or do you have to hold something?
[00:10:17] Unknown:
The approach we've taken is we've made, you know, Linux hardware drivers so you can install them on any Linux computer, not just e v 3 or Raspberry Pi. Then how do you actually connect the sensors to your computer? Well, that depends on the type of sensor, but the LEGO Mindstorms EV 3 Sensors use UART. So if you get a USB to serial converter, you can connect those sensors to any computer with USB.
[00:10:47] Unknown:
So you can build yourself a little robotic legs platform for your laptop to follow you around?
[00:10:52] Unknown:
Sure.
[00:10:54] Unknown:
I'll maybe just smart home.
[00:10:57] Unknown:
So what is Lego's opinion of the b 3 dev project? Is it something that they, promote and contribute to? Or is it just something that they tolerate?
[00:11:09] Unknown:
Lego is very careful about never endorsing any third party products or even giving a official opinion on it. But back when the first generation, like, a mindstorms came out, people reverse engineered it right away, and Lego was panicking. They're like, oh my gosh. What do we do? But they made the decision of let's just let these guys go and see what happens. And, you know, people did all sorts of amazing things with it. So the next generation with the NXT and, again, 3rd generation EV 3, Lego has open sourced all their software. So, basically, they're encouraging people like us to do what we do and giving us the resources we need that we've got the schematic of what's inside of it and all the software that runs on the EV 3 brick itself is open source, so we can go through it and see how LEGO did it and copy it or improve it. Whatever.
[00:12:11] Unknown:
Yeah. I definitely think that that was a smart move on their part because from what I can tell and also from my personal perspective, having that ability to, you know, hack it and do unexpected things with the platform and the sensors is really what has caused it to be as much of a success as it is. Because whenever there's a platform that's locked down and people want to be able to extend it in their own ways and they're prevented from doing so, it generally, starts to create a certain amount of ill will towards the product. Whereas if the company either, you know, helps people, you know, add new capabilities to the system or at least, gives them the ability to do it and does it doesn't stand in their way, then it makes it much more, popular from, you know, hobbyists and people who are interested in exploring the boundaries of what's possible with the different hardware.
[00:13:04] Unknown:
Yeah. For me, that's definitely what got me interested is what can we make this do that it wasn't designed to do.
[00:13:12] Unknown:
David put link to a YouTube video of, various, projects that people did with the evil 3 diff and it's very interesting to see. Yeah. Definitely add that into the show notes. And for anybody who isn't familiar with
[00:13:25] Unknown:
the Mindstorms EV 3 platform, I'm wondering if you can give a brief overview of the hardware that it comes with and, maybe some of the 3rd party modules that people have built for it. The e v 3 is
[00:13:39] Unknown:
basically a they call it the intelligent brick because it's a Lego brick. You can hook Legos to it, and it comes with 4 sensor ports to attach different types of sensors. There's a light sensor that can also measure 6 7 different colors. There's a infrared sensor that can be used with the infrared remote control that comes with it, or it can also be used as a proximity sensor to measure distance. It comes with a touch sensor. It has 4 output ports that you can hook motors to to make your robot move, you know, hook it to wheels or levers, anything.
It also has a speaker so it can play sound, a black and white LCD displaying. It also has a USB port, which a lot of EV 3 dev users have fun trying to see what kind of devices, USB devices you can attach to it and make work. Since we're running Linux on it, anything that has a Linux USB driver, we can make it work. And it also has a SD card slot, which is
[00:14:52] Unknown:
how we install EV 3 dev on it. Yeah. The the SD card slot was, the decisive point for me because you can just put the EV 3 dev system on a SD card. Yeah. Insert the the card into the brick, and, boot it as a second operating system. You don't have to get rid of the stock system. And you can just plug the card out and then boot into the default system. So you don't have to
[00:15:19] Unknown:
There's an internal flash memory that the official LEGO firmware lives there. So e v 3 dev is kind of like dual boot where we're not riding over the flash memory. We're just booting from the SD card.
[00:15:33] Unknown:
So it's very easy both to try out the the 3 d f project and to go back to the original system.
[00:15:42] Unknown:
And from the hardware perspective, does the brick provide a certain level of abstraction sensor inputs, or is that, fully on the responsibility of e v 3 dev and the hardware drivers that you write to be able to provide a certain level of abstraction for the language binding so that you don't have to process all of the input signals and try and figure out what it's trying to tell you.
[00:16:06] Unknown:
Yeah. That's what we've done with the EV 3 dev is written drivers to add that level of abstraction because the sensor that that's work in different ways. Some sensors use UART. Some sensors use I squared c. Some are just a 0 to 5 volt analog signal. And the e v 3 actually has a clever sense system to automatically detect sensors that it can, for the most part, if you plug a sensor in, it knows which sensor you plugged in. So we've tried to keep that functionality and then, yeah, provide a abstract interface so that all the sensors look the same to the programmer, or you're just reading a value that's whatever kind of information that sensor is measuring, and you don't have to know about what type of communication or signal is being used.
[00:17:00] Unknown:
And how are the different language bindings generated? And I'm wondering how they compare to each other as far as whether any particular binding has certain capabilities that aren't present in the others?
[00:17:13] Unknown:
So the the the system, that, AVL3 dev uses is very convenient from the library developer point of view because it's just a set of files that you can, read and write to. The files are residing in, CSFS, file system. That's a virtual file system which is basically a window into, some kernel state. So you can, use any language that can read and write files. You can do it with, bash scripts, you can, currently we have I think, Python, C plus plus JavaScript, C, Java, dingjings. So basically people come and create dingjings in their favorite language. It's it's easy to do and, yeah, I think that was the great choice by Radolf and David to to come up with this system.
[00:18:08] Unknown:
And for people who want to use the Python language bindings, is there an additional step necessary beyond downloading ev3dev to be able to install the runtime for being able to execute the programs that they write on the logic brick?
[00:18:23] Unknown:
Well I think currently the, the library is included into the image by default so you just can fire off your Python interpreter on the break, and, yeah, try some programming. The biggest problem I think is the the fact that the brick comes with the ARM processor, which is very slow and makes things inconvenient to to develop and try out on the brick itself, so you most of the time you are trying to stay on your big computer, on your host computer, and then you transfer the Python scripts to the Greek and run them from there. So I think that was the 1 of the biggest hurdle for people that are not familiar with how things done on Linux and how how do you transfer files between your computers on Linux. I think the biggest amount of questions we we have all just was how to how to use the links on the brick, how to how do you transfer files to, how do you execute the files there, how, Yeah. This means
[00:19:48] Unknown:
Windows doesn't have executable bit. That's the biggest problem.
[00:19:53] Unknown:
That actually brings up an interesting question about whether there's any sort of, you know, testing harness or simulation environment to make sure that the code that you write on your host computer is valid and will produce at least reasonable outputs on the brick itself before you load it over? Or is it purely just a right load execute and then re retry kind of cycle?
[00:20:20] Unknown:
I think there were some ideas about coming up with some virtual environment, which, simulates the the brick, but, so far I don't think there is anything like that. Yeah. Not compatible with ev3dev
[00:20:36] Unknown:
anyway.
[00:20:37] Unknown:
And when I was going through the documentation, 1 of the projects that I saw actually mentioned the possibility of using something like our pie c running on the brick so that you can use your host computer as a command and control point and actually send commands interactively to the brick. Is that something that either of you have played with or have some more detail on?
[00:20:57] Unknown:
Yes. The the r rpyc project, allows you to fire a server script on your target computer then you can connect to that server from your client computer and then you basically have a Python interface to to your target computer, so you can, you could for example use an interactive Python shell like Jupyter Notebook or Spyder or, IPython, and you can interactively try commands. And the things that you are doing will be transferred, transparently 2 d brick, and run there, so I think it's 1 of the more convenient things to to try to work with the EVA3DF interactively.
Another option that people tried a lot is you can run IPython server on the ev3 and then you can connect with your just through web interface you can connect to the IPython notebook, which is running there, and actually I saw a video by Lawrence Volk where he connects to ev3dev through ipython, and that was my first introduction to evis3dev and, I switched to evis3dev immediately after I saw that video. And, but, IPython is, so the drawback of IPython is that it's pretty heavy, and it's not as responsive as with RPC, and I think the memory usage grows with time, and it becomes less and less responsive as you use it, as you use the interactive session.
So, yes, I would recommend ARPAYC as a driver for your interactive experiments.
[00:23:08] Unknown:
And what are some of the most challenging aspects of building and maintaining the, ev 3 dev distribution and the various language bindings?
[00:23:18] Unknown:
Well, for maintaining EV 3 dev itself, it's the breadth of knowledge that you have to have because, you know, it's a full Debian Linux distribution, including the kernel and everything. So I have to know everything from kernel hacking, how to write hardware drivers, to how to write user space software programs, and then how do you make a w in package for them, and then how you distribute it, and how do you maintain GitHub to get feedback from users. It's quite a wide range of of things to have to be an expert about.
[00:24:01] Unknown:
And I imagine that given the constrained optimize the CPU and memory usage of the, core distribution so that you have more space for users to actually perform the actions that they're interested in doing.
[00:24:23] Unknown:
Yeah. That's definitely been a challenge of figuring finding software that will run efficiently on the limited resources. The e v 3 is just a 300 megahertz ARM Processor with 64 megabytes of RAM. Debian actually has a 128 megabytes of RAM listed in their system requirements. So we're, like, already running on less than minimum.
[00:24:48] Unknown:
And then from the library developer perspective, it's it's I think it's less and less the case now but, the programming API of the EVSIDF used to change very fast, in the past and, we had to maintain different language bindings that we have, and, I think the system that, Kael and Landry came up with, where we just maintained a single specification in form of a JSON file, a JSON database, And then we generate each of the official libraries using liquid templates. So the source code for the libraries is just normal source code interspersed with pointers, where we just say 'here goes the definition of some device like motor or sensor' and then the templating system replaces the tags with the actual definition of the motor, and inserts all the different attributes that can change between driver versions.
So mostly maintenance between different kernel versions is equivalent to we just have to change the language building specification, the unified language building specification, and then we just have to run some scripts, and we are getting the updated language in buildings. Now I think, the API, does not change as frequently as it used to, so maybe the main challenge today is to, provide unified interface for different platforms that evcdef supports, because the ev3brick and the pystorms and the brickpy they have different variabilities in what they can do and what they cannot, and we somehow have to come up with a common interface or decide at runtime which features we are going to support and which we are not going to.
[00:27:01] Unknown:
And I imagine too that trying to come up with a, user usable user facing API for controlling the different sensors and motors is an interesting challenge as well because you want to make sure that the language is fairly intuitive as far as motor dot rotate 90 degrees or something like that, but also exposes all of the full capabilities so that people aren't limited by the API that is exposed.
[00:27:30] Unknown:
Yes, that that that is actually 1 of the more recent, discussions that we had on GitHub. I think David wants to come up with an interface that is as close as possible to the official software, so people coming from the official software are able just to replace their bricks in their graphs with simple commands in the library, but that is yet to come. For now we just have a unified interface, which is just, basically, reproduces the file system structure that we have in CSFS. But I think Python is, Python makes your life as a user of the library much easier than other bindings, I think.
The keyboard argument interface of Python functions was, I think, really helpful here. It, suits the programming interface of the u verse 3rdf really well.
[00:28:34] Unknown:
Yeah. Having the kw args, pass through for function definitions is definitely useful for being able to, expose the underlying bits and pieces while still providing a usable interface for the sort of general case of what people are going to be passing through.
[00:28:52] Unknown:
Yeah. And you can add to it without breaking it. I think that's the nice part.
[00:28:57] Unknown:
So for people who are using the brick that comes with the E B 3 Dev Kit who want to be able to pull in, additional Python modules to maybe add functionality for the software runtime or, you know, make some of their logic flow easier to manage. Is that something that they can do with eb 3 dev as far as just doing a PIP install, or are there limitations that are inherent in the platform that it's running on that would, sort of limit you to just using the Python standard library?
[00:29:29] Unknown:
Pip install is definitely possible, and there are just pre compiled libraries, like you can install Python NumPy, Python scipy, things like that. The main limitation of pip install is sometimes it tries to compile things on the fly from C plus plus and then it can take really long time on the brick, or maybe we can just exhaust the resources completely and
[00:29:59] Unknown:
the brick will reboot. But the nice thing about being Debian is that Debian has a lot of Python packages packaged up in a Debian package. So even if it is has native code, it's already been compiled on Debian build servers. So you can just apt get install Python 3 dash whatever your Python packages, and you could it's usually there already.
[00:30:32] Unknown:
Is is that true even for
[00:30:34] Unknown:
ARM system? Because Yes. Even for the ARM EL version of Debian.
[00:30:40] Unknown:
And, 1 of the things that my son was curious about when I was talking to him about, this interview was what the steps would be for integrating the, Python bindings for e b 3 dev with something like a, voice activated AI assistant such as Calliope or Mycroft so that you could build a voice controlled robot?
[00:31:02] Unknown:
Well, I haven't heard of anybody trying those specific programs yet, but I had a quick look at their documentation, and it looks like both of them are capable of running any shell command. So you can write a Python script and run it from a shell. So you should be able to quite easily integrate e p 3 dev with either of those, but you would have to write your own
[00:31:28] Unknown:
Python program to do whatever it is you're trying to do. Yeah. And I imagine too that those, run times would be limited to the Raspberry Pi or BeagleBone interfaces with the, interface boards for actually controlling the motors and sensors because I don't imagine that you would well, 1, the processing capabilities, but also the limitations of IO as far as the microphone input, would sort of prevent you from wanting to do that on the actual, stock LEGO brick.
[00:31:58] Unknown:
Right. Yeah. You wouldn't be running the the speech recognition or anything on your e p 3 itself.
[00:32:04] Unknown:
Here again, maybe RPC makes your life a bit easier because you can run, heavily, the problems that, programs that use heavy computations on your host computer and then, just control your evis3 break from from there through ARPIC.
[00:32:22] Unknown:
Yeah. That'd be another interesting approach that you can just have have have your, tell your Alexa to command your robot to come to a particular room or whatever it is that you want it to do. So, yeah, bring me a drink. Yeah. So on that note, what are some of the most interesting or innovative projects that you've seen people make with the Mindstorms platform and the e v 3 dev distribution and language bindings?
[00:32:47] Unknown:
For me, the the ones that really catch my eye are the Delta robots. I'm not really sure what it is about them. I think it's maybe because they can move in 3 d space, you know, freely in any direction. Most of the time, if you have a robot arm, it looks stiff because it's just moving along a single axis of rotation at a time. But when you have a delta robot, it has 3 arms controlling 1 manipulator or whatever, and they're just fun to watch. 1 of the very first things somebody built with EV 3 dev was a robot that catches a ball that he threw to it. It was pretty impressive.
[00:33:29] Unknown:
And, Dennis, are there any particular, projects that you've seen you'd like to call out? Yeah. I think,
[00:33:35] Unknown:
David, you talked about about it. What do they want to send, Lego brick for into space? Are they going to use m 3 d for
[00:33:46] Unknown:
Oh, yes. So, yeah, this project is called quest for space. The the basic premise of it is that, you know, schools already have Lego Mindstorms EV 3 kits and software, know how to use them. So this is kinda aimed at middle school age, 7th, 8th grade. And the idea is that kids in a classroom can design an experiment using their LEGO Mindstorms software. And we've taken all of that and made it run on the beagle bone. So, basically, what reason for doing that is sending stuff into space. It is very expensive, so we made it as small as possible. We took out the things you don't need. You don't need a speaker. You don't need the display screen, all that kind of stuff. So we've just taken it down to the bare minimum motors and sensors and the beagle bonus, the main processor. And, so they'll be able to take their program and upload it to the space station and run the same program that ran on their Lego MIND storms up on the space station on the BeagleBone platform to perform some kind of experiment in microgravity.
1 of the experiments they have going on right now is looking at convection currents in space because, you know, here on Earth, we say that heat rises. That's because cold air is more dense than hot air, and gravity pulls the cold air down so the hot air goes up. But when you don't have gravity, what happens?
[00:35:26] Unknown:
Yeah. That does sound really cool. Alright. So for somebody who's curious about robotics, why would they want to use the Mindstorms platform with or without e v 3 dev as opposed to any of the other robotics platforms that are available for consumers?
[00:35:41] Unknown:
Well, for me, the best part is that it's Lego. You can take all these LEGO parts. LEGO Technic sets have pneumatics. They have gears. They have all sorts of things. You can build almost anything out of it. You don't need a 3 d printer. You don't need a machine shop, and you can build incredible things. And then when you get tired of it, you can take it apart,
[00:36:05] Unknown:
and you can build something else new. You can actually build it, a 3 d printer from LEGO. It will I saw projects that, just use small Lego blocks as a printing medium, so they do not print, they just, assemble something from small LEGO blocks, but it works almost as a normal 3 d printer.
[00:36:31] Unknown:
And for somebody who's interested in learning more about more intermediate and advanced robotics, what are some of the resources that you'd recommend?
[00:36:40] Unknown:
That's a good question.
[00:36:42] Unknown:
I I could just strike that if you don't have an answer. That's fine too. I'm kind of a person that likes to figure it out for myself
[00:36:49] Unknown:
and, you know, I I learned through doing. But,
[00:36:53] Unknown:
for me, creating the library was much more interesting than, actually building the robots.
[00:37:00] Unknown:
But the the Layhost blog, that Layhost is another third party operating system for EV 3 and, like, a Mindstorms that's based on Java. They have a blog, and they've gotten into some of the more advanced topics you might call it, like computer vision and control algorithms. They have some some interesting articles there kind of on the the general principles of of those.
[00:37:27] Unknown:
So are there any other topics that we should bring up before we start to close out the show?
[00:37:32] Unknown:
Yeah. 1 of the things I'd like to talk about is micro Python. That's basically a version of Python 3 that is designed to run on microcontrollers. I discovered it recently because I was working on a new camera sensor for my sensors.com. They developed a new it's basically a little camera that can do fun things like track objects and follow lines and facial recognition, but the firmware for this little camera is based on MicroPython, which apparently was a Kickstarter thing that started a couple years ago. And so the software on this camera is written in Python, which is pretty impressive for, you know, not being a full blown computer. And since we've talked about, you know, the limited resources on the e v 3 brick, it's not nearly as powerful as a Raspberry Pi.
We've gotten micro Python running on the e b 3 now. So it currently takes about 8 seconds to start up a a Python program, in for EV 3 dev because it takes about 2 seconds to just get the Python 3 runtime up and running, and then it takes quite a bit of time to import the various modules. And so, you know, it's kind of a drag for when you're during your development cycle when you make a change and then you send it to the brick and then you have to wait 8 seconds for your program to start. You know what? Doing it once is not so bad, but when you're doing it over and over and over again, you get tired of it. So we're playing around with micro Python to see to, you know, improve the speed. But since it's not full Python 3, it you can't just import at any Python module, so it's a little limited.
And there's a few caveats, but more or less, it's basically Python 3, which is really cool.
[00:39:35] Unknown:
Yeah. Just today, Kaelin did some tests, and, running a simple hello world hello every 3 d f world, script on Python takes, 10 seconds on Python 3 and, I think 4 seconds on the MicroPython, So it looks very promising.
[00:39:53] Unknown:
Yeah. It's definitely an interesting distribution and and some interesting work that he did on it, and I actually interviewed him a while back. And at the time, he was working with the, EU Space Agency to see about, using it for soft real time systems in some of the experiments that they were getting ready to launch.
[00:40:12] Unknown:
Everybody wants to send their stuff to space.
[00:40:16] Unknown:
So for anybody who wants to get in touch with either of you and follow the work that's being done with e b 3 dev, I'll have you add your preferred contact information to the show notes. And with that, I'll bring us to the picks. And my pick this week is going to be the Raspberry Pi. It's something that has come up a lot of times on various episodes of the show, but it's a pretty great little computing platform for being able to do experiments and have throwaway environment that you can, you know, just load some Linux on, play with it for a while and if you break everything, well then you just wipe the card and try over. Most recently, I've been getting the Calliope project set up on it to experiment with some voice control and, introduce my son to doing some programming by adding some tasks to that. So I'll add that as my other pick. And with that, I'll pass it to you. Do you have any picks for us this week, Dennis? Yeah. For me, that would
[00:41:08] Unknown:
be PYBINT 11. That is a library that allows you to create, Python modules from c plus plus, and I'm using it a lot these days. You can just write some heavy duty computation that are running on, your CPU or even on your GPUs, and then import the library into Python with help of pybind11 and immediately gets the, the speed up from your computational resources, from inside Python. And it's very nice to it's nicely, coupled with the c plus plus, so very convenient.
[00:41:46] Unknown:
Alright. And David, do you have any picks? Yeah. My pick is local food. That's kind of my hobby besides robots is eating good food. My wife and I are part of the Oklahoma Food Cooperative, which is a organization that connects farmers and ranchers with consumers. So they have a monthly shopping system where farmers put on what they have this month, and you can order it, and it gets delivered to your local city. And we also this last week was our anniversary, and we went to a a restaurant in Luther, Oklahoma. It's on Route 66 about 30 minutes outside of Oklahoma City.
It's called, 615 Farmstead Market and Table. It was really great food. And I I think it's fun that, you know, when you get to know the people that are producing food around you, You know, we went to this restaurant, and they're getting their food from the same people that we already know from the farmer's market and other places where we get our food.
[00:42:51] Unknown:
Alright. Well, I appreciate the both of you taking time out of your days to tell us all about the work that you're doing with eb 3 dev and the Python bindings and playing around with the Lego robotics platforms. It's definitely something that, I've been finding personally interesting and something that I plan on exploring more as I, work with my son on learning how to build new robots. So I appreciate your time, and I look forward to seeing some of the work that you produce in the future.
[00:43:19] Unknown:
You're very welcome, and we hope to hear back from you on GitHub if you have any problems, have any suggestions on how we can improve things.
[00:43:28] Unknown:
Alright. Thank you and I hope you both enjoy the rest of your days.
[00:43:31] Unknown:
Alright. Thanks. Bye.
Introduction and Sponsor Messages
Interview with David Lechner and Dennis Demidov
Introduction to Python and EV3Dev
EV3Dev Project Overview and Challenges
Language Bindings and Development Workflow
Using Python with EV3Dev
Voice-Controlled Robotics and AI Integration
Interesting Projects and Applications
Advantages of Mindstorms Platform
MicroPython and Performance Improvements
Closing Remarks and Picks