Page 1 of 1

Residual Reduction Algorithm, Tracking Tasks

Posted: Mon Oct 14, 2024 4:25 am
by mekswell98
Hello everyone,

I am currently working on performing the Residual Reduction Algorithm (RRA), but I have been running into a persistent issue. Every time I try to run the RRA, I receive the following error:

Method Assembler::assemble() failed because:
Unable to achieve required assembly error tolerance.
Assembly error tolerance achieved: 5.2566849063404494e-09 required: 1e-10. Model relaxing constraints and trying again.
Requested COM adjustment time range 0.01 to 31.12, clamped to nearest available data times: 0.01 to 31.12.
Computing average residuals between 0.01 and 31.12...
InverseDynamics: ERROR - over-constrained system - need at least as many forces as there are degrees of freedom.

I think the problem might be related to missing Degrees of Freedom (DoF) in the script for the tracking tasks file. I used the default tracking tasks file from OpenSim, "gait10dof_Kinematics_Tracking_Tasks", and added all the necessary DoFs. I double-checked everything, and the DoFs in the tracking tasks file seem to match the forces in the IK file. I also tried excluding the DoFs that do not contain forces or values, but this did not solve the issue either.

Has anyone experienced a similar issue or can offer any insights on what might be going wrong? I would really appreciate any suggestions or ideas.

Here are the files I am using:

Tracking tasks file with all DoFs: gait10dof_Kinematics_Tracking_Tasks_New_FullDoF
Tracking tasks file without DoFs that have values 0: gait10dof_Kinematics_Tracking_Tasks_New_LowerDoF
Set file for GRF: LR02_CMJ_Set.xml
Reserve Actuators file: Reserve_Actuators.xml
IK file: LR_02_dl_CMJ_IK_SmallerFile.mot (this file contains only the first few seconds of the trial)
Here are all the DoFs from the file:

pelvis_tilt, pelvis_list, pelvis_rotation, pelvis_tx, pelvis_ty, pelvis_tz, hip_flexion_r, hip_adduction_r, hip_rotation_r, knee_angle_r, med_cond_adduction_r (0 values), lat_cond_adduction_r (0 values), knee_angle_r_beta, ankle_angle_r, subtalar_angle_r (0 values), mtp_angle_r (0 values), hip_flexion_l, hip_adduction_l, hip_rotation_l, knee_angle_l, med_cond_adduction_l (0 values), lat_cond_adduction_l (0 values), knee_angle_l_beta, ankle_angle_l, subtalar_angle_l (0 values), mtp_angle_l (0 values), lumbar_extension, lumbar_bending, lumbar_rotation, arm_flex_r, arm_add_r, arm_rot_r, elbow_flex_r, pro_sup_r, wrist_flex_r (0 values), wrist_dev_r (0 values), arm_flex_l, arm_add_l, arm_rot_l, elbow_flex_l, pro_sup_l, wrist_flex_l (0 values), wrist_dev_l (0 values)

Thanks in advance for your help!

Best regards,
Max

Re: Residual Reduction Algorithm, Tracking Tasks

Posted: Tue Oct 15, 2024 12:01 am
by kernalnet
Hi, you need a tracking task for every free coordinate. The issue might also be your actuator file. Similarly, in RRA you need a strong coordinate actuator for every free coordinate, but weak residual actuator for pelvis coordinates.
(weld and locked coordinates must be excluded)

Hope this helps.

Re: Residual Reduction Algorithm, Tracking Tasks

Posted: Tue Oct 15, 2024 4:01 pm
by mekswell98
Hi,

Thanks a lot for your reply, I appreciate it!

Could you elaborate a bit on what you mean with a free coordinate? Or do you have an example tracking task?
I'm still quite new to all this.

Re: Residual Reduction Algorithm, Tracking Tasks

Posted: Tue Oct 15, 2024 10:02 pm
by kernalnet
Hi, sorry for brevity. Free coordinates are independent without any constraint, so the optimizer can change their values. The Coordinate::isConstrained method could help you find them; for example in Python:

Code: Select all

import opensim as osim

model = osim.Model('Rajagopal2016.osim')
state = model.initSystem()
for coordinate in model.getCoordinateSet():
    print(coordinate.getName(), coordinate.isConstrained(state))
Here is the tracking task of Rajagopal2016 model. For example, you can see the mtp_r coordinate is locked, and the knee_angle_r_beta has a coupler constraint, so they were excluded from both the tracking task and the actuator files:

https://github.com/opensim-org/opensim- ... walk_1.xml
https://github.com/opensim-org/opensim- ... uators.xml

Hope this helps.

Re: Residual Reduction Algorithm, Tracking Tasks

Posted: Wed Oct 16, 2024 1:23 am
by mekswell98
It certainly does! Thanks a lot.