Skip to main content

NMotion CLI

Version:
Production Ready

The NMotion Command Line Interface (CLI) Tool is a Python-based command line interface program that enables real-time control of NMotion components connected via NLink Adapters.

info

Currently NMotion CLI tool only supports components which are connected to PC via our own NLink Adapter

The document provides instructions on how to setup and use the tool, and if you face any errors, make sure to check out our Troubleshooting section.

Setup

Download the tool from Downloads page and extract it. Before using it, ensure that you install the required Python packages by running the command:

$ pip3 install -r /path/to/extracted/nmotion-cli/linux_requirements.txt

Since the tool uses NMotion Transport Library, it is compatible with Python versions 3.8, 3.9 and 3.10.

Usage

Go to the extracted folder, the directory structure will be as follows:

nmotion-cli
├── nmotion_transport
| └── <Nmotion Transport Python Library>
└── device_manager
| └── <Manages connected devices>
└── utils
| └── <Utilities used in code>
├── windows_requirements.txt
├── linux_requirements.txt
└── nmotion-cli.py

To use the nmotion-cli tool, first run the nmotion-cli.py script in your terminal to boot up the program.

$ python3 nmotion-cli.py

Once the program starts, the terminal interface will look like this,

NMotion CLI Tool v1.0
Please connect your NMotion Component via NLink device.
You can also type help() or quit().

In [1]:

Once it's running, connect the NLink Adapter to a USB port on your computer. The tool will automatically detect the adapter.

When NLink Adapter is connected to COM8 port.
NMotion CLI Tool v1.0
Please connect your NMotion Component via NLink device.
You can also type help() or quit().

Connected to NLink device at COM8.
In [1]:

Next, connect the NMotion components to the NLink Adapter; the tool will detect these connections automatically and create appropriate class objects for each component.

Actuator of CAN Node ID 23 is connected to the NLink Adapter.
NMotion CLI Tool v1.0
Please connect your NMotion Component via NLink device.
You can also type help() or quit().

Connected to NLink device at COM8.
New Device with ID: 23 got connected. Actuator_23 object created.
In [1]:

Accessing and Controlling Devices

The created class objects for devices can be used to give commands to the components. The commands are the same ones which is defined in the Device's Python API.

Actuator with CAN Node ID 23 can be controlled by giving commands.
NMotion CLI Tool v1.0
Please connect your NMotion Component via NLink device.
You can also type help() or quit().

Connected to NLink device at COM8.
New Device with ID: 23 got connected. Actuator_23 object created.
In [1]: Actuator_23.setPositionControl(120, 100)
Out[1]: <ret_status_t.RETURN_OK: 0>

Live Plotting

The tool features live plotting capabilities for various variables that is accessible via the CLI tool. It includes a global plotter object with a plot() method, which accepts a function that returns the value to be plotted. When you pass this function to plot(), it will be executed repeatedly to produce a live plot. Make sure that the function returns the values which needs to be plotted in form of a list.

Using Python's lambda function to plot actuator's bus voltage.
NMotion CLI Tool v1.0
Please connect your NMotion Component via NLink device.
You can also type help() or quit().

Connected to NLink device at COM8.
New Device with ID: 23 got connected. Actuator_23 object created.
In [1]: plotter.plot(lambda: [Actuator_23.getVbusVoltage()[1]])

In [2]:

Troubleshooting

Here are some potential issues you might encounter with the tool and their solutions.

  • NMotion Components are not detected by NMotion CLI in Linux
    This issue occurs due to insufficient port permissions for the user. Ensure you have the necessary permissions to access the USB port on your Linux system.
  • NLink Adapter is not detected by the tool in Windows
    This issue is likely due to the wrong driver being loaded for the adapter. Use Zadig to change the driver of the adpater to USB Serial CDC, which may involve downgrading the current driver. To verify if the correct driver is installed, open Device Manager and check for a device labeled NLink. If it appears, then the driver is now correctly installed.
  • Attribute not found errors while calling API function
    This issue is likely due to the firmware version not being compatible with the Nmotion CLI tool. Ensure that you have updated the tool to the latest version to support the correct device. Refer to the table below for a list of supported devices and their corresponding versions.

Supported Devices & Versions

DeviceVersion
NDrive Z1Frimware Version <= 0.3.1 , Hardware Version <= 1.1
Smart ActuatorsFirmware Version <= 0.3.1
  NMotionTM  is a sub-brand of Nawe Robotics
Copyright © 2025 Nawe Robotics Private Limited