ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Hi,

Maybe I found a solution, not the pretiest, not the easiest, but it may work (but it's cpp only) :

  1. You can find the IP of a ROS node by contacting the master (rosnode info my_node will return the ip of the node, with many other information)

  2. According to The connection header documentation, the node currently sending data can be found in the connection header.

  3. You can use Message event to get the connection header.

  4. To manipulate Message event, you can check Passthrough Filter, just adapt the code to not let the message go through unless the IP is OK. Also check the message filter documentation.

The 3. and 4. are optional, if you can manage to get the connection header by an another way, or the message event by an another way.

It may be easier in Python but i'm not experimented enough in python to help.

Hi,

Maybe I found a solution, not the pretiest, not the easiest, but it may work (but it's cpp only) :

  1. You can find the IP of a ROS node by contacting the master (rosnode info my_node will return the ip of the node, with many other information)

  2. According to The connection header documentation, the node currently sending data can be found in the connection header.

  3. You can use Message event to get the connection header.

  4. To manipulate Message event, you can check Passthrough Filter, just adapt the code to not let the message go through unless the IP is OK. Also check the message filter documentation.

The 3. and 4. are optional, if you can manage to get the connection header by an another way, or the message event by an another way.

It may be easier in Python but i'm not experimented enough in python to help.

Edit from Creed comment :

In CPP, use the cpp publisher tutorial / 2.4 MessageEvent to get message event.

for python check Creed's comment below

Hi,

Maybe I found a solution, not the pretiest, not the easiest, but it may work (but it's cpp only) :

  1. You can find the IP of a ROS node by contacting the master (rosnode info my_node will return the ip of the node, with many other information)

  2. According to The connection header documentation, the node currently sending data can be found in the connection header.

  3. You can use Message event to get the connection header.

  4. To manipulate Message event, you can check Passthrough Filter, just adapt the code to not let the message go through unless the IP is OK. Also check the message filter documentation.

The 3. and 4. are optional, if you can manage to get the connection header by an another way, or the message event by an another way.

It may be easier in Python but i'm not experimented enough in python to help.


Edit from Creed comment :

In CPP, use the cpp publisher tutorial / 2.4 MessageEvent to get message event.

for python check Creed's comment below