Implement a smith predictor in simbody

Simbody is useful for internal coordinate and coarse grained molecule modeling, large scale mechanical models like skeletons, and anything else that can be modeled as bodies interconnected by joints, acted upon by forces, and restricted by constraints.
POST REPLY
User avatar
Jiang Ping
Posts: 132
Joined: Sun Aug 26, 2012 4:09 am

Implement a smith predictor in simbody

Post by Jiang Ping » Sat Jun 04, 2016 4:42 am

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

User avatar
Michael Sherman
Posts: 804
Joined: Fri Apr 01, 2005 6:05 pm

Re: Implement a smith predictor in simbody

Post by Michael Sherman » Sun Jun 05, 2016 4:36 pm

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

User avatar
Jiang Ping
Posts: 132
Joined: Sun Aug 26, 2012 4:09 am

Re: Implement a smith predictor in simbody

Post by Jiang Ping » Tue Jun 07, 2016 6:35 am

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

User avatar
Michael Sherman
Posts: 804
Joined: Fri Apr 01, 2005 6:05 pm

Re: Implement a smith predictor in simbody

Post by Michael Sherman » Tue Jun 07, 2016 8:36 am

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

User avatar
Michael Sherman
Posts: 804
Joined: Fri Apr 01, 2005 6:05 pm

Re: Implement a smith predictor in simbody

Post by Michael Sherman » Tue Jun 07, 2016 8:37 am

The URL of that document is:
https://github.com/simbody/simbody/blob/master/
examples/shared/DRC_OSRF_TaskSpaceReport.pdf

User avatar
Jiang Ping
Posts: 132
Joined: Sun Aug 26, 2012 4:09 am

Re: Implement a smith predictor in simbody

Post by Jiang Ping » Sat Jun 11, 2016 8:53 am

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

User avatar
Michael Sherman
Posts: 804
Joined: Fri Apr 01, 2005 6:05 pm

Re: Implement a smith predictor in simbody

Post by Michael Sherman » Sat Jun 11, 2016 12:31 pm

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

User avatar
Jiang Ping
Posts: 132
Joined: Sun Aug 26, 2012 4:09 am

Re: Implement a smith predictor in simbody

Post by Jiang Ping » Sun Jun 12, 2016 12:34 am

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

User avatar
Michael Sherman
Posts: 804
Joined: Fri Apr 01, 2005 6:05 pm

Re: Implement a smith predictor in simbody

Post by Michael Sherman » Sun Jun 12, 2016 3:39 pm

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

POST REPLY