Disable latching for rostopic in piping mode [closed]

asked 2013-03-24 21:17:20 -0600

updated 2013-03-26 21:32:29 -0600

Is it possible?

The wiki states there are three modes rostopic pub can function in, however it is not clear whether Rate mode and Latch mode are mutually exclusive.

Here are some cases (EDITED):

# Latching
$ rostopic pub /str std_msgs/String "Hello world"
publishing and latching message. Press ctrl-C to terminate
^C

# Not latching
$ rostopic pub -r 10 /str std_msgs/String "Hello world"
<No output here>
^C

# Still not latching
$ rostopic pub -r 10 --latch /str std_msgs/String "Hello world"
<No output here>
^C

# Latching again
$ rostopic pub -r 10 /another_str std_msgs/String "Test" &
$ rostopic echo /another_str | rostopic pub -r 10 /str std_msgs/String
publishing and latching message for 3.0 seconds
publishing and latching message for 3.0 seconds
...
publishing and latching message for 3.0 seconds
^C

If it is by design, then what is the reason to latch piped messages by default?

EDIT: Opened a ticket

EDIT #2:

Here is a simple one-line test:

$ for i in {1..1000}; do printf "data: ${i}\n---\n"; sleep 0.5; done | rostopic pub /test std_msgs/UInt64 > /dev/null & sleep 2 && rostopic echo /test
[1] 12431
data: 1
---
data: 2
---
data: 3
---
data: 4
---
data: 5
---
^C
$ kill $!

From the next one we can see that every message is latched indeed for 3 seconds (note the delay before echo for 9 seconds):

$ for i in {1..1000}; do printf "data: ${i}\n---\n"; sleep 0.5; done | rostopic pub /test std_msgs/UInt64 > /dev/null & sleep 9 && rostopic echo /test
[1] 12605
data: 18
---
data: 19
---
data: 20
---
data: 21
---
^C
$ kill $!

Hope it helps

Thanks

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Boris
close date 2015-06-25 07:17:48.870545

Comments

According to the wiki, piped messages shouldn't be latched by default, yet I'm experiencing the same problem.

RafBerkvens gravatar image RafBerkvens  ( 2013-03-25 03:40:00 -0600 )edit

Please state how you tested for latching?

tfoote gravatar image tfoote  ( 2013-03-26 16:07:13 -0600 )edit

@tfoote, it is solely based on the screen output of rostopic pub saying "publishing and latching message for 3.0 seconds" (for every single message). In non-piped-rate mode rostopic produce no output to the screen.

Boris gravatar image Boris  ( 2013-03-26 16:18:39 -0600 )edit

I've edited the output for respective commands

Boris gravatar image Boris  ( 2013-03-26 16:52:54 -0600 )edit