It is working well now thank you so much!!!
If I may ask another question, I am only interested in the ground reaction forces, not joint torques. Can I easily remove a part of the code from example_kinetics.py to make it run faster?
Right now, I've modified example_kinetics.py and it looks like this (I didn't change the beginning of the example):
# Path to where you want the data to be downloaded.
dataFolder = os.path.join(baseDir, 'Data')
# %% Setup.
if not 'time_window' in locals():
time_window = None
if not 'repetition' in locals():
repetition = None
if not 'treadmill_speed' in locals():
treadmill_speed = 0
settings = processInputsOpenSimAD(baseDir, dataFolder, session_id, trial_name,
motion_type, time_window, repetition,
treadmill_speed)
# %% Simulation.
run_tracking(baseDir, dataFolder, session_id, settings, case=case,
solveProblem=solveProblem, analyzeResults=analyzeResults)
# Retrieve results from the optimal solution using utilsKineticsOpenSimAD.
output_csv_dir = os.path.join(dataFolder, session_id, 'OpenSimData', 'Dynamics')
output_path = os.path.join(output_csv_dir, 'grfs_{}.csv'.format(trial_name))
opt_sol_obj = kineticsOpenSimAD(dataFolder, session_id, trial_name, case, repetition=repetition)
grfs = opt_sol_obj.get_ground_reaction_forces()
grfs.to_csv(output_path)
# %% Plots.
# To compare different cases, add to the cases list, eg cases=['0','1'].
# plotResultsOpenSimAD(dataFolder, session_id, trial_name, settings, cases=[case])
Best,
Camille
CMake error when running example_kinetics
- Camille Frayssinhes
- Posts: 13
- Joined: Thu Nov 16, 2023 9:42 am
- Antoine Falisse
- Posts: 438
- Joined: Wed Jan 07, 2015 2:21 am
Re: CMake error when running example_kinetics
Hi,
You can make the problem run faster by using a torque-driven model instead of a muscle-driven model, see this example: https://github.com/stanfordnmbl/opencap ... cs.py#L152. You will still get the joint torques, but excluding the muscle dynamics should make things faster.
Antoine
You can make the problem run faster by using a torque-driven model instead of a muscle-driven model, see this example: https://github.com/stanfordnmbl/opencap ... cs.py#L152. You will still get the joint torques, but excluding the muscle dynamics should make things faster.
Antoine
- Logan Wade
- Posts: 9
- Joined: Tue May 25, 2021 7:23 am
Re: CMake error when running example_kinetics
Hi Antoine,
I just wanted to check if the torque driven only model can be used for walking, or running only? I note here that this script you linked only seems to have the option for running. Is this because running only has a single contact point with the ground, whereas walking has two contact points and therefore a torque driven model is not possible?
I was also wondering if you could explain the difference between generating muscle-driven simulations of walking using the method in this script you linked and the example method in the Moco folder?
Thanks!
Logan
I just wanted to check if the torque driven only model can be used for walking, or running only? I note here that this script you linked only seems to have the option for running. Is this because running only has a single contact point with the ground, whereas walking has two contact points and therefore a torque driven model is not possible?
I was also wondering if you could explain the difference between generating muscle-driven simulations of walking using the method in this script you linked and the example method in the Moco folder?
Thanks!
Logan
- Matt Petrucci
- Posts: 166
- Joined: Fri Feb 24, 2012 11:49 am
Re: CMake error when running example_kinetics
Hi Logan,
We do have an example of walking here where it gives you both a torque-driven and muscle-driven solution top compare: https://github.com/stanfordnmbl/opencap ... ensimAD.py. You can try using the same setups for a different motion, you just may have to play with the weights depending on what you are trying to simulate.
There a few differences between the two methods. Some of these just come down to the difference in software and how to implement the problem (e.g., how to enforce constraints, what muscles are used, etc.). You could run each simulation (OpenSimAD and Moco) and see if you get different results, and if that affects what you are looking at for you research question.
Hope this helps,
We do have an example of walking here where it gives you both a torque-driven and muscle-driven solution top compare: https://github.com/stanfordnmbl/opencap ... ensimAD.py. You can try using the same setups for a different motion, you just may have to play with the weights depending on what you are trying to simulate.
There a few differences between the two methods. Some of these just come down to the difference in software and how to implement the problem (e.g., how to enforce constraints, what muscles are used, etc.). You could run each simulation (OpenSimAD and Moco) and see if you get different results, and if that affects what you are looking at for you research question.
Hope this helps,