I have added biarticular path spring to the model. After CMC, I want to plot the spring force over the gait cycle. How to do that?
Please let me know.
ploting spring forces in opensim
- Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
Re: ploting spring forces in opensim
CMC dumps a force storage, so it will be there.
Best
Best
- Karthick Ganesan
- Posts: 119
- Joined: Thu Oct 10, 2013 12:11 am
Re: ploting spring forces in opensim
Only the actuation forces are stored. Spring force is not stored in ResultsCMC. How to access the spring force?
Can it be accessed by adding a force reporter? How to add force reporter in GUI?
Thanks
Can it be accessed by adding a force reporter? How to add force reporter in GUI?
Thanks
- Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
Re: ploting spring forces in opensim
You can add an analysis in the AnalysisSet in the CMC setup (.xml) see the example and adapt it with the ForceReporter:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<OpenSimDocument Version="20302">
<CMCTool name="subject01_walk1">
<!--Name of the .osim file used to construct a model.-->
<model_file> subject01_simbody_adjusted.osim </model_file>
<!--Replace the model's force set with sets specified in
<force_set_files>? If false, the force set is appended to.-->
<replace_force_set> false </replace_force_set>
<!--List of xml files used to construct an force set for the model.-->
<force_set_files> gait2354_CMC_Actuators.xml </force_set_files>
<!--Directory used for writing results.-->
<results_directory> ./ResultsCMC </results_directory>
<!--Output precision. It is 20 by default.-->
<output_precision> 20 </output_precision>
<!--Initial time for the simulation.-->
<initial_time> 0.80000000 </initial_time>
<!--Final time for the simulation.-->
<final_time> 1.20000000 </final_time>
<!--Flag indicating whether or not to compute equilibrium values for
states other than the coordinates or speeds. For example, equilibrium
muscle fiber lengths or muscle forces.-->
<solve_for_equilibrium_for_auxiliary_states> true </solve_for_equilibrium_for_auxiliary_states>
<!--Maximum number of integrator steps.-->
<maximum_number_of_integrator_steps> 30000 </maximum_number_of_integrator_steps>
<!--Maximum integration step size.-->
<maximum_integrator_step_size> 1.0000 </maximum_integrator_step_size>
<!--Minimum integration step size.-->
<minimum_integrator_step_size> 1e-10 </minimum_integrator_step_size>
<!--Integrator error tolerance. When the error is greater, the integrator
step size is decreased.-->
<integrator_error_tolerance> 1e-5 </integrator_error_tolerance>
<!--Set of analyses to be run during the investigation.-->
<AnalysisSet name="Analyses">
<objects>
<Kinematics name="Kinematics">
<!--Flag (true or false) specifying whether whether on. True by default.-->
<on> true </on>
<!--Start time.-->
<start_time> -infinity </start_time>
<!--End time.-->
<end_time> infinity </end_time>
<!--Specifies how often to store results during a simulation. More
specifically, the interval (a positive integer) specifies how many
successful integration steps should be taken before results are
recorded again.-->
<step_interval> 10 </step_interval>
<!--Flag (true or false) indicating whether the results are in degrees or
not.-->
<in_degrees> true </in_degrees>
<!--Names of generalized coordinates to record kinematics for. Use 'all'
to record all coordinates.-->
<coordinates> all </coordinates>
</Kinematics>
<Actuation name="Actuation">
<!--Flag (true or false) specifying whether whether on. True by default.-->
<on> true </on>
<!--Start time.-->
<start_time> -infinity </start_time>
<!--End time.-->
<end_time> infinity </end_time>
<!--Specifies how often to store results during a simulation. More
specifically, the interval (a positive integer) specifies how many
successful integration steps should be taken before results are
recorded again.-->
<step_interval> 10 </step_interval>
<!--Flag (true or false) indicating whether the results are in degrees or
not.-->
<in_degrees> true </in_degrees>
</Actuation>
</objects>
<groups/>
</AnalysisSet>
<!--Controller objects in the model.-->
<ControllerSet name="Controllers">
<objects/>
<groups/>
</ControllerSet>
<!--XML file (.xml) containing the external loads applied to the model as
a set of PrescribedForce(s).-->
<external_loads_file> subject01_walk1_grf.xml </external_loads_file>
<!--Motion (.mot) or storage (.sto) file containing the desired point
trajectories.-->
<desired_points_file> </desired_points_file>
<!--Motion (.mot) or storage (.sto) file containing the desired kinematic
trajectories.-->
<desired_kinematics_file> ResultsRRA/subject01_walk1_RRA_Kinematics_q.sto </desired_kinematics_file>
<!--File containing the tracking tasks. Which coordinates are tracked and
with what weights are specified here.-->
<task_set_file> gait2354_CMC_Tasks.xml </task_set_file>
<!--File containing the constraints on the controls.-->
<constraints_file> gait2354_CMC_ControlConstraints.xml </constraints_file>
<!--File containing the controls output by RRA. These can be used to place
constraints on the residuals during CMC.-->
<rra_controls_file> </rra_controls_file>
<!--Low-pass cut-off frequency for filtering the desired kinematics. A
negative value results in no filtering. The default value is -1.0, so
no filtering.-->
<lowpass_cutoff_frequency> -10.00000000 </lowpass_cutoff_frequency>
<!--Time window over which the desired actuator forces are achieved.
Muscles forces cannot change instantaneously, so a finite time window
must be allowed. The recommended time window for RRA is about 0.001
sec, and for CMC is about 0.010 sec.-->
<cmc_time_window> 0.01000000 </cmc_time_window>
<!--Flag (true or false) indicating whether or not to use the curvature
filter. Setting this flag to true can reduce oscillations in the
computed muscle excitations.-->
<use_curvature_filter> false </use_curvature_filter>
<!--Flag (true or false) indicating whether to use the fast CMC
optimization target. The fast target requires the desired
accelerations to be met. The optimizer fails if the acclerations
constraints cannot be met, so the fast target can be less robust. The
regular target does not require the acceleration constraints to be
met; it meets them as well as it can, but it is slower and less
accurate.-->
<use_fast_optimization_target> true </use_fast_optimization_target>
<!--Preferred optimizer algorithm (currently support "ipopt" or "cfsqp",
the latter requiring the osimFSQP library.-->
<optimizer_algorithm> ipopt </optimizer_algorithm>
<!--Perturbation size used by the optimizer to compute numerical
derivatives. A value between 1.0e-4 and 1.0e-8 is usually
approprieate.-->
<optimizer_derivative_dx> 1.00000000 </optimizer_derivative_dx>
<!--Convergence criterion for the optimizer. The smaller this value, the
deeper the convergence. Decreasing this number can improve a solution,
but will also likely increase computation time.-->
<optimizer_convergence_criterion> 0.10000000 </optimizer_convergence_criterion>
<!--Maximum number of iterations for the optimizer.-->
<optimizer_max_iterations> 2000 </optimizer_max_iterations>
<!--Print level for the optimizer, 0 - 3. 0=no printing, 3=detailed
printing, 2=in between-->
<optimizer_print_level> 0 </optimizer_print_level>
<!--True-false flag indicating whether or not to turn on verbose printing
for cmc.-->
<use_verbose_printing> false </use_verbose_printing>
</CMCTool>
</OpenSimDocument>