Page 1 of 1

Question about Forward Dynamics simulation

Posted: Tue Oct 01, 2024 7:49 pm
by geng_chen
It is the beginner question. When configuring the XML file used in forward dynamics, can we set the degree of muscle activation related to the joint angle? For example, the muscle is fully activated when the joint angle reaches 90. When the joint angle is 0, the muscle is not activated. Currently, I find we can only set the activation level point-by-point. Thanks in advance.

Code: Select all

			<ControlLinear name="ECRL">
				<is_model_control>true</is_model_control>
				<extrapolate>true</extrapolate>
				<default_min>0.02</default_min>
				<default_max>1</default_max>
				<filter_on>false</filter_on>
				<use_steps>false</use_steps>
				<x_nodes>
					<ControlLinearNode>
						<t>0</t>
						<value>0.40611812899412514</value>
					</ControlLinearNode>
					<ControlLinearNode>
						<t>0.0083333299999999999</t>
						<value>0.63439237487184641</value>
					</ControlLinearNode>
				</x_nodes>
				<min_nodes/>
				<max_nodes/>
				<kp>100</kp>
				<kv>20</kv>
			</ControlLinear>

Re: Question about Forward Dynamics simulation

Posted: Mon Oct 07, 2024 12:11 pm
by ongcf
This isn't available out of the box to my knowledge. The closest example I can think of is the reflex controller from the example Simulation-Based Design to Prevent Ankle Injuries.

With some code, you could create a custom controller in a couple of ways:
- In C++, make a new Controller that uses joint angle from the state as an input to computing the controller value.
- In a scripting (Python or Matlab) API, create a function that reads in the state and calculates the correct controller value. Then, update a controller (such as through a PrescribedController, example of use) and integrate the system for a small time step (such as through the Manager class), and repeat this in a loop.