webots icon indicating copy to clipboard operation
webots copied to clipboard

Improve Node Field Query API

Open CoolSpy3 opened this issue 2 years ago • 0 comments

This issue arises from a discussion occurring on this StackExchange thread which brings up two main issues:

  1. In the current API, there is no way to query the internal fields of a "parent" proto node.

Ex.

PROTO BaseProto [
     unconnectedField internalField
]
{
...
}
PROTO SubProto [
]
{
    BaseProto {
        internalField 1
    }
}

(internalField is inaccessible from SubProto nodes)

  1. The wb_supervisor_node_get_field and wb_supervisor_node_get_proto_field methods are somewhat misleading in that the former retrieves fields defined on a proto node and the latter retrieves fields defined on the base ancestor type.

In the linked thread, @omichel suggests creating wb_supervisor_node_get_proto_parent and querying fields on that object with wb_supervisor_node_get_field.

CoolSpy3 avatar Aug 15 '23 07:08 CoolSpy3