NEP+ middleware documentation

Cross-disciplinary, cross-platform, multi-language, and human-centered middleware communication framework for busy practitioners, researchers, and newcomers

What is NEP+?

NEP+ middleware is a software framework that acts as an intermediary between different applications, systems, or components, facilitating communication and data exchange between them. In simple words, NEP+ middleware allows different software components to interact with each other seamlessly, making it easier to develop complex software systems.

In Japanese, NEP+ is pronounced as ネプ プラス/nepu purasu

In English, the pronunciation nepu is kept. Examples: nepu pləs

Empowering Human-Centered Development

NEP+ stands out as middleware for several reasons:

Human-Centered Design: NEP+ is specifically designed with human-centered principles in mind, focusing on simplicity, ease of use, and accessibility. This makes it particularly suitable for developers and users who may not have extensive technical expertise.

Cross-Platform Compatibility: NEP+ is designed to seamlessly operate across various operating systems, including Windows, macOS, Linux, and Android. This broad compatibility ensures that NEP+ can be easily integrated into diverse software environments.

Multi-Language Support: NEP+ facilitates communication between components developed in different programming languages. This means that developers can leverage their preferred languages while still achieving interoperability within their applications.

Versatility: NEP+ offers a range of options, tools, and interfaces tailored for various applications in Human-Robot Interaction (HRI) and Human-Machine Interaction (HMI) domains. This versatility enables developers to create a wide range of interactive applications, from robotics systems to digital twins.

Empowering Developers: NEP+ aims to empower both novice and experienced developers by providing intuitive tools and interfaces for integrating human-machine interaction applications. This focus on empowerment makes NEP+ accessible to a broader audience, fostering innovation and collaboration in the development community.

NEP+ middleware components:

NEP libraries, NEP+ App and NEP CLI were designed to empower ZeroMQ message libraries, enabling and

Getting Started for Absolute Beginners with an Out-of-the-Box Example

Are you tired of the boring 'hello world' example that requires learning new concepts and installing numerous dependencies by writing commands in a terminal, sometimes leading to failures in achieving the intended results? Let's begin with a zero-code, zero-command-line, fully interactive 'hello world' example that uses your webcam and artificial intelligence to display your skeleton. I hope this example can provide a more enjoyable introduction for you in three simple steps:

Soon ...

Getting Started for Command Line Enthusiasts with a Python Example

Here is the traditional 'hello world' in four simple steps:

Requirements:

1.-Install the NEP CLI using npm and the nep Python library using pip

npm is the package manager for Node.js, and pip is the package installer for Python

pip install nep
npm -g install nep-cli

2.- Run the NEP master server using the next line:

nep master

3.- Run the following Python script for sending messages:

import nep
import time

# Create a new nep node
node = nep.node('publisher') 

# Create a publisher for the "test" topic using JSON format
pub = node.new_pub('test', 'json')

print ("Ctrl + C for stopping the program")
i = 0
while True:
    # Your analysis code goes here...
    i += 1
    
    # Prepare the message as a Python dictionary
    msg = {'result': i}
    
    # Publish the message
    pub.publish(msg)
    
    # Add a small time delay for visualization purposes
    time.sleep(1)     

4.- Run the following Python script for reading and displaying messages:

import nep
import time

# Create a new nep node with a unique name
node = nep.node('susbcriber')

# Create a subscriber for the "test" topic using JSON format
sub = node.new_sub('test', 'json')

while True:
    # Read data in a non-blocking mode
    s, msg = sub.listen()

    # If there is data in the socket, print it and increment i
    if s:
        print(msg)
        print ("Ctrl + C for stopping the program")

    # A small sleep to reduce computational load
    time.sleep(0.0001)

Getting Started for Sending Messages from Computer A to Computer B using Python

The NEP master server must be executed using NEP-CLI or NEP+ App in either computer A or B.

In this example, we will run the NEP master on computer B. Therefore, for programs on computer A that need to send and receive messages from computer B, it is necessary to specify the IP address of computer B.

Requirements computer A (do not require installation of NEP-CLI):

1.- Install nep library

pip install -nep

Requirements computer B ( require installation of NEP-CLI):

2.-Install the NEP CLI using npm and the nep Python library using pip

pip install nep
npm -g install nep-cli

If you have already installed NEP+ libraries in Python, it is recommended to update to the latest version using pip install -U nep

3.- Run the NEP master server using the next line:

nep master

4.- Figure out the IP address of computer B (in the network connected to computer A). For that, you can use some of the next commands in computer B:

nep ip

You will see something like this:

Wi-Fi (Wi-Fi) IP Address: 192.168.0.1
Ethernet IP Address: 192.168.0.2

In this case, computer B can be connected to other computers in the network using Ethernet over the IP = 192.168.0.1 or Wi-Fi over the IP = 192.168.0.2

In this second example Ethernet connection is not available, therefore you must check your cable connection or networking configuration:

Wi-Fi (Wi-Fi) IP Address: 192.168.0.1
No Ethernet IPv4 address found.

5.- In computer A using the IP address obtained in computer B run the next code:

Note: Update the IP value in line 8 with the correct address obtained in step 4. If communication is unsuccessful, ensure that the entered IP address is accurate

import nep
import time

# Create a new nep node
node = nep.node('publisher') 

# Change this value with the IP address of computer B
conf = node.hybrid('192.168.0.101') 
# Create a publisher for the "test" topic using JSON format
pub = node.new_pub('test', 'json', conf)

print ("Ctrl + C for stopping the program")
i = 0
while True:
    # Your analysis code goes here...
    i += 1
    
    # Prepare the message as a Python dictionary
    msg = {'result': i}
    
    # Publish the message
    pub.publish(msg)
    
    # Add a small time delay for visualization purposes
    time.sleep(1)   

6.- Run the following Python script for reading and displaying messages:

import nep
import time

# Create a new nep node with a unique name
node = nep.node('susbcriber')

# Create a subscriber for the "test" topic using JSON format
sub = node.new_sub('test', 'json')

while True:
    # Read data in a non-blocking mode
    s, msg = sub.listen()

    # If there is data in the socket, print it and increment i
    if s:
        print(msg)
        print ("Ctrl + C for stopping the program")

    # A small sleep to reduce computational load
    time.sleep(0.0001)

When executing programs on the computer running the NEP master server using NEP-CLI or NEP+ App, there's no need to specify the IP address. However, for communication with these programs from other computers, it's essential to define the IP address of the computer running the NEP master server in the code, such as in step 5.

Installing NEP+ libraries in Python, C#, Node.js and Java

NEP+ supports a wide range of modern and popular programming languages, and installing them is as simple as a few command lines using official package managers.

Install the nep library for Python using pip

pip install nep

For users of pycharm just search the nep package, following these instructions.

Issues using older library versions and older NEP-CLI and NEP+ App versions.

Previous versions of NEP implemented in Python, C#, Java, and JavaScript were connected to NEP-CLI and NEP+ App using a client-server pattern over port 7000. However, this port was also utilized by AirPlay in Apple devices, thereby limiting cross-platform capabilities. In the new versions of NEP+ tools, port 50000 is used instead.

Solution: update NEP libraries, NEP-CLI, and NEP+ App to the latest versions.

Example of applications:

  1. Integrating Sensors with IA algorithms and Robots: NEP+ can help connect sensors like cameras to state-of-the-art AI algorithms and different types of robots, enabling them to perceive and interact with their environment.

  2. Controlling Robots from a Smartphone: With NEP+, users can develop applications to control robots remotely using their smartphones, making it easy to operate robots from a distance.

  3. Visualizing Robot Data: NEP+ can be used to create interfaces that display real-time data from robots, such as their current position or sensor readings, in a user-friendly format.

Last updated