Control framework for an optical spectroscopy bench.
- Motion server (FastAPI, PS90-based):
servers/motion_server.py - Spectrometer server (FastAPI, simulated):
servers/spectro_server.py - FESTO pneumatic server (FastAPI, NI-DAQmx-based):
servers/festo_server.py - Python clients:
clients/ - Interactive shell:
IRLab_shell.py
Install dependencies:
pip install -r requirements.txtRun servers:
uvicorn servers.motion_server:app --host 0.0.0.0 --port 8001
uvicorn servers.spectro_server:app --host 0.0.0.0 --port 8002
uvicorn servers.festo_server:app --host 0.0.0.0 --port 8003Start interactive shell:
python IRLab_shell.pyconfig/servers.yaml: default server URLsconfig/motors.yaml: controllers, motors, and optional motion parametersconfig/festo.yaml: NI-DAQ chassis and FESTO actuator channel mapping- Environment overrides:
MOTION_SERVERSPECTRO_SERVERFESTO_SERVERFESTO_CHASSIS(default:cDAQ1)
GET /ps90/connectGET /ps90/closeGET /ps90/load_configGET /motors/listGET /motors/init/{motor}GET /motors/read/{motor}GET /motors/move_abs/{motor}/{position}GET /motors/move_rel/{motor}/{delta}GET /motors/free/{motor}GET /motors/control/{motor}
GET /acquire?exposure=0.1GET /status
GET /festo/connectGET /festo/closeGET /festo/load_configGET /festo/controllers/listGET /festo/actuators/listGET /festo/actuators/registerGET /festo/actuators/on/{actuator}GET /festo/actuators/off/{actuator}GET /festo/actuators/toggle/{actuator}GET /festo/actuators/state/{actuator}
In IRLab_shell.py, these are available directly:
mv(...)move one or more motorsmvr(...)move one or more motors relativelywm(...)read motor positionsfree(...)release one or more motorscontrol(...)re-acquire control of one or more motorsfree_all_motors()release all registered motorsascan(motor, start, stop, npts)linear scandscan(motor, start_delta, stop_delta, npts)relative linear scantweak(m1[, m2[, m3]])interactive keyboard jog modespec.acquire(...)acquire spectrumon(a1, a2, ...)activate one or more FESTO actuatorsoff(a1, a2, ...)deactivate one or more FESTO actuatorstoggle(a1, a2, ...)toggle one or more FESTO actuatorsstate(a1, a2, ...)read on/off state from server