Hi everyone,
I’m working on a program node contribution that generates a set of child nodes upon construction; some of those children are fixed waypoints. My problem is that when I create the second instance, fixed waypoints get created as Waypoint_1
, Waypoint_2
, etc instead of using the suggested name and a prefix.
Software version: Polyscope 5.3; SDK 1.6.1.
Robot generation: N/A
Steps to reproduce:
Minimal code:
// This code is unside UndoableChanges#executeChanges; the code is executed in a class that extends ProgramNodeContribution in its constructor.
// We assume that the root node and the node factory are already available using APIProvider and ProgramModel.
MoveNode customMoveJ = nodeFactory.createMoveNodeNoTemplate();
customMoveJ.setConfig(customMoveJ.getConfigBuilders().createMoveJConfigBuilder().build());
TreeNode customMoveJTreeNode = rootTreeNode.addChild(customMoveJ);
WaypointNode customWaypoint = nodeFactory.createWaypointNode("custom_waypoint");
System.out.println("Adding custom waypoint: " + customWaypoint.toString());
TreeNode customWaypointTreeNode = customMoveJTreeNode.addChild(customWaypoint);
System.out.println("Added custom waypoint: " + customWaypointTreeNode.getProgramNode().toString());
Expected behavior:
The first time I create the program node, I should see the following output:
Adding custom waypoint: custom_waypoint
Added custom waypoint: custom_waypoint
The second time I create the program node, I should see the following output:
Adding custom waypoint: custom_waypoint
Added custom waypoint: custom_waypoint_1
And in the program tree, I should see a MoveJ
with a child waypoint called custom_waypoint_1
.
Actual behavior:
The first time I create the program node, I see the following output:
Adding custom waypoint: custom_waypoint
Added custom waypoint: custom_waypoint
The second time I create the program node, I see the following output:
Adding custom waypoint: custom_waypoint
The new name Waypoint_1 is already registered. // This is printed by SDK code, not user code.
Added custom waypoint: Waypoint_1
And in the program tree, I see a MoveJ
with a child waypoint called Waypoint_1
.
Extra info: If after creating the two instances, I delete the nodes using Polyscope’s UI and create a new one once again, the waypoint is created and added correctly to the program tree.
I’ve also seen that in the ellipse sample, generating a set of fixed waypoints works as expected when more than one instance of the root node are created. However, I could not find the error in my code so far, and the code is quite simple.
Is there something obvious that I’m missing, or could this be a genuine bug?
Any help and hints are greatly appreciated; thanks in advance!