PyQt6 desktop application for operating a biaxial testing machine, running displacement- and load-controlled tests, viewing live camera data, and exporting measured results.
This project provides the GUI and control logic for a biaxial mechanical testing setup. The application combines:
- machine configuration loading and saving
- motor and DAQ coordination
- displacement-control and load-control test workflows
- live charting with
pyqtgraph - camera acquisition through Allied Vision Vimba X / VmbPy
- result export to Excel workbooks
The codebase is hardware-oriented and depends on vendor SDKs in addition to standard Python packages.
main.py- compatibility launcher for a source checkoutbiaxial_testing_machine/- installed application packagebiaxial_testing_machine/resources/- bundled Qt forms and default configurationtests/- hardware-free checksdocs/- architecture notespyproject.toml- setuptools build configuration, dependencies, and launcher
pyserialPyQt6pyqtgraphnumpyopencv-pythonopenpyxl
- Zaber Motion SDK:
zaber-motion - DSCUSB USB/virtual COM drivers
- Allied Vision Vimba X SDK and its matching VmbPy Python package (optional unless using a camera)
Install the motor and force-sensor dependencies on the lab workstation. Camera support is optional: a missing Vimba X installation produces a camera-specific error when acquisition is requested.
Clone the repository:
git clone https://github.com/vikba/Biaxial_Testing_Machine.git
cd Biaxial_Testing_MachineCreate and activate a virtual environment, then install the application with all UI dependencies:
python -m venv .venv
.venv\Scripts\activate
python -m pip install .For editable development, use python -m pip install -e .. Dependencies are
declared in pyproject.toml; requirements.txt delegates to the same project.
Install the remaining vendor-specific packages and SDKs separately:
- Allied Vision Vimba X runtime, GigE transport layer/driver, and matching VmbPy wheel
Start the installed GUI from any directory:
biaxial-testing-machineAlternatively, use python -m biaxial_testing_machine. Running python main.py
remains supported from a source checkout. Python 3.10 or newer is required.
Machine configuration lives in resources/ in the source folder (beside main.py):
config.local.json: active workstation settings; edit this file. It is excluded from Git and distribution packages.config.example.json: tracked defaults and a template for new workstations.
Writable settings are loaded from resources/config.local.json.
The path is resolved from the application source, independently of the current
working directory. No AppData or user configuration folder is used.
When no settings file exists, resources/config.example.json is loaded. Saving
settings creates resources/config.local.json without changing the example.
Set the motor IP, sensor serials, camera ID,
and output folder for your workstation. Flat legacy configuration files remain
readable. Experimental output stays in the selected output folder.
Each experiment's config_test.json records the settings used for that test;
it is a snapshot and is never loaded as the workstation configuration.
An existing resources/config.local.json is loaded automatically. To explicitly
select a different file before launching:
$env:BIAXIAL_CONFIG = "C:\path\to\resources\config.local.json"
biaxial-testing-machineThe local file is preserved; it is never included in the installed package.
The BIAXIAL_CONFIG override can also select a shared lab configuration.
Open Settings → Machine configuration… to edit motor IP, camera ID, and force-sensor serial numbers. Auto-select single camera requires exactly one discovered camera. Show advanced force settings exposes transmission factors and timing values in seconds. Factors scale measured forces without changing sensor calibration; maximum data age must exceed twice the serial timeout.
Stop tests and autoload first, then use Settings → Disconnect devices and wait for shutdown to finish before editing. Save validates and atomically updates the displayed config file, preserving experiment controls. Cancel changes nothing. Reconnect with Connect or Camera to use the saved settings without restarting. The example template and previous test snapshots stay unchanged.
python -m pip install build
python -m buildThis creates a wheel and source distribution in dist/. Both include the Qt
forms, example configuration, and license. CI installs the built wheel and checks
both launchers from outside the checkout on Windows and Linux.
The build copies the single source template from resources/config.example.json
into the package so installed applications retain fallback defaults.
This application targets Vimba X (vmbpy); the old Vimba/FireWire Python API is
no longer used. Follow Allied Vision's Python installation instructions
to install the VmbPy wheel matching your SDK into the same virtual environment
as the application. Updating the SDK does not update that Python package automatically.
First confirm continuous acquisition in Vimba X Viewer. Configure the GigE camera and its Ethernet adapter on compatible subnets, and check the GigE filter driver and packet size in Viewer. The application does not modify network settings. See the Viewer guide.
Set runtime.camera_id in your selected config.local.json to the ID
shown in Viewer, for example "DEV_000A47000000". An empty ID automatically
selects the only discovered camera. With multiple cameras, acquisition reports
their IDs and requires explicit configuration. Reconnection retains the selected
identity and never silently switches to another camera.
Images are processed in native camera pixels and displayed with preserved aspect
ratio. Click Initialize Markers, then select four distinct markers in the image;
clicks in the surrounding margins are ignored. Initialize markers for each new
test. Pixel thresholds, marker area limits, and maximum tracking movement are
measured in native pixels and may need adjustment for a different resolution or lens.
ROI can be configured programmatically through VideoThread.update_roi() with
native-pixel coordinates. The camera window currently has no ROI selection control.
The app prefers Mono8; other formats are converted to Mono8, or through Bgr8
to grayscale if supported by the SDK. Gain and exposure controls use camera-reported
ranges and increments, with SDK writes performed only in the acquisition thread.
Exposure is capped at 400,000 microseconds to leave margin within the 500 ms frame
acquisition timeout. Preview acquisition is limited to approximately 10 frames/s
before image-processing time; this is not synchronized to force acquisition.
Stopping returns immediately while the worker releases its camera context. The window remains alive until that worker exits. A vendor operation that stalls outside frame acquisition can still delay final shutdown. Camera errors invalidate marker references; an active test using camera strain is failed through the existing motor-stop path. Preview can reconnect, but markers must be initialized again. Tests that do not use camera strain are not canceled by camera faults.
Hardware-free checks use simulated VmbPy objects with real Qt/OpenCV. No physical camera, SDK runtime version, or camera model has been validated in this environment. Before lab use, verify these on the target workstation:
- Record camera model, firmware, Vimba X, VmbPy, and Python versions.
- Check live preview, gain/exposure, image saving, and marker selection. If using a programmatic ROI, check its bounds against the native image.
- Verify a known displacement and compare image-based strain with expectations.
- Repeat camera start/stop and disconnect/reconnect the Ethernet cable.
- During a low-load camera-based test, remove the cable and confirm test failure and both motor-stop attempts; reinitialize markers after reconnection.
Set hardware identity and acquisition settings in the local JSON force section:
axis1_serial:"0017835720"axis2_serial:"0017835697"(change this to assign the second axis)axis1_transmission_factor,axis2_transmission_factor: default0.5, preserving the previous force/2correction. Confirm these against the pulley geometry.timeout: serial read/write timeout in seconds, default0.075.max_data_age: maximum valid sample age in seconds, default0.25.
Ports are discovered by querying device serials (65536 * SERH + SERL), never by
COM number. Close DSC Toolkit before connecting. Both devices use 115200 baud,
8N1 and !001:SYS?\r. SYS is already calibrated in grams; Zero only stores a
software offset. Reported grams are (SYS - zero) * transmission_factor;
Newtons are grams times 9.80665 / 1000. No calibration commands are sent.
The obsolete ip_daq argument/key is accepted for compatibility and ignored.
Acquisition runs separately from motor commands. Force getters read cached
samples; unavailable/stale samples raise ForceDataError. During load or displacement control
or autoload a 20 ms watchdog stops both motors when either channel exceeds the
age limit. A force fault cancels the session and blocks further motion until
hardware is disconnected and reconnected. Actual stop latency also includes
motor communication and deceleration; verify it on the machine.
Smoke test (start with motors stationary and a low test load):
- Install
pyserialand DSCUSB drivers, connect both devices, and confirm live readings. - Apply a known weight to each axis separately. Verify identity, sign, and the transmission factors. Reconnect using different USB ports and repeat.
- Press Zero, add/remove a known weight, and switch grams/Newtons. Confirm the expected factor and that DSC Toolkit still shows unchanged internal calibration.
- Run a low-load test, then disconnect either DSCUSB. Confirm both motors stop, the test ends with an error, and motion stays blocked until reconnect. Repeat for the other sensor and manual autoload; measure the stop latency.
- Stop/disconnect normally and confirm the ports can reopen without restarting.
Run hardware-free checks with python -m unittest discover -s tests.
CI runs these checks on Windows and Linux with Qt in offscreen mode.
Protocol checks mock Qt and vendor dependencies. Lifecycle checks use real Qt
threads with simulated hardware to verify responsive commands, cancellation,
timeouts, and failure cleanup. Install the Python dependencies above to run those
checks; they are skipped if those dependencies are unavailable. These checks do
not replace hardware verification.
Protocol reference: Mantracourt DSCUSB Advanced Manual.
- This project is intended for a configured lab workstation, not a generic desktop environment.
- Camera and motion-control features will not work unless the corresponding hardware SDKs are installed and connected.
- Test results are exported through
openpyxl. - Application diagnostics are logged to the console at INFO level. Set the logging
level in
biaxial_testing_machine/__main__.pyto DEBUG when detailed position and motion diagnostics are needed.
This project is licensed under the GNU General Public License v3.0. See LICENSE for the full license text.
Third-party SDKs and hardware libraries may have their own separate license terms. You are responsible for complying with those terms when deploying or distributing systems built on this project.