ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
hi, guys i figure it out ... in ros when we initial the parameters, like position2 = Point(), the hash value is change. however, intersection method compare both hash value and it's value, so what we can do is build a new class just compare value without hash value. OR the other method is rebuild the hash value by yourself, such as Ninja Puppy's suggestion:
class NewPoint(Point):
def __hash__(self):
return hash(self.x) # maybe self.y as well?
2 | No.2 Revision |
hi, guys i figure it out ... in ros when we initial the parameters, like position2 = Point(), Point() and deepcopy, the hash value is change. however, intersection method compare both hash value and it's value, so what we can do is build a new class just compare value without hash value. OR the other method is rebuild the hash value by yourself, such as Ninja Puppy's suggestion:
class NewPoint(Point):
def __hash__(self):
return hash(self.x) # maybe self.y as well?