Page 1 of 1

Change Property of Analysis (PointKinematic)

Posted: Mon Sep 14, 2020 10:08 am
by mohsensh91
Hi all,

i'm new to OpenSim API. I'm trying to change one of the Property ('POINT') inside the PointKinematic within an Analyze.XML file. In OpenSim 3.0, this's can be done using 'PropertyHelper', but in OpenSim 4.1 this function was deprecated. I wonder if anyone know how I can change the coordinate of the Point or any Property inside an XML file via matlab API.

Code: Select all

AnalysisSet = analyzeTool.getAnalysisSet()
PK_Analysis = AnalysisSet.get(1);
(-0.172322 0.0400191 0.00588038) = PK_Analysis.getPropertyByName('point')
????
[code]


In both Matlab and GUI scripting, OpenSimContext, PropertyHelper, and ArrayDouble are deprecated. These helper functions are no longer necessary since Simbody classes such as State and Vec3 have been exposed. For more information, see Common Scripting Commands.

[b]XML File[/b]:
[code]
<OpenSimDocument Version="40000">
	<AnalyzeTool name="subject01_walk1">
		<!--Name of the .osim file used to construct a model.-->
		<model_file>../subject01_gait2392_scaled.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 a force set for the model.-->
		<force_set_files />
		<!--Directory used for writing results.-->
		<results_directory>New Folder</results_directory>
		<!--Output precision.  It is 8 by default.-->
		<output_precision>8</output_precision>
		<!--Initial time for the simulation.-->
		<initial_time>3.0670000000000002</initial_time>
		<!--Final time for the simulation.-->
		<final_time>4.2670000000000003</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>false</solve_for_equilibrium_for_auxiliary_states>
		<!--Maximum number of integrator steps.-->
		<maximum_number_of_integrator_steps>20000</maximum_number_of_integrator_steps>
		<!--Maximum integration step size.-->
		<maximum_integrator_step_size>1</maximum_integrator_step_size>
		<!--Minimum integration step size.-->
		<minimum_integrator_step_size>1e-08</minimum_integrator_step_size>
		<!--Integrator error tolerance. When the error is greater, the integrator step size is decreased.-->
		<integrator_error_tolerance>1.0000000000000001e-05</integrator_error_tolerance>
		<!--Set of analyses to be run during the investigation.-->
		<AnalysisSet name="Analyses">
			<objects>
				<PointKinematics name="PointKinematics_PelvisIMU">
					<!--Flag (true or false) specifying whether on. True by default.-->
					<on>true</on>
					<!--Start time.-->
					<start_time>3.0670000000000002</start_time>
					<!--End time.-->
					<end_time>4.2670000000000003</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>1</step_interval>
					<!--Flag (true or false) indicating whether the results are in degrees or not.-->
					<in_degrees>true</in_degrees>
					<body_name>pelvis</body_name>
					<relative_to_body_name>ground</relative_to_body_name>
					<point_name>V.Sacral</point_name>
					<point> -0.172322 0.0400191 0.00588038</point>
				</PointKinematics>
				
Best regards,
Mohsen

Re: Change Property of Analysis (PointKinematic)

Posted: Tue Sep 15, 2020 9:32 pm
by ongcf
The doxygen shows a setPoint() method that could be helpful: https://simtk.org/api_docs/opensim/api_ ... atics.html

We're also planning on reintroducing the PropertyHelper in 4.2 (yet to be released). If you're building from source, it's already in the master branch on GitHub.