Control strategies for functional electrical stimulation (FES) cycling Public Forum

Functional Electrical Stimulation Cycling (FES Cycling) is a rehabilitation technique that allows a spinal cord injured (SCI) volunteer to ride a bicycle contracting his/her muscles. This project provides a model and several scripts to test and develop th
User avatar
SimTK Admin
Site Admin
Posts: 336
Joined: Tue Mar 15, 2011 12:32 pm

Control strategies for functional electrical stimulation (FES) cycling Public Forum

Post by SimTK Admin » Fri Jul 20, 2018 3:23 pm

Welcome to the Control strategies for functional electrical stimulation (FES) cycling public forum. Feel free to browse or search the topics for helpful information, or post a topic of your own.

User avatar
Sam Kazemi
Posts: 1
Joined: Thu Apr 04, 2019 4:36 am

Re: Control strategies for functional electrical stimulation (FES) cycling Public Forum

Post by Sam Kazemi » Sun Apr 07, 2019 7:30 am

To whom it may concern
I am writing to inquire about getting help, because I am new in Opensim, and without your help, I could not solve my university project. With respect to you and your great file, could you please help me to change the situation of sitting and duration of FES pulse? I look forward to hearing from you
Sincerely

User avatar
Ana de Sousa
Posts: 67
Joined: Thu Apr 07, 2016 4:21 pm

Re: Control strategies for functional electrical stimulation (FES) cycling Public Forum

Post by Ana de Sousa » Fri Jun 14, 2019 2:09 pm

Hello Sam,

I did not understand what you mean by "sitting".

About the durantion of the pulse, this is a simulation in which we approximate the FES stimulation as the excitation of the muscle. In OpenSim this excitation goes from 0 to 1 (1 being the maximum force that the muscle generates). Therefore, we do not specifically change pulse width.

We change the excitation in cycling_control.m:

Code: Select all

    % assing excitation to muscles
    for i = 1:length(musclesNames)
        if strcmp(musclesNames{i},'rect_fem_r')
            thisExcitation = Vector(1, quadRight);
        elseif strcmp(musclesNames{i},'vas_int_r')
            thisExcitation = Vector(1, quadRight);
        elseif strcmp(musclesNames{i},'rect_fem_l')
            thisExcitation = Vector(1, quadLeft);
        elseif strcmp(musclesNames{i},'vas_int_l')
            thisExcitation = Vector(1, quadLeft);
		elseif strcmp(musclesNames{i},'hamstrings_l')
            thisExcitation = Vector(1, hamsLeft);		
		elseif strcmp(musclesNames{i},'hamstrings_r')
            thisExcitation = Vector(1, hamsRight);
		elseif strcmp(musclesNames{i},'glut_max_r')
            thisExcitation = Vector(1, glutRight);		
		elseif strcmp(musclesNames{i},'glut_max_l')
            thisExcitation = Vector(1, glutLeft);
        else
            thisExcitation = Vector(1, ZERO);
        end
        % update modelControls with the new values
        if thisExcitation ~= ZERO
            osimModel.updActuators().get(musclesNames{i}).addInControls(thisExcitation, modelControls);
        end
    end
We look the for muscle and add the control signal related to that muscle.

User avatar
TARUN KARAK
Posts: 2
Joined: Mon Dec 10, 2018 2:54 am

Re: Control strategies for functional electrical stimulation (FES) cycling Public Forum

Post by TARUN KARAK » Mon Jun 24, 2019 12:30 am

Dear sir/mam,
can you please guide me in step by step how to use or run this model as I am very new in OpenSim.
Thank Regards
Tarun Karak

User avatar
Ana de Sousa
Posts: 67
Joined: Thu Apr 07, 2016 4:21 pm

Re: Control strategies for functional electrical stimulation (FES) cycling Public Forum

Post by Ana de Sousa » Tue Jun 25, 2019 12:43 pm

Hello Tarun Karak, the first step is to follow the instructions to script with Matlab available at https://simtk-confluence.stanford.edu:8 ... ith+Matlab.

And after downloading our package, you should follow the steps in README.txt.

In case you have any specific problems, we could look for solutions.

User avatar
Yasniary Morales
Posts: 4
Joined: Mon Jan 06, 2020 7:10 am

Re: Control strategies for functional electrical stimulation (FES) cycling Public Forum

Post by Yasniary Morales » Mon Jan 27, 2020 7:57 am

Hello,
When I open the FES Cycling Model on OpenSim, many parts of the model don't appear and I am receiving messages that say "Couldn 't find file 'femur.vtp'", "Couldn't find file 'l_tibia'",etc. . How do I resolve this?
Kind Regards,
Yasniary Morales

User avatar
Ana de Sousa
Posts: 67
Joined: Thu Apr 07, 2016 4:21 pm

Re: Control strategies for functional electrical stimulation (FES) cycling Public Forum

Post by Ana de Sousa » Fri Aug 28, 2020 7:35 am

Hello, Yasniary,

I don't receive notifications about this forum, that is why I did not answer prior.
Those are parts of the model that usually get installed with OpenSim 3.3. I have tested with OpenSim 4.1, but they don't seem to be in the usual place. What I did to open the model, was to copy and paste these parts to the same location of the osim model.

However, I don't think that all functions will work with OpenSim 4.1, there are some differences. So, I suggest using 3.3.

User avatar
Yuya Miyazaki
Posts: 16
Joined: Tue May 11, 2021 8:45 pm

Re: Control strategies for functional electrical stimulation (FES) cycling Public Forum

Post by Yuya Miyazaki » Thu Jul 15, 2021 12:39 am

Hello, I am university student.

I using this model(FEScycling), thank you.
However, there is something I don't understand.
How do you control the load on the pedals?
For example, if you increase the load on the pedals, it will be harder to cycle.

I use a translator for this.
kind regards.

User avatar
Ana de Sousa
Posts: 67
Joined: Thu Apr 07, 2016 4:21 pm

Re: Control strategies for functional electrical stimulation (FES) cycling Public Forum

Post by Ana de Sousa » Thu Jul 15, 2021 6:36 pm

Hi, Yuya Miyazaki!

I'm glad you are using the model.

Your question: "How do you control the load on the pedals?"

1. In CyclingLibrary/cycling_control_v2.m, I first calculate the load in line 150:

Code: Select all

[thisLoad] = gear_load_v2(thisVel,flagLoad,flagMotor,thisTime);
2. I update a vector with this new calculated thisLoad in line 261 (this is an optional step, I only do that for saving all values calculated for later plots):

Code: Select all

controlActionLoad(controlIteration) = thisLoad;
3. The line of code that actually updates the crank actuator is in 307:

Code: Select all

osimModel.updActuators().get('gear_load').addInControls(Vector(1, controlActionLoad(controlIteration)), modelControls);
It gets the gear_load part from the model and adds to the control the values from Vector.
controlIteration is the current iteration value. You can substitute controlActionLoad(controlIteration)) for thisLoad, if you decide to skip step 2.

Cheers!
Ana

User avatar
Yuya Miyazaki
Posts: 16
Joined: Tue May 11, 2021 8:45 pm

Re: Control strategies for functional electrical stimulation (FES) cycling Public Forum

Post by Yuya Miyazaki » Sun Jul 18, 2021 11:27 pm

Thank you for reply ana.

Does it mean that I can change the value of "gear_load" in the actuator field to control the resistance of the pedal?

I use a translator.
kind regards.

POST REPLY