Hi all,
Is there a way to visualize the muscle coloration from the activation file in the MATLAB API? I can do it with the kinematics, but also want the muscles to be changing colors in the video. I have looked through the VisualizerUtilities but don't see anything mentioning the coloration or the states/actuation files.
Also, is there a way to automatically save the video displayed from the MATLAB API with the kinematics/muscle activation? I only saw this thread: viewtopicPhpbb.php?f=91&t=12781&p=36578&start=0&view=, but it doesn't seem like it was fully figured out. I'd like to not have to manually do the "View>Save Movie" on the visualizer for automation purposes.
Thanks.
Reese
MATLAB visualizer- muscle coloration and saving
- Therese Parr
- Posts: 9
- Joined: Mon Dec 02, 2019 9:47 am
- Nicholas Bianco
- Posts: 1050
- Joined: Thu Oct 04, 2012 8:09 pm
Re: MATLAB visualizer- muscle coloration and saving
Hi Reese,
If you can create a TimeSeriesTable that contains both the motion of the model and the muscle activations, then you can use VisualizerUtilities to create a visualization of your simulation (note the comments in the code snippet):
Best,
Nick
If you can create a TimeSeriesTable that contains both the motion of the model and the muscle activations, then you can use VisualizerUtilities to create a visualization of your simulation (note the comments in the code snippet):
Code: Select all
% Whatever model you used to create your simulation.
model = Model('model_file.osim')
model.initSystem();
% This table should contain both coordinates value and speeds and muscle activations.
% Note that muscle excitations (i.e., columns labeled like '/forceset/soleus_r') will not visualize, because they are not states in the model.
% If you're constructing a table and adding the muscle activations that you want to visualize, make sure they have the correct column name (i.e., '/forceset/soleus_r/activation').
statesTable = TimeSeriesTable('table_file.sto')
% Create the visualization.
viz = VisualizerUtilities();
viz.showMotion(model, statesTable);
Unfortunately, no. But if you're looking for a way to stitch together the images that get saved from "View > Save Movie", I recommend FFMPEG.Also, is there a way to automatically save the video displayed from the MATLAB API with the kinematics/muscle activation?
Best,
Nick
- Mohammadreza Rezaie
- Posts: 408
- Joined: Fri Nov 24, 2017 12:48 am
Re: MATLAB visualizer- muscle coloration and saving
Hi, I am a Python user and installed OpenSim[moco] via Conda. When I run either or the console crashes and terminates. Any suggestion on how to get it working? Thank you.
Code: Select all
viz.showModel(model)
Code: Select all
viz.showMotion(model, statesTable)