rdiankov / openrave

Open Robotics Automation Virtual Environment: An environment for testing, developing, and deploying robotics motion planning algorithms.
http://www.openrave.org
Other
693 stars 343 forks source link

Add optional `uri` argument for LoadJSON and add ReadRobotJSON and ReadKinBodyJSON #1273

Closed superfashi closed 1 year ago

superfashi commented 1 year ago

This PR adds optional uri argument for LoadJSON.

It also adds ReadRobotJSON and ReadKinBodyJSON for completion.

rdiankov commented 1 year ago

The mechanics of ReadRobotJSON and ReadKinBodyJSON are not consistent with the other Read functions. For some reason, your implementation requires the parts to be already added to the environment.

rdiankov commented 1 year ago

The mechanics of ReadRobotJSON and ReadKinBodyJSON are not consistent with the other Read functions. For some reason, your implementation requires the parts to be already added to the environment.

Particularly, why is the following code necessary if the body is not in the environment:

+            FOREACH(itviewer, _listViewers) {
+                (*itviewer)->RemoveKinBody(robot);
+            }
superfashi commented 1 year ago

The mechanics of ReadRobotJSON and ReadKinBodyJSON are not consistent with the other Read functions. For some reason, your implementation requires the parts to be already added to the environment.

Particularly, why is the following code necessary if the body is not in the environment:

+            FOREACH(itviewer, _listViewers) {
+                (*itviewer)->RemoveKinBody(robot);
+            }

This part of code I just simply copied from other Read[Type] functions. https://github.com/rdiankov/openrave/blame/production/src/libopenrave-core/environment-core.h#L1747-L1757

About the implementation requires the parts to be already added to the environment, that should not be true. I tested and it can parse with empty environment.

rdiankov commented 1 year ago

@superfashi if uri is empty, did you test that the loaded objec'ts GetURI returns just "#XXX"?

rdiankov commented 1 year ago

thanks~