A problem with using the ServoPIDController() function

Asked by wangkaichao

Hello everyone,

I am writing to seek help with using the Yade from source code on Ubuntu 22.04. The source code was downloaded on February 23, 2023. 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?

Please help me to solve the above mentioned problem.
Thanks in advance,
Regards,
Wang

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

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

Can you help with this problem?

Provide an answer of your own, or ask wangkaichao for more information if necessary.

To post a message you must log in.