newport-conex-agp#
This container provides a REST API to control Newport CONEX-AGP linear stages.
Configure#
config.yaml#
A sample config file is provided below:
device: /dev/newport-stage
address: 1
label: stage # human readable label
auto_home: false # home the stage on startup?
travel: [0.0, 27.0] # travel limits
units: mm # display metadata
poll_interval: 0.25 # seconds between status polls while ?wait is blocking
default_timeout: 30 # max seconds a ?wait blocks (and homing budget)
A software emulator is also provided. To use the emulator, use emulator://
as the device. Additional emulation parameters are also available:
device: emulator://
speed: 5.0 # emulated units/second
home_position: 0.0 # emulated HOME position
home_time: 1.5 # emulated homing duration
udev rules#
A udev rules file should be created for each device to ensure it is always
mounted at a known and repeatable path. The sample rule provided below will
mount the stage with serial XXXXXXXX at /dev/newport-stage:
# /etc/udev/rules.d/99-newport-stage.rules
SUBSYSTEM=="tty", \
ATTRS{idVendor}=="104d", \
ATTRS{idProduct}=="3006", \
ATTRS{serial}=="XXXXXXXX", \
MODE:="0666", \
SYMLINK+="newport-stage"
Run#
The container expects both a config file and host device to run:
podman run --name newport-stage \
-v /path/to/config.yaml:/app/config.yaml \
--device /dev/newport-stage:/dev/newport-stage \
localhost/newport_conex_agp:latest
The following environment variables can be used to configure the container at runtime:
- HOST#
REST API endpoint IP address. Default is
0.0.0.0
- PORT#
REST API endpoint port. Default is
8000
- API_KEY#
Optional API key for simple auth. Auth is disabled if
API_KEYis unset (default)
- LOG_LEVEL#
Logging level. Default is
info
API#
- GET /#
Summary
- Status Codes:
200 OK – Successful Response
422 Unprocessable Entity – Validation Error
- Request Headers:
x-api-key
- GET /health#
Health
- Status Codes:
200 OK – Successful Response
422 Unprocessable Entity – Validation Error
- Request Headers:
x-api-key
- GET /state#
Get State
- Status Codes:
200 OK – Successful Response
422 Unprocessable Entity – Validation Error
- Request Headers:
x-api-key
- GET /position#
Get Position
- Status Codes:
200 OK – Successful Response
422 Unprocessable Entity – Validation Error
- Request Headers:
x-api-key
- GET /target#
Get Target
- Status Codes:
200 OK – Successful Response
422 Unprocessable Entity – Validation Error
- Request Headers:
x-api-key
- GET /limits#
Get Limits
- Status Codes:
200 OK – Successful Response
422 Unprocessable Entity – Validation Error
- Request Headers:
x-api-key
- GET /info#
Get Info
- Status Codes:
200 OK – Successful Response
422 Unprocessable Entity – Validation Error
- Request Headers:
x-api-key
- POST /home#
Home
- Query Parameters:
wait ({'null', 'number'})
- Status Codes:
202 Accepted – Successful Response
422 Unprocessable Entity – Validation Error
- Request Headers:
x-api-key
- POST /move_abs#
Move Abs
- Query Parameters:
wait ({'null', 'number'})
- Status Codes:
202 Accepted – Successful Response
422 Unprocessable Entity – Validation Error
- Request Headers:
x-api-key
- POST /move_rel#
Move Rel
- Query Parameters:
wait ({'null', 'number'})
- Status Codes:
202 Accepted – Successful Response
422 Unprocessable Entity – Validation Error
- Request Headers:
x-api-key
- POST /stop#
Stop
- Status Codes:
202 Accepted – Successful Response
422 Unprocessable Entity – Validation Error
- Request Headers:
x-api-key
- POST /reset#
Reset
- Status Codes:
202 Accepted – Successful Response
422 Unprocessable Entity – Validation Error
- Request Headers:
x-api-key
- POST /disable#
Disable
- Status Codes:
202 Accepted – Successful Response
422 Unprocessable Entity – Validation Error
- Request Headers:
x-api-key
- POST /enable#
Enable
- Status Codes:
202 Accepted – Successful Response
422 Unprocessable Entity – Validation Error
- Request Headers:
x-api-key