Replies: 2 comments
-
Hi @chisarie, In the default Zenoh configuration the timestamps are added by routers, I guess in your case you have a peer-to-peer topology without any router.
Source: https://github.com/eclipse-zenoh/zenoh/blob/master/DEFAULT_CONFIG.json5#L75 With thin configuration |
Beta Was this translation helpful? Give feedback.
-
Thank you very much Gabriele, it works! I have one additional question: what is the recommended way to handle a large numpy array whose shape is not known a priori? # Publisher
pub = session.declare_publisher(key)
value = np.random.randint(low=15, high=30, size=(2, 2))
pub.put(value.tobytes(), metadata={"shape": value.shape})
# Subscriber
def callback(sample: zenoh.Sample):
# To decode back the numpy array, we need to know its shape and dtype
value = np.frombuffer(sample.payload, dtype=np.int64).reshape(sample.metadata.shape)
print(f"Received {sample.kind} ('{sample.key_expr}': '{value}')")
sub = session.declare_subscriber(key, callback) Thank you again :) |
Beta Was this translation helpful? Give feedback.
-
Hi, I am looking at Zenoh for the first time today and it looks really cool! One question I have is how can I get the timestamp of a certain message. I am following the simple examples from the documentation, in python:
Unfortunately,
sample.timestamp
isNone
. How can I get this field?Thank you very much in advance!
Beta Was this translation helpful? Give feedback.
All reactions