SCONE_feedforward controller for joint
- Samane Amini
- Posts: 100
- Joined: Sun Jan 12, 2020 3:48 am
SCONE_feedforward controller for joint
Hi guys
I would like to add a feedforward controller as polynominal to ankle joint at gait contoller as following:
ConditionalController {
states = "EarlyStance LateStance, Liftoff,Swing Landing"
Controller {
type = FeedForwardController
symmetric = 1
Function {
type = Polynomial
source = ankle_angle
degree = 8
coefficient0 = #
coefficient1 = #
coefficient2 = #
coefficient3 = #
coefficient4 = #
coefficient5 = #
coefficient6 = #
coefficient7 = #
coefficient8 = #
}
}
Although there isn't any error meanwhile the optimizaton, but cost function is not changed at all!! . in fact, I want optimizae muscle forces, but it doesn't work.
Would you please point outed me where I make a mistake?
Thanks
}
I would like to add a feedforward controller as polynominal to ankle joint at gait contoller as following:
ConditionalController {
states = "EarlyStance LateStance, Liftoff,Swing Landing"
Controller {
type = FeedForwardController
symmetric = 1
Function {
type = Polynomial
source = ankle_angle
degree = 8
coefficient0 = #
coefficient1 = #
coefficient2 = #
coefficient3 = #
coefficient4 = #
coefficient5 = #
coefficient6 = #
coefficient7 = #
coefficient8 = #
}
}
Although there isn't any error meanwhile the optimizaton, but cost function is not changed at all!! . in fact, I want optimizae muscle forces, but it doesn't work.
Would you please point outed me where I make a mistake?
Thanks
}
- Thomas Geijtenbeek
- Posts: 432
- Joined: Wed Mar 12, 2014 8:08 am
Re: SCONE_feedforward controller for joint
Did you add your ConditionalController as part of the GaitStateController? If so, it should be be activated. An easy way to check is to set coefficient0 = 1 and see if it is activated.
Also note that "source = ankle_angle" is not a valid setting for a FeedForwardController. Feedforward controllers do not have a source input, their output is always a function of time.
If you want to apply a torque based on the ankle_angle, I suggest you use a ScriptController. Please look at the Script Examples for more information.
Finally, note that degree=8 is very high. If you use a polynomial, I would advise to start with degree=1 or degree=2, and only increase the degree afterwards to see if it improves the result.
Also note that "source = ankle_angle" is not a valid setting for a FeedForwardController. Feedforward controllers do not have a source input, their output is always a function of time.
If you want to apply a torque based on the ankle_angle, I suggest you use a ScriptController. Please look at the Script Examples for more information.
Finally, note that degree=8 is very high. If you use a polynomial, I would advise to start with degree=1 or degree=2, and only increase the degree afterwards to see if it improves the result.
- Samane Amini
- Posts: 100
- Joined: Sun Jan 12, 2020 3:48 am
Re: SCONE_feedforward controller for joint
Hello Thomas
Thank you for helping
in fact, ankle_angle is the target. I've edited it.
Now I want to know if how to import a polynomial, Fourier, or spline torque profile to the joint? the low degree polynomial wouldn't be true in my case.
Thanks
Thank you for helping
in fact, ankle_angle is the target. I've edited it.
Now I want to know if how to import a polynomial, Fourier, or spline torque profile to the joint? the low degree polynomial wouldn't be true in my case.
Thanks
- Thomas Geijtenbeek
- Posts: 432
- Joined: Wed Mar 12, 2014 8:08 am
Re: SCONE_feedforward controller for joint
The coefficients you'll have to find yourself, using matlab, or numpy, or any other tool of your liking.
Since you only need to specify a short torque profile per gait phase (e.g. one for stance and one for swing), a low-degree polynomial should suffice.
Since you only need to specify a short torque profile per gait phase (e.g. one for stance and one for swing), a low-degree polynomial should suffice.
- Samane Amini
- Posts: 100
- Joined: Sun Jan 12, 2020 3:48 am
Re: SCONE_feedforward controller for joint
Hi Thomas
I would like to implement polynomial to Stance phase. But an error has been made. Do you what's the problem? for swing there is no error.
ConditionalController {
states = Stance
Controller {
type = FeedForwardController
symmetric = 1
Function {
type = Polynomial
target = ankle_angle
degree = 4
coefficient0 = #
coefficient1 = #
coefficient2 = #
coefficient3 = #
coefficient4 = #
}
}
}
I would like to implement polynomial to Stance phase. But an error has been made. Do you what's the problem? for swing there is no error.
ConditionalController {
states = Stance
Controller {
type = FeedForwardController
symmetric = 1
Function {
type = Polynomial
target = ankle_angle
degree = 4
coefficient0 = #
coefficient1 = #
coefficient2 = #
coefficient3 = #
coefficient4 = #
}
}
}
- Thomas Geijtenbeek
- Posts: 432
- Joined: Wed Mar 12, 2014 8:08 am
Re: SCONE_feedforward controller for joint
"Stance" is not a valid state, you should instead use:
Code: Select all
states = "EarlyStance LateStance"
- Samane Amini
- Posts: 100
- Joined: Sun Jan 12, 2020 3:48 am
Re: SCONE_feedforward controller for joint
Hello Thomas
As I said, I'd like to apply a torque polynomial to the ankle joint. I've generated two polynomials (swing and stance) according to time. Swing one works well at the first swing but gradually goes up at the next swing. And stance one doesn't work. Do you think what's the problem?
I was wondering how to define the torque based on ankle angle (gait phase) through script controller
Would you please help me to fix it?
Best
As I said, I'd like to apply a torque polynomial to the ankle joint. I've generated two polynomials (swing and stance) according to time. Swing one works well at the first swing but gradually goes up at the next swing. And stance one doesn't work. Do you think what's the problem?
I was wondering how to define the torque based on ankle angle (gait phase) through script controller
Would you please help me to fix it?
Best
- Thomas Geijtenbeek
- Posts: 432
- Joined: Wed Mar 12, 2014 8:08 am
Re: SCONE_feedforward controller for joint
If your FeedForwardController is part of a GaitStateController, then time starts from zero for each new phase. You can check the actuator inputs in the Analysis view to see what's happening. If the Controller isn't stable and stays in swing, then time will indeed continue and the signal might increase. You might need to optimize your control parameters to get a stable gait. It could also help to start of with relatively small polynomial coefficients.
For adding torques via the script controller, please look at the Script Tutorials. These examples show how to compute polynomials based on time, how to get dof values (i.e. ankle angle), and how to set actuator inputs via a Script.
For adding torques via the script controller, please look at the Script Tutorials. These examples show how to compute polynomials based on time, how to get dof values (i.e. ankle angle), and how to set actuator inputs via a Script.
- Thomas Geijtenbeek
- Posts: 432
- Joined: Wed Mar 12, 2014 8:08 am
Re: SCONE_feedforward controller for joint
Another potential issue: if you have multiple controllers in a single state in your GaitStateController, then you should use define them inside a single CompositeController, e.g.:
Code: Select all
ConditionalController {
states = "EarlyStance LateStance"
CompositeController {
FeedForwardController { ... }
ReflexController { ... }
}
}
- Samane Amini
- Posts: 100
- Joined: Sun Jan 12, 2020 3:48 am
Re: SCONE_feedforward controller for joint
Thank you very much Thomas
by replacing the controller with CompositeController, It works extremely well![Smile :)](./images/smilies/icon_e_smile.gif)
Now to getting better, I would like to optimize the profile torque coefficients so that these are tuned based on a new cost function. Would you please guide me how to define another cost function which is differ from main fitness function?
Best
by replacing the controller with CompositeController, It works extremely well
![Smile :)](./images/smilies/icon_e_smile.gif)
Now to getting better, I would like to optimize the profile torque coefficients so that these are tuned based on a new cost function. Would you please guide me how to define another cost function which is differ from main fitness function?
Best