120 likes | 167 Views
Develop a Java GUI to control motors at F1 integrating SPEC socket programming for Grazing-Incidence X-ray Scattering. Control motors, camera, and light settings with easy plug-in configurations. Implement SPEC packet format for error-free communication.
E N D
SPEC Socket Programming Logan Daum Mentor: David Schuller CLASSE Physics REU August 13, 2010
Goal • Develop a GUI for controlling motors at D1 • Combine the current SPEC command prompt with the video feed • Utilize SPEC sockets for communication
D1 • Used for GISAXS (Grazing-Incidence Small-Angle X-ray Scattering) • Samples typically organic materials Microscope X-Ray Source CCD Detector Sample Stage
MacCHESS Crystal Centering • Controls the microscope video feed and motors at F1 • Used at D1 for the video feed only • Written in Java, based on a client-server model • Server – Interfaces with motors and the video • Client – GUI instances • Each control group in the GUI is installed as a plug-in • Motor controls communicates directly with motors at F1 • At D1, SPEC is used to interface with motors
Features • Buttons and dials to move motors • Click to move • Camera and light controls • Snapshots • Autocentering • Session parameters saved
SPEC Server • Data acquisition and XRD software package by Certified Scientific Software • Command line interface • C-like syntax • Macro support • Server mode • Interact with other software over a network through sockets • TCP sockets – ordered error-free data transfer • Packets follow a specific format defined by SPEC
SPEC Server Communication • SPEC packet format • Header – holds packet parameters and defines the data type • Data – holds the command or values for SPEC • Socket communication was tested in C++, Python, and Java • C++ • Struct class and native data types useful for writing the packet • Python • Easy access to C structs and types • Socket connections simple • Java • Data types different (chars = 2 bytes, no long int) and no struct class • Socket connections simple
Integrating SPEC with Crystal Centering • Existing motor plug-in replaced with SPEC plug-in Dial Moved GUI Clients Dial Updated Create SPEC Packet Server Plug-in Parses SPEC Packet SPEC Motor Moved Motor Moved
New GUI Features • Select motors for each axis • Poll SPEC for motor names • Set motor name and scaling factor • Preset zoom and focus settings • Both settings are usually coupled • 3 possible preset values
Future Work • Shutter Control Button • Toggle button to open and close the shutter • Track shutter state • Automatically controlled at D1 • Camera Button • Sync CCD detector images with microscope video snapshots • Save to the same filename prefix
Acknowledgements • Mentor: David Schuller • DetlefSmigies, Darren Dale • Phil Sorenson • CLASSE REU program • NSF Grant