How can I check attribute value of wrapper class?

Asked by JINSUN LEE

Dear expert on YADE

How can I check the attribute value of wrapper class?

For example, If I assign YADE wrapper class as follow,
-----
 ServoPIDController(maxVelocity=-0.01)
-----
How can I check the attribute value?

I have tried the following command, but I get only memory address of the attribute
-----
In [5]: ServoPIDController.maxVelocity
Out[5]: <property at 0x7f523e31c400>

In [2]: print(ServoPIDController.maxVelocity)
<property object at 0x7fafb98f8400>
-----

Regards.

Question information

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

Hello,

please provide a MWE [1].
E.g. how you use ServoPIDController? standalone, inside O.engines, ...

> How can I check the attribute value of wrapper class?

I **guess** that what you want is the attribute value of an **instance**, not class itself.
There are two approaches, assignment to a variable and using label.
Below are examples, assuming usage of the ServoPIDController in O.engines.

### MWE using assignment
controller1 = ServoPIDController(maxVelocity=2)
O.engines = [
    controller1,
]
print(controller1.maxVelocity)
###

### MWE using label
O.engines = [
    ServoPIDController(maxVelocity=3,label="controller2"),
]
print(controller2.maxVelocity)
###

Cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask

Revision history for this message
JINSUN LEE (ppk21) said :
#2

Thanks a lot!