Python Node connection via network
Hi, I would like to publish/subscribe to a series of ROS topics that a specific machine is offering from another machine, being both in the same network. I have done this already using the rosserial_embeddedlinux library, which lets you specify an IP address during the node initialization, however I would also like to be able to do this in Python.
I can't seem to find the correct way to do this, as rospy.init_node does not allow to pass an IP address-like parameter, so I've started to wonder if this is even possible (it probably is, but you never know).
The piece of code I would like to replicate is something like this:
#include <ros.h>
<...>
ros::NodeHandle nh;
<...>
nh.initNode("127.0.0.1:11411");
This C++ code allows me to connect to a machine with the IP address specified in nh.initNode's first parameter, but as I already said I can't find the way to do this in Python. The argument list for rospy.init_node is as follows (taken from https://wiki.ros.org/rospy/Overview/I...):
rospy.init_node(name, anonymous=False, log_level=rospy.INFO, disable_signals=False)
Create a new node with the specified name. There are several optional keyword arguments that you may wish to set:
anonymous=True
The anonymous keyword argument is mainly used for nodes where you normally expect many of them to be running and don't care about their names (e.g. tools, GUIs). It adds a random number to the end of your node's name, to make it unique. Unique names are more important for nodes like drivers, where it is an error if more than one is running. If two nodes with the same name are detected on a ROS graph, the older node is shutdown.
log_level=rospy.INFO
Set the default log level for publishing log messages to rosout. See Logging.
disable_signals=False
By default, rospy registers signal handlers so that it can exit on Ctrl-C. In some code, you may wish to disable this, including:
You're not calling init_node() from the Python Main thread. Python only allows signals to be registered from the Main thread.
You're running rospy within Qt, wxPython or any other GUI toolkit that has its own exit handlers.
You wish to have your own signal handlers by default.
Is there anyone that could help with this? Thanks a lot in advance.