[OpenSim]Forward Dynamics Tool文件设置

[OpenSim]Forward Dynamics Tool文件设置

首先,以下讨论摘自官网:点击这里
       前向动力学工具(FD Tool)使用与CMC工具(CMC Tool)中相同的模型model和执行器actuator输入,并且也同样使用在CMC Tool计算过程中所使用过的初始状态Initial states和控制controls文件,这些文件共同作为FD Tool的输入文件并运行肌肉驱动(Muscle driven)的前向动力学仿真(Forward Dynamics Simulation)。该过程旨在重现CMC跟踪的相同运动(Desired Kinematics以及Tracking Task,这在作者的另一篇博文当中提及,点击这里跳转)。
       在FD Tool中,Initial states和controls的输入栏是可选的。如果states未有输入文件设置,则模型将采用状态变量的默认值。同样,如果未指定任何controls作为输入,则积分将以零值进行。
       与CMC Tool在闭环系统中使用PD控制器来确保跟踪(Tracking Task)所需轨迹的思路相反,FD Tool是一种开环系统。FD Tool盲目地应用记录的执行器控制,而没有反馈或校正机制,以帮助确保准确的跟踪。理论上,在与CMC Tool完全相同的条件下开始,并给它完全相同的CMC计算的控制,FD应该重现在CMC期间计算的相同轨迹。然而,与CMC相比,即使是数值上(由于截断或舍入)或FD Tool使用这些数值的方式上的微小差异,也会导致前向模拟偏离预期轨迹。这对于较长时间的模拟来说尤其是个问题,在这种情况下,微小的差异有更多的时间积累,而在这种情况下,差异会变得更加明显,最终导致模拟变得完全不稳定。
可以通过多种方式来减少FD Tool与CMC之间的差异
1)在CMC步骤中,建议将输出精度设置为20,以确保FD Tool读取和使用的值与CMC的值高精度匹配。
2)FD Tool将模型的初始状态设置为与FD Tool初始时间相对应的CMC状态值。如果将FD Tool设置为在没有CMC状态值可用的时间启动,则初始时间将调整为具有状态值的最近时间。这是自动完成的。
3)通过FD Tool的设置文件< use_specified_dt >中的属性,还可以使用与CMC中相同的积分时间步骤。建议将此属性设置为true,以最小化长时正演模拟的差异。如果设置为false,则FD Tool的积分器将根据所需的设置误差容限自适应地计算自己的时间步长。由于这些时间步长往往与CMC中使用的时间步长不同,因此结果的差异通常会更快。

Solve for equilibrium for actuator states”的解释为:
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.
即,指示是否为坐标coordinates或速度speeds以外的状态计算平衡值的标志。例如,平衡肌纤维长度或肌力。

FD Tool文件设置

       在作者的其他博客已经介绍了Forward Dynamics Tool的面板(点击这里跳转),这里不再解释,并直接运用该博客文章当中的存在于FD Tool plane当中的设置栏标识。

Contros一栏

       关于控件的xml文件来自于CMC,这就要求我们应当先对Desired Kinematics进行CMC计算,计算所得的Result当中包含controls.xml文件。关于这个controls.xml文件可以通过肌肉激励编辑器Excitation Editor打开以观察所研究肌肉的激活情况。

Initial States一栏

       关于initial states一栏的输入sto文件来自于CMC计算结果中的states.sto文件。在这里我们需要注意的是:
1)initial states.sto≠desired kinematics.mot文件的内容;
2)此外,若你仅保留desired kinematics.mot文件中的第一行数据,你理所当然的认为这是初始状态,然而,至少以我的知识水平和经验来看,这是不对的。你可以打开来自CMC的states.sto文件进行比较。

Actuators and External Loads面板

       Actuators一栏和External Loads一栏均没有文件输入是不影响Forward Dynamics Simulation的运行,但是所得的结果一定不可能是完全正确的(这一点我实在官方论坛上查询各学习者之间的问答偶然发现的一句话)。关于Actuators.xml的编辑我还不知道如何进行。

这里给出gait2354_CMC_Actuators.xml文件内容,希望你可以得到提示

<?xml version="1.0" encoding="UTF-8" ?>
<OpenSimDocument Version="30000">
	<ForceSet name="gait2354_CMC">
		<defaults>
			<CoordinateActuator name="default">
				<!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
				<isDisabled>false</isDisabled>
				<!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
				<min_control>-infinity</min_control>
				<!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
				<max_control>infinity</max_control>
				<!--Name of the generalized coordinate to which the actuator applies.-->
				<coordinate></coordinate>
				<!--The maximum generalized force produced by this actuator.-->
				<optimal_force>1000</optimal_force>
			</CoordinateActuator>
		</defaults>
		<objects>
			<PointActuator name="FX">
				<!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
				<isDisabled>false</isDisabled>
				<!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
				<min_control>-infinity</min_control>
				<!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
				<max_control>infinity</max_control>
				<!--Name of Body to which this actuator is applied.-->
				<body>pelvis</body>
				<!--Location of application point; in body frame unless point_is_global=true-->
				<point>-0.0724376 0 0</point>
				<!--Interpret point in Ground frame if true; otherwise, body frame.-->
				<point_is_global>false</point_is_global>
				<!--Force application direction; in body frame unless force_is_global=true.-->
				<direction>1 0 0</direction>
				<!--Interpret direction in Ground frame if true; otherwise, body frame.-->
				<force_is_global>true</force_is_global>
				<!--The maximum force produced by this actuator when fully activated.-->
				<optimal_force>4</optimal_force>
			</PointActuator>
			<PointActuator name="FY">
				<!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
				<isDisabled>false</isDisabled>
				<!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
				<min_control>-infinity</min_control>
				<!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
				<max_control>infinity</max_control>
				<!--Name of Body to which this actuator is applied.-->
				<body>pelvis</body>
				<!--Location of application point; in body frame unless point_is_global=true-->
				<point>-0.0724376 0 0</point>
				<!--Interpret point in Ground frame if true; otherwise, body frame.-->
				<point_is_global>false</point_is_global>
				<!--Force application direction; in body frame unless force_is_global=true.-->
				<direction>0 1 0</direction>
				<!--Interpret direction in Ground frame if true; otherwise, body frame.-->
				<force_is_global>true</force_is_global>
				<!--The maximum force produced by this actuator when fully activated.-->
				<optimal_force>8</optimal_force>
			</PointActuator>
			<PointActuator name="FZ">
				<!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
				<isDisabled>false</isDisabled>
				<!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
				<min_control>-infinity</min_control>
				<!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
				<max_control>infinity</max_control>
				<!--Name of Body to which this actuator is applied.-->
				<body>pelvis</body>
				<!--Location of application point; in body frame unless point_is_global=true-->
				<point>-0.0724376 0 0</point>
				<!--Interpret point in Ground frame if true; otherwise, body frame.-->
				<point_is_global>false</point_is_global>
				<!--Force application direction; in body frame unless force_is_global=true.-->
				<direction>0 0 1</direction>
				<!--Interpret direction in Ground frame if true; otherwise, body frame.-->
				<force_is_global>true</force_is_global>
				<!--The maximum force produced by this actuator when fully activated.-->
				<optimal_force>4</optimal_force>
			</PointActuator>
			<TorqueActuator name="MX">
				<!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
				<isDisabled>false</isDisabled>
				<!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
				<min_control>-infinity</min_control>
				<!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
				<max_control>infinity</max_control>
				<!--Name of Body to which the torque actuator is applied.-->
				<bodyA>pelvis</bodyA>
				<!--Name of Body to which the equal and opposite torque is applied.-->
				<bodyB>ground</bodyB>
				<!--Interpret axis in Ground frame if true; otherwise, body A's frame.-->
				<torque_is_global>true</torque_is_global>
				<!--Fixed direction about which torque is applied, in Ground or body A frame depending on 'torque_is_global' property.-->
				<axis>1 0 0</axis>
				<!--The maximum torque produced by this actuator when fully activated.-->
				<optimal_force>2</optimal_force>
			</TorqueActuator>
			<TorqueActuator name="MY">
				<!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
				<isDisabled>false</isDisabled>
				<!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
				<min_control>-infinity</min_control>
				<!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
				<max_control>infinity</max_control>
				<!--Name of Body to which the torque actuator is applied.-->
				<bodyA>pelvis</bodyA>
				<!--Name of Body to which the equal and opposite torque is applied.-->
				<bodyB>ground</bodyB>
				<!--Interpret axis in Ground frame if true; otherwise, body A's frame.-->
				<torque_is_global>true</torque_is_global>
				<!--Fixed direction about which torque is applied, in Ground or body A frame depending on 'torque_is_global' property.-->
				<axis>0 1 0</axis>
				<!--The maximum torque produced by this actuator when fully activated.-->
				<optimal_force>2</optimal_force>
			</TorqueActuator>
			<TorqueActuator name="MZ">
				<!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
				<isDisabled>false</isDisabled>
				<!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
				<min_control>-infinity</min_control>
				<!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
				<max_control>infinity</max_control>
				<!--Name of Body to which the torque actuator is applied.-->
				<bodyA>pelvis</bodyA>
				<!--Name of Body to which the equal and opposite torque is applied.-->
				<bodyB>ground</bodyB>
				<!--Interpret axis in Ground frame if true; otherwise, body A's frame.-->
				<torque_is_global>true</torque_is_global>
				<!--Fixed direction about which torque is applied, in Ground or body A frame depending on 'torque_is_global' property.-->
				<axis>0 0 1</axis>
				<!--The maximum torque produced by this actuator when fully activated.-->
				<optimal_force>2</optimal_force>
			</TorqueActuator>
      
      <!-- Reserve Motors to assist muscles -->
      <CoordinateActuator name="hip_flexion_r_reserve">
        <!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
        <isDisabled>false</isDisabled>
        <!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
        <min_control>-infinity</min_control>
        <!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
        <max_control>infinity</max_control>
        <!--Name of the generalized coordinate to which the actuator applies.-->
        <coordinate>hip_flexion_r</coordinate>
        <!--The maximum generalized force produced by this actuator.-->
        <optimal_force>1</optimal_force>
      </CoordinateActuator>
      <CoordinateActuator name="hip_adduction_r_reserve">
        <!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
        <isDisabled>false</isDisabled>
        <!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
        <min_control>-infinity</min_control>
        <!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
        <max_control>infinity</max_control>
        <!--Name of the generalized coordinate to which the actuator applies.-->
        <coordinate>hip_adduction_r</coordinate>
        <!--The maximum generalized force produced by this actuator.-->
        <optimal_force>1</optimal_force>
      </CoordinateActuator>
      <CoordinateActuator name="hip_rotation_r_reserve">
        <!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
        <isDisabled>false</isDisabled>
        <!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
        <min_control>-infinity</min_control>
        <!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
        <max_control>infinity</max_control>
        <!--Name of the generalized coordinate to which the actuator applies.-->
        <coordinate>hip_rotation_r</coordinate>
        <!--The maximum generalized force produced by this actuator.-->
        <optimal_force>1</optimal_force>
      </CoordinateActuator>
      <CoordinateActuator name="knee_angle_r_reserve">
        <!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
        <isDisabled>false</isDisabled>
        <!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
        <min_control>-infinity</min_control>
        <!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
        <max_control>infinity</max_control>
        <!--Name of the generalized coordinate to which the actuator applies.-->
        <coordinate>knee_angle_r</coordinate>
        <!--The maximum generalized force produced by this actuator.-->
        <optimal_force>1</optimal_force>
      </CoordinateActuator>
			<CoordinateActuator name="ankle_angle_r_reserve">
				<!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
				<isDisabled>false</isDisabled>
				<!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
				<min_control>-infinity</min_control>
				<!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
				<max_control>infinity</max_control>
				<!--Name of the generalized coordinate to which the actuator applies.-->
				<coordinate>ankle_angle_r</coordinate>
				<!--The maximum generalized force produced by this actuator.-->
				<optimal_force>1</optimal_force>
			</CoordinateActuator>
			<CoordinateActuator name="subtalar_angle_r_reserve">
				<!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
				<isDisabled>false</isDisabled>
				<!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
				<min_control>-infinity</min_control>
				<!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
				<max_control>infinity</max_control>
				<!--Name of the generalized coordinate to which the actuator applies.-->
				<coordinate>subtalar_angle_r</coordinate>
				<!--The maximum generalized force produced by this actuator.-->
				<optimal_force>1</optimal_force>
			</CoordinateActuator>
			<CoordinateActuator name="mtp_angle_r_reserve">
				<!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
				<isDisabled>false</isDisabled>
				<!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
				<min_control>-infinity</min_control>
				<!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
				<max_control>infinity</max_control>
				<!--Name of the generalized coordinate to which the actuator applies.-->
				<coordinate>mtp_angle_r</coordinate>
				<!--The maximum generalized force produced by this actuator.-->
				<optimal_force>1</optimal_force>
			</CoordinateActuator>


      <CoordinateActuator name="hip_flexion_l_reserve">
        <!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
        <isDisabled>false</isDisabled>
        <!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
        <min_control>-infinity</min_control>
        <!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
        <max_control>infinity</max_control>
        <!--Name of the generalized coordinate to which the actuator applies.-->
        <coordinate>hip_flexion_l</coordinate>
        <!--The maximum generalized force produced by this actuator.-->
        <optimal_force>1</optimal_force>
      </CoordinateActuator>
      <CoordinateActuator name="hip_adduction_l_reserve">
        <!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
        <isDisabled>false</isDisabled>
        <!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
        <min_control>-infinity</min_control>
        <!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
        <max_control>infinity</max_control>
        <!--Name of the generalized coordinate to which the actuator applies.-->
        <coordinate>hip_adduction_l</coordinate>
        <!--The maximum generalized force produced by this actuator.-->
        <optimal_force>1</optimal_force>
      </CoordinateActuator>
      <CoordinateActuator name="hip_rotation_l_reserve">
        <!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
        <isDisabled>false</isDisabled>
        <!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
        <min_control>-infinity</min_control>
        <!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
        <max_control>infinity</max_control>
        <!--Name of the generalized coordinate to which the actuator applies.-->
        <coordinate>hip_rotation_l</coordinate>
        <!--The maximum generalized force produced by this actuator.-->
        <optimal_force>1</optimal_force>
      </CoordinateActuator>
      <CoordinateActuator name="knee_angle_l_reserve">
        <!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
        <isDisabled>false</isDisabled>
        <!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
        <min_control>-infinity</min_control>
        <!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
        <max_control>infinity</max_control>
        <!--Name of the generalized coordinate to which the actuator applies.-->
        <coordinate>knee_angle_l</coordinate>
        <!--The maximum generalized force produced by this actuator.-->
        <optimal_force>1</optimal_force>
      </CoordinateActuator>
			<CoordinateActuator name="ankle_angle_l_reserve">
				<!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
				<isDisabled>false</isDisabled>
				<!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
				<min_control>-infinity</min_control>
				<!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
				<max_control>infinity</max_control>
				<!--Name of the generalized coordinate to which the actuator applies.-->
				<coordinate>ankle_angle_l</coordinate>
				<!--The maximum generalized force produced by this actuator.-->
				<optimal_force>1</optimal_force>
			</CoordinateActuator>
			<CoordinateActuator name="subtalar_angle_l_reserve">
				<!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
				<isDisabled>false</isDisabled>
				<!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
				<min_control>-infinity</min_control>
				<!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
				<max_control>infinity</max_control>
				<!--Name of the generalized coordinate to which the actuator applies.-->
				<coordinate>subtalar_angle_l</coordinate>
				<!--The maximum generalized force produced by this actuator.-->
				<optimal_force>1</optimal_force>
			</CoordinateActuator>
			<CoordinateActuator name="mtp_angle_l_reserve">
				<!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
				<isDisabled>false</isDisabled>
				<!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
				<min_control>-infinity</min_control>
				<!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
				<max_control>infinity</max_control>
				<!--Name of the generalized coordinate to which the actuator applies.-->
				<coordinate>mtp_angle_l</coordinate>
				<!--The maximum generalized force produced by this actuator.-->
				<optimal_force>1</optimal_force>
			</CoordinateActuator>
      
      <CoordinateActuator name="lumbar_extension_reserve">
        <!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
        <isDisabled>false</isDisabled>
        <!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
        <min_control>-infinity</min_control>
        <!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
        <max_control>infinity</max_control>
        <!--Name of the generalized coordinate to which the actuator applies.-->
        <coordinate>lumbar_extension</coordinate>
        <!--The maximum generalized force produced by this actuator.-->
        <optimal_force>1</optimal_force>
      </CoordinateActuator>
      <CoordinateActuator name="lumbar_bending_reserve">
        <!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
        <isDisabled>false</isDisabled>
        <!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
        <min_control>-infinity</min_control>
        <!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
        <max_control>infinity</max_control>
        <!--Name of the generalized coordinate to which the actuator applies.-->
        <coordinate>lumbar_bending</coordinate>
        <!--The maximum generalized force produced by this actuator.-->
        <optimal_force>1</optimal_force>
      </CoordinateActuator>
      <CoordinateActuator name="lumbar_rotation_reserve">
        <!--Flag indicating whether the force is disabled or not. Disabled means that the force is not active in subsequent dynamics realizations.-->
        <isDisabled>false</isDisabled>
        <!--Minimum allowed value for control signal. Used primarily when solving for control values.-->
        <min_control>-infinity</min_control>
        <!--Maximum allowed value for control signal. Used primarily when solving for control values.-->
        <max_control>infinity</max_control>
        <!--Name of the generalized coordinate to which the actuator applies.-->
        <coordinate>lumbar_rotation</coordinate>
        <!--The maximum generalized force produced by this actuator.-->
        <optimal_force>1</optimal_force>
      </CoordinateActuator>
		</objects>
		<groups />
	</ForceSet>
</OpenSimDocument>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值