07-19, 14:35–15:05 (Europe/Prague), South Hall 2B
Interactive control of robots can be a challenge, as it requires a lot of things to happen in parallel while at the same time reacting to data from sensors and control signals. Using python's async facilities may greatly simplify this task, allowing us to write code that is similar to the non-parallel version, but that is at the same time easy to compose into bigger program doing many things at once. I will talk about my own experiences programming the Fluffbug robot with CircuitPython, point out the problems and the solutions I found.
Fluffbug is a small, affordable walking robot programmed with CircuitPython. The way it moves and reacts to sensors and control signals requires code that seemingly does a lot of things all at once, but we don't have direct access to mechanisms like threads or interrupts. What we use instead is Python's async syntax and the minimal version of asyncio library available in CircuitPython. This makes an interesting use case for asynchronous programming that is different from the usual web servers and API frontends. The resulting code is much shorter and easier to maintain than similar code written in a traditional, linear way.
A Python programmer by day, by night turns into a supervillain
constructing insectoid robots, handheld game consoles, custom keyboards
and other projects. He sometimes haunts the Swiss Mechatronic
Art Society and tries to convert everyone to using CircuitPython.