Non mutable states #78
Replies: 2 comments 1 reply
-
I agree that non mutable objects would be a good idea to avoid errors and the user would be forced to use the library like we intend it to. Otherwise there are no limits to what a State can be and can be transformed to 😄 |
Beta Was this translation helpful? Give feedback.
-
+1 for reducing setters and keeping instantiated objects consistent / less mutable. This matches my current usage pattern of the library; I make an object to represent a particular state (for example end-effector in robot frame), and consistently refer to that object as "ee_in_robot" or similar. If I then need a different representation (say end-effector in optitrack frame), I prefer to create a new object "ee_in_optitrack" from the transform operation. In this way I have both objects still available for control / logging purposes, and my code is more readable because the variable names stay consistent. The contrasting case is to use a single |
Beta Was this translation helpful? Give feedback.
-
One of the idea that come up due to PR #65 is changing the design of
State
and derivatives to have non mutable objects, i.e. there should be valid from construction and things likeset_name(new_name)
orset_reference_frame(new_ref)
should not be possible unless associated with the correct operations (mainly transformations withCartesianPose
). I do think this would avoid a lot of confusions / errors while also reducing the getters and setters hence the inline functions.Beta Was this translation helpful? Give feedback.
All reactions