IMUInverseKinematicsTool duplicates motion file output

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Lukas H
Posts: 2
Joined: Tue Dec 05, 2023 7:01 am

IMUInverseKinematicsTool duplicates motion file output

Post by Lukas H » Wed Jan 24, 2024 1:11 am

Hi.

I am currently using the OpenSim API in Python and have the following problem with the IMUInverseKinematicsTool.

My workflow is shown below:

Code: Select all

imu_ik = opensim.IMUInverseKinematicsTool()
imu_ik.setModel(model)
imu_ik.set_output_motion_file(path)
imu_ik.set_orientations_file(orientation_file)
imu_ik.set_sensor_to_opensim_rotations(sensor_to_opensim_rotations)
imu_ik.set_results_directory(results_directory)
imu_ik.run()
When running for the first time by calling the method "run" everything works just fine and I get the correct motion file in the results directory.

It looks something like this:

Code: Select all

time	joint_2_coord_0	joint_3_coord_0
0 0 0
...
Calling method "run" again will produce the following output (appending the joint values to the previous output) even if I change the path of the output file.

Code: Select all

time	joint_2_coord_0	joint_3_coord_0 joint_2_coord_0	joint_3_coord_0
0 0 0 0 0
...
So in total I will get a total amount of columns = expected columns * amount of calling method run.

I tried to instantiate the imu_ik with a new IMUInverseKinematicsTool object and also changed the output_motion_file path after this, but it is still appending.

By restarting the program this behavior is reset.

Could it be that there is a temporary static variable in IMUInverseKinematicsTool which is not reset after calling the method "run"?
And is there a way to reset this behavior by calling a function such that I do not have to restart the program?

Many thanks in advance.

Cheers,
Lukas

Tags:

POST REPLY