ImuInverseKinematicXMLProcedure#
- class pyCGM2.IMU.opensense.interface.procedures.opensenseImuKinematicFitterProcedure.ImuInverseKinematicXMLProcedure(DATA_PATH: str, calibratedOsimName: str, resultsDirectory: str)#
Procedure to run OpenSense Inverse Kinematics using IMU data.
This class provides functionalities to prepare and execute an inverse kinematics analysis using IMU data with OpenSim’s OpenSense toolkit.
- Parameters:
DATA_PATH (str) – Data path where the .osim model and results are located.
calibratedOsimName (str) – Name of the calibrated OpenSim model file (.osim).
resultsDirectory (str) – Directory where the results will be saved.
- __init__(DATA_PATH: str, calibratedOsimName: str, resultsDirectory: str)#
Initializes the ImuInverseKinematicXMLProcedure with specified data path, osim model name, and results directory.
Methods
__init__
(DATA_PATH, calibratedOsimName, ...)Initializes the ImuInverseKinematicXMLProcedure with specified data path, osim model name, and results directory.
finalize
()Finalize the procedure after running, including renaming the setup file.
prepareImu
(osimBody, imuInstance)Assign an IMU instance to an OpenSim model body.
prepareImuMapper
(imuMapperDict)Prepare the IMU mapper.
prepareOrientationFile
(motionFilenameNoExt, freq)Prepare the orientation file (STO file) from IMUs.
prepareSensorToOpensimRotation
(eulerAngles)Prepare Euler angles to align sensors to the OpenSim global coordinate system.
Prepare and update the XML associated with the setup file for the inverse kinematics analysis.
run
()Run the IMU inverse kinematics procedure using the prepared setup.
setSetupFile
(imuInverseKinematicToolFile)Set the inverse kinematics setup file for the procedure.
setTimeRange
(beginTime, lastTime)Set the begin and end time for the analysis.
- finalize()#
Finalize the procedure after running, including renaming the setup file.
- prepareImu(osimBody: str, imuInstance: Imu)#
Assign an IMU instance to an OpenSim model body.
- Parameters:
osimBody (str) – Name of the body in the OpenSim model.
imuInstance (imu.Imu) – A pyCGM2 IMU instance.
- prepareImuMapper(imuMapperDict: Dict)#
Prepare the IMU mapper.
The mapper associates OpenSim model bodies with corresponding IMU instances.
- Parameters:
imuMapperDict (Dict) – Dictionary mapping OpenSim body names to IMU instances.
- prepareOrientationFile(motionFilenameNoExt: str, freq: int, order: List = [0, 1, 2, 3])#
Prepare the orientation file (STO file) from IMUs.
- Parameters:
motionFilenameNoExt (str) – Name of the STO file to be created.
freq (int) – Sampling frequency of the IMU data.
order (List, optional) – Quaternion reordering. Defaults to [0, 1, 2, 3].
- prepareSensorToOpensimRotation(eulerAngles: List)#
Prepare Euler angles to align sensors to the OpenSim global coordinate system.
- Parameters:
eulerAngles (List) – List of 3 Euler angle values in radians.
- prepareXml()#
Prepare and update the XML associated with the setup file for the inverse kinematics analysis.
- run()#
Run the IMU inverse kinematics procedure using the prepared setup.
- setSetupFile(imuInverseKinematicToolFile: str)#
Set the inverse kinematics setup file for the procedure.
- Parameters:
imuInverseKinematicToolFile (str) – Path and filename of the OpenSense setup file.
- setTimeRange(beginTime: float | None, lastTime: float | None)#
Set the begin and end time for the analysis.
- Parameters:
beginTime (Optional[float]) – Start time of the analysis.
lastTime (Optional[float]) – End time of the analysis.