Problem in appending actuators with Matlab
Posted: Tue Apr 14, 2020 2:42 am
Hi OpenSim community,
I encountered a problem when scripting with Matlab.
The problem arised from the CMCTool. For my previous projects, I normally initiated a simulation by reading in a default XML setup file and modifying inputs via API (as suggested by the developers group). This worked out fine for Inverse Kinematcs and Analysis tools. However, the same pipeline reported the following errors for the CMCTool:
CMC.computeControls: t = 0
SimTK Exception thrown at interiorpointoptimizer.cpp:264:
Optimizer failed: Ipopt: Infeasible problem detected (status 2)
OPTIMIZATION FAILED...
CMC.computeControls: ERROR- Optimizer could not find a solution.
Unable to find a feasible solution at time = 0.
Model cannot generate the forces necessary to achieve the target acceleration.
Possible issues: 1. not all model degrees-of-freedom are actuated,
2. there are tracking tasks for locked coordinates, and/or
3. there are unnecessary control constraints on reserve/residual actuators.
After looking into the details I found that the problem was likely attributed to the failure of appending reversed actuactors to the model. It appeared that additional force set could not be added by the "setForceSetFiles" method, the same issue that I believed many other users have had before.
Could anyone show me the correct Matlab lines (or entries) to append actuators to the model in OpenSim 4.0 and Matlab 64-bit?
Belowed I attached a part of my Matlab script for your reference:
Your help will be appreciated.
I encountered a problem when scripting with Matlab.
The problem arised from the CMCTool. For my previous projects, I normally initiated a simulation by reading in a default XML setup file and modifying inputs via API (as suggested by the developers group). This worked out fine for Inverse Kinematcs and Analysis tools. However, the same pipeline reported the following errors for the CMCTool:
CMC.computeControls: t = 0
SimTK Exception thrown at interiorpointoptimizer.cpp:264:
Optimizer failed: Ipopt: Infeasible problem detected (status 2)
OPTIMIZATION FAILED...
CMC.computeControls: ERROR- Optimizer could not find a solution.
Unable to find a feasible solution at time = 0.
Model cannot generate the forces necessary to achieve the target acceleration.
Possible issues: 1. not all model degrees-of-freedom are actuated,
2. there are tracking tasks for locked coordinates, and/or
3. there are unnecessary control constraints on reserve/residual actuators.
After looking into the details I found that the problem was likely attributed to the failure of appending reversed actuactors to the model. It appeared that additional force set could not be added by the "setForceSetFiles" method, the same issue that I believed many other users have had before.
Could anyone show me the correct Matlab lines (or entries) to append actuators to the model in OpenSim 4.0 and Matlab 64-bit?
Belowed I attached a part of my Matlab script for your reference:
Code: Select all
scaledModel = strcat('.\',ModelFileName);
model = Model(scaledModel);
model.initSystem();
defaultELfile = strcat('.\testing_EL.xml');
GRFdata = strcat('.\',Subject{ren},Point{k},'_kinetics.mot');
ELsetupfile = strcat('.\',Subject{ren},Point{k},'_EL.xml');
generalCMCFile = strcat('.\testing_CMC.xml');
outputIKFile = strcat('.\',Subject{ren},Point{k},'_IK.mot');
outputName = strcat(Subject(ren),Point(k));
taskFile = strcat('.\gait2392_CMC_Tasks.xml');
actuatorFile = strcat('.\gait2392_CMC_Actuators.xml');
cmcTool = CMCTool();
actuator = ArrayStr(actuatorFile)
cmcTool.setModel(model);
cmcTool.setDesiredKinematicsFileName(outputIKFile);
cmcTool.setTaskSetFileName(taskFile);
cmcTool.setName(outputName);
cmcTool.setForceSetFiles(actuator);
cmcTool.setExternalLoadsFileName(defaultELfile);
cmcTool.getExternalLoads.setDataFileName(GRFdata);
cmcTool.run();
Your help will be appreciated.