Hacker News new | past | comments | ask | show | jobs | submit login

I'm in the middle of doing an embedded control system project and I'm using Python 3.4 to do it. The embedded computer runs Debian Linux on an ARM processor. The Python program interfaces with the following: J1939 (CAN bus) network, dual RS232 serial ports, HTTP over TCP on wireless ethernet (for remote operator's panel). The HTTP server is Tornado. Most of the remote interface is done using Javascript.

I'm using Python 3 because I'm using the new asyncio library designed by Guido. So far, it is working out really well. There was some learning curve to get started but now it is very easy to add new modules to the system. I designed a very lightweight version of an internal message bus, similar to NASA's GMSEC. This allows separate modules to communicate without tight coupling between them.

The asyncio library doesn't have high-level support for socketcan so I had to use some lower level facilities. That took a little research and some digging through the asyncio source. The asynchronous design provides great responsiveness without heavy resource use (CPU or memory). I've done other similar systems using threads or polling but this Python 3 version is more elegant by far.

It would have been nicer if the migration path from Python 2 to 3 was smoother. However, after using it for serious work, Python 3 works great. I still wish 'print' was a keyword or there was some other debugging version of print (e.g. "dump var1, var1"). That's not a showstopper though.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: