← Back to team overview

yade-users team mailing list archive

Re: [Question #706118]: A problem with using the ServoPIDController() function

 

Question #706118 on Yade changed:
https://answers.launchpad.net/yade/+question/706118

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hello,

> The source code was downloaded on February 23, 2023.

please provide version you are using [1], not date you have downloaded
it.

> The ServoPIDController() function was used in my code ...

please provide the code [1]

> The ServoPIDController() function was used in my code as follows: ServoPIDController(axis=[0,0,1],maxVelocity=2.0,iterPeriod=50,ids=[10],target=12000,kP=0.001,kI=0.0001,kD=0.001). 
> But now if I want to set the target value in the ServoPIDController() function to be a sine function of time, how do I set the target?

There are more options, one is using labels and PyRunner [2], something like:
###
O.engines = [
    ...
    ServoPIDController(...,label="controller"),
    PyRunner(iterPeriod=1,command="setTarget()"),
]

def setTarget():
    controller.target = sin(O.time)
###

Cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask
[2] https://yade-dem.org/doc/tutorial-examples.html

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.