visose / Robots

Create and simulate ABB, KUKA, UR, and Staubli robot programs.
MIT License
301 stars 125 forks source link

[Bug] Internalized Joint parameters disappear when the param is copied. #265

Closed robin-gdwl closed 7 months ago

robin-gdwl commented 8 months ago

Is there an existing issue for this?

What Robots version are you using?

1.6.7

What Rhino version are you using?

Rhino 7 for MacOS

Current Behavior

When copying a "Joints Parameter" with internalized data, the data disappears. This also happens when a file with internalized joint data is closed and reopened. Screenshot 2024-01-29 at 21 03 26

Expected Behavior

The internalised data should be persistent as it is with the other Robots-Parameter.

Steps To Reproduce

Anything else?

No response

visose commented 8 months ago

I never got to finish implementing persistent parameters, so I wouldn't rely on internalizing any Robots parameters. I should've turned them to normal parameters a long time ago to disallow internalizing. Data will be lost on internalized params after saving, closing and opening the document again.

The problem is that the Robots data types are not designed to be (de)serialized. This is particularly important for objects that reference to other objects.

I think at least I should get the Joints parameter to serialize as this is a very simple data type.

The problem with target attributes that seem simple like Speed, Zone, Frame, is that Robots relies on reference equality to check which ones are shared among different targets. If the same attribute gets serialized in multiple places, the instances will stop having reference equality after deserialized (they are now different objects in memory).

I'm actually starting a project soon that uses Robots as a library and will likely benefit from (de)serializing these, so I might have a go at implementing it properly.

robin-gdwl commented 8 months ago

Thank you for the explanation. Makes sense, and the workaround should be easy enough for the joint param. I can simply internalise it as a text parameter.

visose commented 7 months ago

Joint parameters should be able to be internalized in version 1.7.0. Feel free to reopen if not working.