Hi there,
Is it possible to calculate the joint torques necessary to follow a desired motion for a model that is constrained at the hip and suspended off the ground? As in there would be no ground reaction forces. I have tried doing this with the inverse dynamics and forward dynamics tools, but even without including ground reaction forces, OpenSim still appears to assume there is ground contact or some other damping force in the ankle joint (and therefore the ankle joint output torque is quite low).
What I would like to do is find these joint torques and apply them to Torque or Coordinate Actuators outside the GUI in a separate simulation, in order to follow specific joint angles. So far while using the same .osim model I haven't been able to replicate the movement seen with the inverse dynamics tool. I imagine this could be accomplished through traditional inverse dynamics, but I am hoping this can be done within OpenSim.
Thanks,
Lowell
Calculating joint torques without GRF
- Lowell Rose
- Posts: 9
- Joined: Mon Oct 01, 2018 1:48 pm
- Carmichael Ong
- Posts: 401
- Joined: Fri Feb 24, 2012 11:50 am
Re: Calculating joint torques without GRF
There shouldn't be any assumptions about ground contact or other damping forces unless specified by the user. My best guess as to why you're seeing low joint torques is actually because there isn't any ground reaction forces being applied to the model. Since the foot is such a light mass, I'd expect ankle torques to be quite low to control the foot. If GRFs were applied to the feet (and not used to suspend the hips), however, then I'd expect substantial torques at the ankle would be needed.
- Lowell Rose
- Posts: 9
- Joined: Mon Oct 01, 2018 1:48 pm
Re: Calculating joint torques without GRF
Hi Carmichael, thanks for your reply.
I had thought so as well, but when I do load the ankle joint torques into a torque controller, it isn't enough to actuate the ankle from its resting position (where the foot is dangling due to gravity and no ground support). During the inverse dynamics simulation, it appears it is actuating the ankle around a foot flat state, even when no ground reaction forces are applied. For reference as well, the foot behaviour (and for the rest of the joints) in my simulation is similar to what happens when I click the Simulate button in the GUI, or run Forward dynamics, so I suspect this might be a forward integration issue?
I also don't have any additional constraints in my model, but I'm wondering if perhaps this is also due to some default muscle behaviour during the ID simulation possibly?
Thanks,
Lowell
I had thought so as well, but when I do load the ankle joint torques into a torque controller, it isn't enough to actuate the ankle from its resting position (where the foot is dangling due to gravity and no ground support). During the inverse dynamics simulation, it appears it is actuating the ankle around a foot flat state, even when no ground reaction forces are applied. For reference as well, the foot behaviour (and for the rest of the joints) in my simulation is similar to what happens when I click the Simulate button in the GUI, or run Forward dynamics, so I suspect this might be a forward integration issue?
I also don't have any additional constraints in my model, but I'm wondering if perhaps this is also due to some default muscle behaviour during the ID simulation possibly?
Thanks,
Lowell
- Carmichael Ong
- Posts: 401
- Joined: Fri Feb 24, 2012 11:50 am
Re: Calculating joint torques without GRF
Ah good point for possible muscle behavior. I think that if you're running inverse dynamics from the GUI, that the muscles should all be disabled (and there shouldn't be any extra passive forces due to the muscles). However, if you are constructing and using the InverseDynamicsTool from any API, then you will have to exclude the muscle forces.
- Lowell Rose
- Posts: 9
- Joined: Mon Oct 01, 2018 1:48 pm
Re: Calculating joint torques without GRF
Thanks, I removed the muscles and it seemed to be a bit closer. Do you know how the muscles are disabled during ID however, rather than removed? They do seem to have some minor effect still (passive force perhaps?), as the motion seems to be more damped via the GUI.
Another thing I was trying was using RRA with all actuators replaced by reserve actuators for each joint (as coordinate actuators). I then ran the forward dynamics tool with the control output from RRA, and then apply the output control to my coordinate actuators. I still see the same effect as I described above however. Would muscles still be disabled here? As far as I can tell, all my other parameters/constraints are identical.
Another thing I was trying was using RRA with all actuators replaced by reserve actuators for each joint (as coordinate actuators). I then ran the forward dynamics tool with the control output from RRA, and then apply the output control to my coordinate actuators. I still see the same effect as I described above however. Would muscles still be disabled here? As far as I can tell, all my other parameters/constraints are identical.
- Carmichael Ong
- Posts: 401
- Joined: Fri Feb 24, 2012 11:50 am
Re: Calculating joint torques without GRF
Excluded forces in ID (and as you've seen in RRA) should not produce any force (including passive forces). For ID, they are disabled by setExcludedForces() (https://github.com/opensim-org/opensim- ... l.cpp#L164) and for RRA the muscles are replaced by torque actuators (i.e., the muscles are removed from the forceset completely) (https://github.com/opensim-org/opensim- ... l.cpp#L411). In theory these should have the same effect.
To clarify, you are saying that the GUI's solution for ID seems to include passive muscle forces but using the API with setExcludedForces() does not included passive muscle forces?
A forward simulation should still have passive forces by default, so it seems like you might want to use ID with passive muscles in the model. It's still possible that the final forward simulation may not yield the desired original trajectory from inverse kinematics, though, because of accumulating integration errors over time.
To clarify, you are saying that the GUI's solution for ID seems to include passive muscle forces but using the API with setExcludedForces() does not included passive muscle forces?
A forward simulation should still have passive forces by default, so it seems like you might want to use ID with passive muscles in the model. It's still possible that the final forward simulation may not yield the desired original trajectory from inverse kinematics, though, because of accumulating integration errors over time.
- Lowell Rose
- Posts: 9
- Joined: Mon Oct 01, 2018 1:48 pm
Re: Calculating joint torques without GRF
What I was saying is confirming what you stated then, thanks. That the muscles are disabled during both those analyses. I was also saying though that it seems to assume there either is ground contact, or some damping force in the ankle, and other joints, which affects the torque output. When I apply the torques gained from ID to coordinate actuators I've added to my model (via the prescribe control for actuator function), even with the muscles disabled the torque is still too high for smooth movements. Is there perhaps a better way I can apply these torque values?
What I would like to do ultimately is run ID or RRA with the passive muscle forces included. I tried this instead with the forward simulation tool as you mentioned, where I set the reserve actuators to only append the model's force set (instead of replace), but it didn't seem to make a difference (i.e., the output joint torque values were still too low to actuate against the passive muscle forces).
As well, when I run ID using the API without setExcludedForces(), the torque values it outputs are far too high (i.e., in the 1000s of Nm).
What I would like to do ultimately is run ID or RRA with the passive muscle forces included. I tried this instead with the forward simulation tool as you mentioned, where I set the reserve actuators to only append the model's force set (instead of replace), but it didn't seem to make a difference (i.e., the output joint torque values were still too low to actuate against the passive muscle forces).
As well, when I run ID using the API without setExcludedForces(), the torque values it outputs are far too high (i.e., in the 1000s of Nm).
- Carmichael Ong
- Posts: 401
- Joined: Fri Feb 24, 2012 11:50 am
Re: Calculating joint torques without GRF
It seems like one overall issue you may be running into here is that you're implementing open-loop control, which will quickly accumulate errors during the simulation. I can't say for sure since I don't know your setup exactly, but my guess is that even if you apply too little or too much torque even for a little bit of time, then the rest of the solution will be hard to control.
It may be good to understand what the end goal of this project is. For instance, is it to estimate torque patterns to apply to a device? Perhaps a rough estimate from the inverse tools gives you a good starting point to work from in experiments. Or perhaps is it to find a stable way to control a musculoskeletal model in simulation? You may have to work on something more closed-loop or have more feedback to achieve this.
It may be good to understand what the end goal of this project is. For instance, is it to estimate torque patterns to apply to a device? Perhaps a rough estimate from the inverse tools gives you a good starting point to work from in experiments. Or perhaps is it to find a stable way to control a musculoskeletal model in simulation? You may have to work on something more closed-loop or have more feedback to achieve this.
- Lowell Rose
- Posts: 9
- Joined: Mon Oct 01, 2018 1:48 pm
Re: Calculating joint torques without GRF
I agree that seems like it could be a main problem. However in the GUI when using the same calculated torque through forward dynamics, (which I believe would be considered open-loop control as well?), the suitable motion is found. I believe a main concern still seems to be the presence or lack of passive muscle forces in ID or RRA.
Yes, I'm trying to apply these torque patterns to control a musculoskeletal model in a forward simulation (i.e., where I should not be continuously correcting for the joint error). It's true that the ID tool gives a good starting point, however the presence of passive muscle forces in my forward simulation affects the final pattern. My next step was to look into applying something like a PID controller to solve for the appropriate joint torques then.
Yes, I'm trying to apply these torque patterns to control a musculoskeletal model in a forward simulation (i.e., where I should not be continuously correcting for the joint error). It's true that the ID tool gives a good starting point, however the presence of passive muscle forces in my forward simulation affects the final pattern. My next step was to look into applying something like a PID controller to solve for the appropriate joint torques then.