This repository contains the official implementation for the paper "Condition-Number Adaptive-Weight PINN (A-PINN): A High-Fidelity and Real-Time Forward Kinematics Solver for Stewart Platforms".
Parallel kinematic mechanisms (PKMs) require accurate, low-latency, and deterministic estimation of the end-effector pose for high-bandwidth closed-loop control. However, solving forward kinematics (FK) is challenging because the strongly coupled nonlinear closed loop renders the closed-form solutions non-unique, and iterative numerical solvers are prone to ill-conditioning near singular configurations.
This project provides a
- Implicit Sobolev Regularization: The framework proposes an operator-consistency loss to ensure high-fidelity Jacobian learning without the need for unstable matrix inversion. The training objective enforces an implicit Sobolev-type regularization via operator consistency.
-
$\kappa$ -Adaptive Weighting: The physical loss is dynamically modulated by a weighting mechanism driven by the Local Conditioning Index (LCI) or$1/\kappa$ . This condition-number-aware strategy robustly constrains ill-conditioned regions and prevents boundary underfitting. - Real-Time Validation: The proposed A-PINN is validated on a physical 6-UPS platform with a 1 kHz sampling rate. It achieves 1 kHz closed-loop control with an inference latency of 0.141 ms and a relative Jacobian error of 0.40%.
Based on the project files, the repository is organized as follows:
Data_Generation/: Contains scripts for generating high-fidelity datasets.Data_Generator_Normalized_Haar_Sobol_Rejection_Sampling.py: Script used to create a spatially uniform training dataset via Inverse Transform Sampling.
Train_model/: Contains the core training implementation.L2ori_wJ_aPINN.py: The main Python script for training the A-PINN framework.result/: Stores outputs from the training process.L2ori_wJ_adaptive_PINN.pt: The trained PyTorch model weights.result_info.txt: Text file logging the training results and information.
.gitignore: Specifies intentionally untracked files to ignore.README.md: This documentation file.
Ensure you have Python installed along with the necessary deep learning and scientific computing libraries (e.g., PyTorch, NumPy) to run the neural network models and dataset generators.
To train the A-PINN model, you first need to generate the high-fidelity training dataset, which utilizes an Inverse Transform Sampling strategy to correct density distribution biases. Navigate to the data generation directory and run the script:
cd Data_Generation
# Run the dataset generation script (replace with the full filename)
python Data_Generator_Normalized_Haar_Sobol_Rejection_Sampling.py Once the dataset is prepared, you can train the A-PINN framework. The training script automatically applies the condition-number-adaptive weights and implicit Sobolev regularization to ensure physical consistency.
L2ori_wJ_aPINN.py and modify the dataset path (at the end of the script) variable to match the actual location of the dataset you just generated on your local machine.
cd ../Train_model
python L2ori_wJ_aPINN.pyUpon successful training, the PyTorch model weights will be saved as L2ori_wJ_adaptive_PINN.pt inside the Train_model/result/ directory. The training logs will be saved in result_info.txt.
7a42b55213ae9d4dd13d113a8bcd3fdc.mp4
If you use this code or our methodology in your research, please consider citing the associated paper:
@ARTICLE{11515083,
author={Tian, Xinyu and Xiao, Junlin and Xu, Hang and Hou, Xing and Jia, Fuhua and Yang, Xiaoying and Ijaz, Salman and Rushworth, Adam and Sun, Donglei},
journal={IEEE Robotics and Automation Letters},
title={Condition-Number Adaptive-Weight PINN (A-PINN): A High-Fidelity and Real-Time Forward Kinematics Solver for Stewart Platforms},
year={2026},
volume={},
number={},
pages={1-8},
doi={10.1109/LRA.2026.3692332}}