webots icon indicating copy to clipboard operation
webots copied to clipboard

Robot inside a Robot is not well supported if Robot.name is not unique

Open omichel opened this issue 2 years ago • 1 comments

Webots allows users to set a Robot node inside children list of another Robot node. It is allowed to have robot named "Paul" at the root level and another robot named "Paul" at a lower level, e.g., inside another Robot or Solid. Also, it is allowed to have another robot named "Paul" inside a different Robot or Solid, like. The only rule is that a solid (possibly a robot) cannot have the same name as another sibling solid, e.g., in the same children list). So the following is legal:

Robot { name "Paul" }
Robot { name "John" children Robot { name "Paul" }
Robot { name "Lea" children Robot { name "Paul" }
Solid { name "door" chidlren Robot { name "Paul" }

While this is illegal:

Robot { name "Paul"}
Robot { name "Paul"}

This is also illegal:

Robot { name "Paul" children [ Robot { name "Lea" } Robot { name "Lea" } ] }

Currently, this doesn't work, see for example #4679 where we had:

Robot { name "robot" }
Robot { name "vehicle" children Robot { name "robot" }

And this was confusing Webots because it was attempting to connect an extern controller.

Moreover, there is no way to tell that we want to connect to a Robot inside another Robot. Maybe we could extend the WEBOTS_CONTROLLER_URL format to support the following form: ipc://Lea/Paul:1234 to connect to a robot named "Paul" located inside a robot named "Lea".

omichel avatar Jun 17 '22 13:06 omichel

Device perspectives in project files have a similar issue. Currently only the ancestor robot name is printed in the WBPROJ file, but if the same name is used at different levels it may not be possible to uniquely define the robot. and restore the correct perspectives If a solution is implemented for the extern controller, it might be good to apply the same one also for the perspectives.

stefaniapedrazzi avatar Jul 12 '22 08:07 stefaniapedrazzi