Wednesday, November 18, 2009

Python-based GUI for motors and actuators

I am fairly new to Python, but heard so many people in astronomy telling how great it is that I had to try it out. This is my first shot at a Python-based GUI, using the TkInter package that appears to be delivered with most Python distributions.

The IR coronagraph on SCExAO consists of several devices whose purpose is described on the project webpage: SRP, PIAA, binary mask, focal plane mask, inverse PIAA and of course, a camera. Each device is mounted on a motorized translation stage that can move the device in and out of the beam, depending on what's on the SCExAO user's mind. We use electronic drivers for stepper motors made and sold by AllMotion, connected to a DIGI serial port server.

It is amazing that in less than 300 lines of well "aerated" code, I managed to cram the definition of an interface, its callbacks, the reading of a configuration file as well as the socket connection to talk to the motors through the local network. The source code is posted here...

This is however just a prelude: SCExAO not only uses stepper motors but also linear actuators which also need to be integrated to this GUI. Design for this Python interface v 2.0 is ongoing.

No comments:

Post a Comment