如何获取嵌套在 Proto 中的 Transform Node 的全局位置

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

尊敬的 Webots 社区,

我目前正在尝试获取 Transform 的全局位置(机器人 body 的附加部分)。 我现在 supervisor_API 提供了获取节点位置的可能性。 但是,如文档中所述:

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

是否有任何方法可以使用主管选项之一(通过 def、通过 id 等)访问 Proto 文件中的节点?[​​=10=]

非常感谢您,

此致

Jan-Felix

根据定义,从 Supervisor 访问 PROTO 的内部节点确实是不可能的。

要获取 PROTO 中任何部分的位置,您可以在 PROTO 中的所需位置包含一个 GPS 节点; GPS API 可以检索 GPS 节点全球位置。

使用最新版本的 Webots,现在可以从 Supervisor 访问 PROTO 的内部节点。您应该使用新的 wb_supervisor_node_get_from_proto_def Supervisor API 功能。一旦获得指向节点的指针,就可以像访问普通节点一样访问其字段。