Connecting ROS to non-ROS nodes using NEP+ tools
We will explore three different methods:
Direct
When your software architecture uses mainly ROS and is only needed to connect a single node/computer that does not support ROS
It can be annoying to deal with IP addresses and port numbers for NEP nodes. You manually create the bridge between NEP and ROS
nep-cli
When one or more modules not supporting ROS need to be connected with a ROS architecture
You need to use the same IP address for all your NEP nodes.
Nep+ App
If you don't want to code at all the bridges between NEP and ROS
Can be more complex to use at the beginning, still in a beta version
Direct method
Before following this tutorial, read Connecting 2 scripts in a local network (e.g., two computers on the same Wifi network)
Bridge NEP Publishers to ROS Subscribers in Python
Let's imagine that Computer B, defined in tutorial Connecting 2 scripts in a local network (e.g., two computers on the same Wifi network), has Ubuntu and ROS installed and that it is required to send the data produced in the NEP Publisher to a ROS Subscriber.
For this example, we will use ROS Standart String messages to link a NEP Publisher with ROS. We will define a bridge script that creates a NEP Subscriber and ROS Publisher.

The code of the bridge script is shown below.
import nep
import time
import rospy
from std_msgs.msg import String
ros_pub = rospy.Publisher('chatter', String, queue_size=10)
rospy.init_node('talker', anonymous=True)
# Create a new nep node
node = nep.node("receiver")
# Set a direct connection using port <3000> and in <'one2many'> mode
# Important: You need to change the IP address <'127.0.0.1'> by
# the IP address of you PC running the publisher node
conf = node.direct(ip = "127.0.0.1", port = 3000, mode ="one2many")
# Create a new nep subscriber with the topic <'test'>
sub = node.new_sub("test_subcriber", "json", conf)
while True:
# Read data in a non-blocking mode
s, msg = sub.listen()
# if s == True, then there is data in the socket
if s:
print(msg)
# msg is a python dictionary
# we convert the value of msg["result"] to string
ros_pub.publish(str(msg["result"]))
else:
# An small sleep will reduce computational load
time.sleep(.0001)
Bridge ROS Publishers to NEP Subscribers in Python
Soon..
Last updated