2

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

2 Answers2

3

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.

FabienRohrer
  • 1,794
  • 2
  • 15
  • 26
1

With the latest versions of Webots, it is now possible to access internal nodes of a PROTO from a Supervisor. You should use the new wb_supervisor_node_get_from_proto_def Supervisor API function. Once you obtained a pointer to the node, you can access its fields as you would do it for a normal node.

Olivier Michel
  • 755
  • 6
  • 10