Questions / thoughts on for machine control


Hi all,

I’ve been tasked with modularizing / improving a system for controlling a mineral analysis machine that is in early stages of development. At the moment I’m researching communication / concurrency frameworks that might be helpful to this task.

The machine to be controlled contains a set of devices (motors, spectrometers, transmission detectors, lamps, buttons) and some custom electronics. The devices are controlled in a variety of ways (RS232, RS422, RS485, Modbus/TCP, UDP over Ethernet, …).

Currently the system consists of a bunch of straight Python scripts which the developers/scientists here run locally on the Linux box sitting in the machine. The system quite monolithic. Communication with the devices occurs sequentially and blocking.

The goals for the new system is a more modular approach, and one which allows remote control of the machine. It needs to support control of individual devices, but also requests for a “scan” (a predetermined series of mostly sequential requests to the machine’s devices, followed by a couple of CPU bound post-processing / analysis steps on the sensor data). During a scan or device request, any “write type” requests to the machine must be blocked, to avoid conflicts with the ongoing scan / request.

My idea for the new system is a component (Actor-like) design, with roughly one component per device in the machine, and where components communicate using message passing. This is how I came across There would also be one or more components servicing requests for scans by carrying out the required requests to the other components and running the post-processing / analysis.

Communication with one of the devices relies on a manufacturer supplied blob (booo). This is currently done with a native Python extension calling into this blob. We are planning on replacing that device, but I cannot guarantee that we won’t have devices that have this requirement in the final product, so it needs to be possible to handle devices that are “quirky” like this.

The language for the new system should be Python (as much as possible), since that’s what the devs / scientists building the machine are most comfortable with.

Finally, to my questions:

  1. Has anyone built slightly larger machine control applications like this with I found a small example of controlling an Arduino on GitHub [1]. But I’d be very interested in if people have built bigger things, controlling a variety of devices?

  2. If so, what were your experiences?

  3. Currently we have a bunch of (Python) drivers for the devices that do blocking I/O. I assume I’d have to rewrite / restructure all those to integrate with whatever I/O loop Python|Autobahn / uses?

I’m idle ears to hear if you think Crossbar would be a good fit for this project, and if there’s anything else I need to know. I’ve researched quite a few frameworks this past week, and my worries regarding Crossbar is mostly that a) It’s quite new, and b) The documentation is OK, but there’s not so much of it :slight_smile: Hearing about someone using it for a large project would go a long way to soothe my worries.

Best regards,

Elvis Stansvik