Page 1 of 1
Implement a smith predictor in simbody
Posted: Sat Jun 04, 2016 4:42 am
by jp123909
hi all,
I want to create a smith predictor to compensate the delay.
I need to construct two multi dynamics system for two models (plant and internal model).
I found some examples for model-based control like Taskspace-U10, but it cant be applied in my research because the output to the actuators based on the feedback information of both two models rather than only the plant model.
Anyone has the experience of implementation of a smith predictor?
thanks in advance,
jiang
Re: Implement a smith predictor in simbody
Posted: Sun Jun 05, 2016 4:36 pm
by sherm
Hi, Jiang. I don't see much difference between the Smith predictor and the task space examples. In each the controller contains an embedded plant model but is initialized from the outer (simulated) model, whose state is passed in (and that state will include the delayed output). Why can't you use the passed-in state, plus the controller's plant model, together to produce actuation on the simulated model? You can pass a reference to the simulated model when you construct the controller so that it will have access to both models.
Sherm
Re: Implement a smith predictor in simbody
Posted: Tue Jun 07, 2016 6:35 am
by jp123909
Hi Sherman,
Thank you for your reply. I think I haven't totally understood the task space control program.
Is there any document which can help me to understand the code?
Thanks a lot,
Jiang
Re: Implement a smith predictor in simbody
Posted: Tue Jun 07, 2016 8:36 am
by sherm
The task space code was developed as part of a DARPA Robotics Challenge subcontract with OSRF. There is a final report from that subcontract that explains the examples. I added it to the examples/shared directory in the Simbody master branch
here.
Sherm
Re: Implement a smith predictor in simbody
Posted: Tue Jun 07, 2016 8:37 am
by sherm
The URL of that document is:
https://github.com/simbody/simbody/blob/master/
examples/shared/DRC_OSRF_TaskSpaceReport.pdf
Re: Implement a smith predictor in simbody
Posted: Sat Jun 11, 2016 8:53 am
by jp123909
Hi Sherman,
Thank you very much for your document.
It advanced my understandings on the code.
I have a question about the function "getDependsOnStageVirtual(int order) const"
in the measurement implementation.
Stage getDependsOnStageVirtual(int order) const
{
return Stage::Velocity;//?
}
How shall I determine which stage I should return? Does it depend on the measurement?
i.e. if the measurement is force info., I should return stage::dynamics. if the measurement is position info., I should return stage::position?
Will it affect the measurement result?
Thanks in advance,
Jiang
Re: Implement a smith predictor in simbody
Posted: Sat Jun 11, 2016 12:31 pm
by sherm
Hi, Jiang. The depends-on stage tells Simbody when the calcCachedValueVirtual() method should be called, based on what calculations it depends on. In the UR10 for example, this method requires that everything up to velocity kinematics has been calculated (meaning time- position- and velocity-dependent quantities). So Simbody won't call calcCachedValueVirtual() for this Measure until those quantities are available. A controller is supposed to generate forces to apply to the model, and forces are calculated at Dynamics stage, so it would be wrong to require Dynamics or Accelerations to be available prior to calculating the controls. (Of course you can do anything you like with the controller-embedded model; this logic applies only to the system that is being simulated.
Regards,
Sherm
Re: Implement a smith predictor in simbody
Posted: Sun Jun 12, 2016 12:34 am
by jp123909
Hi Sherman,
Thank you very much for your rapid reply.
I would like to confirm whether or not my understanding is correct.
If my controller generate forces based on the feedback information of contact forces (measurement), then I should update stage to "Dynamics" ?
Thanks again,
Jiang
Re: Implement a smith predictor in simbody
Posted: Sun Jun 12, 2016 3:39 pm
by sherm
Jiang, you have to think very carefully about dependencies. Most force elements generate forces that are functions of time, position, and velocity. Thus they can be evaluated during Stage::Dynamics, which is the stage at which forces are calculated. Your controller is going to be a force element (that is, its output is used to apply forces to the system), so it should be possible to evaluate it during Stage::Dynamics also. If you say it is dependent on Stage::Dynamics, then it can't be calculated until after that stage. In that case it would be too late to be used as a force itself.
So, let's say you wanted your controller to depend on the force produced by a spring and damper element. Rather than depend on Stage::Dynamics and get the force outputs, you should depend on the position and velocity that are used to determine those force outputs. From Simbody's point of view the spring, damper, and controller output would then all be dependent only on Stage::Velocity.
(On the other hand, there are forces that are actually functions of acceleration like joint reaction forces or reaction forces in constraints. If you write anything that depends on those it must be a constraint so that it can be solved simultaneously with other reaction forces and accelerations.)
Sherm