Getting component from simulation node property

You are on the right track by asking questions.

In Python API reference, vcComponent inherits vcNode. A component is also a node, i.e. the root node of component, which is why “comp.Node.Name” and “Node.Component.Name” would return same result in this example.

The “comp.Node.Component” in my example was just to highlight what is happening there and how it is good to be aware of recursion and recursive loops, especially with nodes in simulation and robot statements.

About the function example, you are correct, and I would suggest you stick to calling the functions directly unless there is some design decision in which you want to use that approach. Assigning the function to variable just demonstrates the function is a first-class citizen. I have seen it done maybe a few times with lambda functions and with event handlers. As for tuck tuck, I misspelled tuk tuk. For some reason, I was thinking of white sandy beaches, a cold beer and a tasty curry at the time.

1 Like