SoMa-Project / ec_grasp_planner

Grasp Planner Based on Environmental Constraint Exploitation
BSD 3-Clause "New" or "Revised" License
7 stars 3 forks source link

dictionary for specific objects needs .copy() #33

Closed JessyVision closed 6 years ago

JessyVision commented 6 years ago

If a specific object is instantiated from the general object we need to apply the .copy() function. This bug effects the handarm_param.py!

We need to 2x check that in master and the demo branches have this bugfix, otherwise the tuning of a new object will overwrite all object parameters like: self['edge_grasp']['plushtoy'] = self['edge_grasp']['object'].copy()

JannisW commented 6 years ago

I wouldn't call that a bug. It is more the semantic of python ;) So is this issue intended as a reminder to apply the copy() function or should we add some sanity checks that will trigger (throw an exception) in case something is overwritten? (One way to do so would be a call to function in the very end that validates that no two configuration refer to the same object)

Btw. There is a similar risk in massflow.py in soma_utils (when defining the synergie). To mitigate the problem there, I introduced a convenient method called add() that deals with this problem.

zweistein commented 6 years ago

We should keep this in mind and fix all issues if there is any open due to this python feature.

if the sanity check can be implemented fast (few minutes) then please do so. Thanks.

JannisW commented 6 years ago

sanity checks are merged. Can we close the issue now?

zweistein commented 6 years ago

yes, thanks for fixing it.