webots

How to obtain the global position of Transfom Node nested inside a Proto


Dear Webots community,

I'm currently trying to obtain the global position of a Transform (An attached part of a robot's body). I now that the supervisor_API gives the possibility to get the position of a node. However, as stated in in the documentation:

"If the requested node does not exist in the current world file or is an internal node of a PROTO, the function returns NULL"

Is there any way to access the nodes inside a Proto file using one of the supervisor options (by def, by id, etc.)?

Thank you very much in advance,

Best regards

Jan-Felix


Solution

  • It's indeed not possible by definition to access the internal nodes of a PROTO from a Supervisor.

    To get the position of any part inside a PROTO, you could include a GPS node where you want in the PROTO; the GPS API can retrieve the GPS node global position.