diff --git a/setup.py b/setup.py index 7c0b4eb..ce5188b 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ setup( name="zeroros", - version="1.0.2", + version="1.0.4", description="ZeroROS middleware", long_description=long_description, long_description_content_type="text/markdown", diff --git a/src/zeroros/publisher.py b/src/zeroros/publisher.py index 4665aa3..81b3577 100644 --- a/src/zeroros/publisher.py +++ b/src/zeroros/publisher.py @@ -14,8 +14,10 @@ def __init__( message_class: type[Message], ip: str = "127.0.0.1", port: int = 5555, + verbose: bool = False, ): - print("Creating publisher for topic: ", topic) + if verbose: + print("Creating publisher for topic: ", topic) self.topic = validate_topic(topic) self.message_class = message_class self.ip = ip diff --git a/src/zeroros/subscriber.py b/src/zeroros/subscriber.py index 272cff6..8f78f85 100644 --- a/src/zeroros/subscriber.py +++ b/src/zeroros/subscriber.py @@ -18,10 +18,13 @@ def __init__( callback_handle: callable, ip: str = "127.0.0.1", port: int = 5556, + verbose: bool = False, ): self.ip = ip self.port = port - print("Subscribing to topic: ", topic) + self.verbose = verbose + if self.verbose: + print("Subscribing to topic: ", topic) self.topic = validate_topic(topic) self.message_class = message_class self.url = "tcp://" + str(self.ip) + ":" + str(self.port) @@ -47,7 +50,8 @@ def listen(self, callback_handle: callable): except Exception as e: print(f"Error for topic {self.topic} on {self.ip}:{self.port}: {e}") time.sleep(0.05) - print("Stopping subscriber") + if self.verbose: + print("Stopping subscriber") # Check if the socket is still open if self.sock.closed is False: self.sock.close()