1
$\begingroup$

I have an issue with one of the rostopics. Actaully one of the node is publishing a message which is not useful to me and i was not able to find out. The message which is published are :

header:
  seq: 2618
  stamp:
    secs: 0
    nsecs:         0
  frame_id: ''
throttle: 0.0
steer: -0.2546444833278656
brake: 0.0
hand_brake: False
reverse: True
gear: 0
manual_gear_shift: False

But some node is publishing the reverse as False alternatively. so my messages are kind of alternatively reverse as True or False. I want to find out which node is publishing at the real time. I checked the rosnode list and found 3 nodes are publishing to the topic.

$\endgroup$

2 Answers 2

1
$\begingroup$

If you mean on the command line, use rostopic info:

rostopic info /your_topic_name

For programmatic in python you can use the rostopic library:

import rostopic

pubs, subs = rostopic.get_topic_list()

pubs and subs are lists of tuples of size 3 where the first element is the topic name, the second is the topic type, and the third is a list of nodes. You'll have to search through them to find the topic you are interested in.

Take a look at this example, I build a dictionary so it's easy to look up by topic:

https://github.com/lucasw/topic_state/blob/master/scripts/ros_tui.py#L26-L48

$\endgroup$
1
$\begingroup$

If you want to know which node is publishing each individual message on the topic, I think the easiest way is to simply stop each of the 3 nodes in turn and you will be able to know if really one node is responsible for all the FALSE cases. It may not be what you think. Maybe all three are publishing TRUE and FALSE.

Log files set to verbose may also help you figure it out.

I find it confusing that three different nodes would publish the same data onto a single topic. How confident are you that the three nodes are all sending the same data? If the data was intended to show states of different cars or different joints, the message should have a field for identifying.

$\endgroup$
1
  • 1
    $\begingroup$ rony - you should take a look at the rosnode kill command for stopping a node by node name. $\endgroup$
    – Mike973
    Oct 8, 2023 at 0:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.