Ask Your Question
0

Not able to see tcp packet related with specific ros node in Wireshark.

asked 2016-03-20 04:28:59 -0600

cybodroid gravatar image

updated 2016-03-20 04:38:59 -0600

I am trying to capture packet that is published by ros node in wireshark. As an example, when I do rostopic info /mytopic, output is

Type: geometry_msgs/Twist

Publishers:

So, in the wireshark, when I use filter tcp.port == 60176 , I should see tcp packets related with messages being published on /mytopic, but nothing appears in the wireshark after applying that filter. Does anyone have any idea, what I am doing wrong?

Edit: Just to clarify, a robot model is continuously publishing its position and velocity information over some topic. So I should be able to see related packets in the wireshark, but I don't know how to do that! Thanks.

edit retag flag offensive close merge delete

Comments

ROS is using TCP ( http://wiki.ros.org/ROS/Technical%20O... ) so a package can only appear if you have both subscriber and publisher. So if you run "rostopic echo /mytopic" in another terminal, the package should be shown in wireshark.

DavidN gravatar imageDavidN ( 2016-03-20 05:22:38 -0600 )edit

I guess the same concept would apply for ROS services

DavidN gravatar imageDavidN ( 2016-03-20 05:23:06 -0600 )edit

@DavidN, nope. It didn't work. I tried doing rostopic echo /mytopic in one terminal and in another terminal I checked for port number by executing rostopic info /mytopic and then I applied the filter to the wireshark. Still I can't see anything.

cybodroid gravatar imagecybodroid ( 2016-03-20 06:03:53 -0600 )edit

I'm assuming this is on a Linux machine, and I'm also assuming you are using only a single machine.

That means that all ROS traffic will go through the tcp loopback device (lo on Linux), so you'll have to make sure you're capturing on that (and not, fi, eth0).

gvdhoorn gravatar imagegvdhoorn ( 2016-03-20 06:12:47 -0600 )edit

Yes, your assumptions are correct. I am using Ubuntu 14.04 and everything is on single machine. Nevertheless, I am capturing on lo and not on any other interface. Actually I also tried capturing on all the interfaces. But this doesn't work.

cybodroid gravatar imagecybodroid ( 2016-03-20 06:38:55 -0600 )edit

I may try running ROS node on different machine and then try to capture next day. But you see, if my robot is publishing position and velocity information continuously then I should see flood of ros tcp messages in wireshark which is not happening.

cybodroid gravatar imagecybodroid ( 2016-03-20 06:40:22 -0600 )edit

Ok. This is getting more and more interesting (at least for me). After digging and trying for hours, this is what I found:

  1. A ROS node once being started will use 2 ports. Proof: start any node and run the command ss -lp | grep node_name, you will see 2 ports being opened by this node

(cont)

DavidN gravatar imageDavidN ( 2016-03-20 11:09:18 -0600 )edit

(cont.) 2. When you publish the topic /my_topic, a new node is launched (named rostopic_xxxx) and this node will open 2 ports. In order to see the package from wireshark, you need to try to filter each of the port to see if the package is there.

DavidN gravatar imageDavidN ( 2016-03-20 11:14:11 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-03-20 16:16:20 -0600

ahendrix gravatar image

For background on how ROS sets up topics, watch: https://vimeo.com/67806888 and read the slides

The port number listed is the XMLRPC endpoint of the node; not the port number used for the actual topic connection. So you should expect to see some activity on that port during initial topic setup (IE when the subscriber is negotiating the transport), but you won't see topic data sent over that port.

I'm not aware of a way to retrieve the TCP port for a topic directly, but you should be able to find it by either inspecting the topic negotiation packets, or by using the XMLRPC client to contact the node and request the topic information.

There are a few more wrinkles to be aware of if you really want to go down this path:

  • TCP is not broadcast; it is point-to-point. If there are no subscribers to a topic, you will not see any transmitted data. Conversely, if there are multiple subscribers connected, you will see one packet transmitted to each subscriber.
  • roscpp appears to use the same TCP listening port for all topics, which means that if you capture all of the data on this port, you'll see contents of all of the topics that node is publishing, which also have at least subscriber.
edit flag offensive delete link more

Comments

Thanks for your valuable input. So if I subscribe to the the topic being published, I am in a way creating a point to point connection, right? Then in that case, I should see some tcp packets in the wireshark !! But it doesn't show. Tell me where I am wrong!

cybodroid gravatar imagecybodroid ( 2016-03-20 17:18:57 -0600 )edit

The topic data is carried over a different TCP port than the one listed in rosnode info or rostopic info.

ahendrix gravatar imageahendrix ( 2016-03-20 17:24:03 -0600 )edit

Hi. Now this time I was running the ROSMASTER on different machine and I ros echoed topics on another machine. In that machine I can see the TCP packets but as pointed out by you, they are on different port. The port that is displayed in rosnode info command is in HTTP/XML packet not TCP packet.

cybodroid gravatar imagecybodroid ( 2016-03-20 18:32:48 -0600 )edit

How will I know that on which port TCP packet comes? Or is it just random?

cybodroid gravatar imagecybodroid ( 2016-03-20 18:33:07 -0600 )edit

I'm not aware of a way to retrieve the TCP port for a topic directly, but you should be able to find it by either inspecting the topic negotiation packets, or by using the XMLRPC client to contact the node and request the topic information.

ahendrix gravatar imageahendrix ( 2016-03-20 20:32:15 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-03-20 04:28:59 -0600

Seen: 599 times

Last updated: Mar 20 '16