OpenSense via Matlab API: Setting orientation weights
Posted: Wed Feb 22, 2023 12:07 pm
Hello OpenSim/OpenSense community!
I am looking for help on how to set the orientations_weights for specific body segments for the weighted least squares algorithm in IMUInverseKinematicsTool() via MATLAB scripting, so that I can assign different weights to the segments?
This is my example code section:
----------------------------------------------------------------------------------------------
imuIK = IMUInverseKinematicsTool();
% Set the model path to be used for tracking
imuIK.set_model_file(strrep(modelFileName, '.osim', '_calibrated.osim'));
imuIK.set_orientations_file(orientationsFileName);
% Set time range in seconds
imuIK.set_time_range(0, startTime);
imuIK.set_time_range(1, endTime);
imuIK.set_sensor_to_opensim_rotations(sensor_to_opensim_rotation);
% Set a directory for the results to be written to
imuIK.set_results_directory(resultsDirectory);
% Set a output motion file name
imuIK.set_output_motion_file(outputMotionFile);
imuIK.set_report_errors(writeOrientationErrors);
% Run IK
imuIK.run(visualizeTracking);
---------------------------------------------------------------------------------------------
I found in the API documentation the function set_orientation_weights(), however I do not know how to use this exactly.
It would be perfect, if someone could send me an example-code for the input to this function or another way to handle this issue.
I know the possibility to set them in the GUI and as XML-tags, but I would prefer to alter them via MATLAB.
Thank you in advance,
best regards
Christian
I am looking for help on how to set the orientations_weights for specific body segments for the weighted least squares algorithm in IMUInverseKinematicsTool() via MATLAB scripting, so that I can assign different weights to the segments?
This is my example code section:
----------------------------------------------------------------------------------------------
imuIK = IMUInverseKinematicsTool();
% Set the model path to be used for tracking
imuIK.set_model_file(strrep(modelFileName, '.osim', '_calibrated.osim'));
imuIK.set_orientations_file(orientationsFileName);
% Set time range in seconds
imuIK.set_time_range(0, startTime);
imuIK.set_time_range(1, endTime);
imuIK.set_sensor_to_opensim_rotations(sensor_to_opensim_rotation);
% Set a directory for the results to be written to
imuIK.set_results_directory(resultsDirectory);
% Set a output motion file name
imuIK.set_output_motion_file(outputMotionFile);
imuIK.set_report_errors(writeOrientationErrors);
% Run IK
imuIK.run(visualizeTracking);
---------------------------------------------------------------------------------------------
I found in the API documentation the function set_orientation_weights(), however I do not know how to use this exactly.
It would be perfect, if someone could send me an example-code for the input to this function or another way to handle this issue.
I know the possibility to set them in the GUI and as XML-tags, but I would prefer to alter them via MATLAB.
Thank you in advance,
best regards
Christian