Setup

Python interface installation

Your workspace must have a Python interpreter with Python 3 (3.6 or greater) or Python 2 (2.7 or greater).

Official Python website

Python installation

This installation will require the use of pip, the package manager included in Python.

You will need to install numpy:

pip install numpy

To use the Modbus API, you will need to install Modbus:

pip install Modbus

Attention

  • Pip can require administrator authorizations to install packages. In this case, add

    sudo
    

    before your command lines on Linux.

  • If pip is not automatically installed with Python, please visit the following website: pip installation

Niryo’s packages

To use our Modbus Python API, and so, command Ned with your Python scripts, you need to get the source packages and place them in a directory of your computer.

Direct and easy method

GitHub method

  • Download the Ned’s ROS stack

  • Create an empty directory on your computer and copy in its root, the following folders:

    • script, in niryo_robot_modbus/, which contains the source code
    • examples, in niryo_robot_modbus/, which contains several examples of Modbus Python API uses.
    • README.md, in niryo_robot_modbus/, which is the documentation of the Modbus Python API.

Installation test

You should know be able to use the Modbus Python API. To verify your installation:

  • Go to the directory that contains the downloaded folders (niryo_robot_modbus and examples),

  • Open the file examples/client_modbus_test.py

  • Modify the line that contains

    client = ModbusTcpClient('169.254.200.200', port=5020)
    

    by replacing the suspension points by the IP address of Ned,

  • Save the file,

  • Execute the following command line:

    PYTHONPATH=. python examples/client_modbus_test.py
    

This procedure will launch a series of actions to confirm if you Modbus Python API is correctly configured.