diff --git a/ros_numpy/src/ros_numpy/registry.py b/ros_numpy/src/ros_numpy/registry.py index 5442b93..9d10cfe 100644 --- a/ros_numpy/src/ros_numpy/registry.py +++ b/ros_numpy/src/ros_numpy/registry.py @@ -34,10 +34,16 @@ def numpify(msg, *args, **kwargs): if not conv: - raise ValueError("Unable to convert message {} - only supports {}".format( - msg.__class__.__name__, - ', '.join(cls.__name__ + ("[]" if pl else '') for cls, pl in _to_numpy.keys()) - )) + for class_instance, _ in _to_numpy.keys(): + if msg._type == class_instance._type: + if msg._md5sum == class_instance._md5sum: + conv = _to_numpy.get((class_instance, False)) + break + else: + raise ValueError("Unable to convert message {} - only supports {}".format( + msg.__class__.__name__, + ', '.join(cls.__name__ + ("[]" if pl else '') for cls, pl in _to_numpy.keys()) + )) return conv(msg, *args, **kwargs)