compas icon indicating copy to clipboard operation
compas copied to clipboard

RobotModel.data doesn't contain all necessary data

Open beverlylytle opened this issue 3 years ago • 2 comments

Describe the bug Some data is missing from in RobotModel.data making the serialization of instances of this class faulty. In particular, if a RobotModel is loaded from a urdf that contains gazebo or other nonstandard tags, some information will be lost upon serialization followed by deserialization. This is exposed by attempting to write the reserialized RobotModel to URDF.

To Reproduce Steps to reproduce the behavior:

  1. Run the following script:
import copy

from compas.files import URDF
from compas.robots import RobotModel
import compas_fab

filepath = compas_fab.get('universal_robot/ur_description/urdf/ur5.urdf')
model = RobotModel.from_urdf_file(filepath)
model_copy = RobotModel.from_data(model.data)
# model_copy = copy.deepcopy(model)
urdf = URDF.from_robot(model_copy)

(Though this script imports compas_fab, it is only for accessing a particular URDF. The relevant code lies in compas.)

Expected behavior This should result in the creation of a valid URDF instance, however an exception is thrown about a URDFGenericElement not having a tag. This is because the protected attribute _urdf_source (or the inferred attribute tag) is not included in data.

beverlylytle avatar Jan 06 '21 09:01 beverlylytle

is this still a thing?

tomvanmele avatar Nov 09 '21 07:11 tomvanmele

Yes.

beverlylytle avatar Nov 09 '21 13:11 beverlylytle

robots no longer in compas core...

tomvanmele avatar Apr 23 '24 07:04 tomvanmele