How to install and start working with pythonSDK

How to install and start working with pythonSDK

Overview

This article provides a step-by-step guide on how to build, install, and run the Python SDK on both Linux and Windows systems.


1) Choose the Appropriate Python SDK Version

The Fairino Python SDK is released in multiple versions, with each version designed to be compatible with a specific WebAPP or simulator version.

You can find all available SDK releases at the following link:
https://github.com/FAIR-INNOVATION/fairino-python-sdk/releases


Make sure to select and install the SDK version that matches your WebAPP (or simulator) version to ensure proper compatibility and functionality.
Warning
Using wrong SDK Version that doesn't match with the webAPP version or simulator version will result unpredictable errors

SDK Version
WebAPP Version / Simulator Version
Release Link
2.2.4
3.9.4
2.2.3
3.9.3
2.2.1
3.9.1
2.2.0
3.9.0
2.1.7
3.8.7
2.1.4
3.8.4

2) Build the Python SDK (Linux)

After downloading the ZIP file, extract its contents. The package typically includes the SDK source code for both Windows and Linux operating systems.

Before using the SDK tools on your system, you need to build the required dynamic libraries—.so files for Linux or .pyd files for Windows.


2.1) build the python SDK for linux operating system

After extracting the files, navigate to the SDK directory. For example:
~/path/to/pythonSDK/fairino-python-sdk-2.2.3_robot3.9.3/linux/fairino
Info
Make sure to replace "/path/to/pythonSDK" with the actual path to your directory.

Next, open a terminal in the same location and install Cython using the following command:
Notes
pip install cython
After installing cython, now you can build the library by typing the following commands:
Notes
python setup.py build_ext --inplace

You should expect an output similar to the one shown below.


2.2) validate python SDK build for linux operating system 

to validate the installation is to launch the Python 3 interpreter and run the following commands:
Notes
python3 
Notes
import Robot 
Notes
print(Robot.__file__)

The response below indicate that you have successfully compiled the SDK locally 

  

2.2) configure the python SDK to be accessible globally.

To make the SDK accessible from anywhere on your system, you need to configure the environment so the Python interpreter can locate the SDK and its dynamic libraries without requiring you to be inside the SDK/fairino subfolder.

Open a terminal, then edit the .bashrc file:

Notes
nano ~/.bashrc

Add the following line at the end of the file:

Notesexport PYTHONPATH="${PYTHONPATH}:/path/to/pythonSDK/fairino-python-sdk-2.2.4_robot_v3.9.4/linux"

Info
Do not forget to replace /path/to/pythonSDK/ with the actual path to your directory.

3) Build the Python SDK (Windows 10/11)

After downloading the ZIP file, extract its contents. The package typically includes the SDK source code for both Windows and Linux operating systems.

Before using the SDK tools on your system, you need to build the required dynamic libraries—.so files for Linux or .pyd files for Windows.

3.1) Build the Python SDK (Windows 10/11)

After downloading and extracting the ZIP file, navigate to the directory:

C:\[Your_path_to_sdk]\fairino-python-sdk-2.2.4_robot_v3.9.4\windows\fairino

Once inside this folder, open a terminal and run the following command:
Notes
pip install cython











Before proceeding to the next step and building the python dynamic library you will need to install  Microsoft C++ Build Tools - Visual Studio
Info
you will have to install the C++ workload which normally requires around 7 GB

After installing the Visual Studio Build Tools, select Desktop development with C++, then click Install to proceed.


Now you can build the dynamic library using the following command:

Notes
python setup.py build_ext --inplace  

After running this command, you should see output similar to the one shown below in the console.



3.2) Validate the Python SDK Build (Windows 10/11)


You can verify that the build process has succeeded by navigating to the Windows subfolder, launching the Python interpreter, and attempting to import the robot module, as shown in the screenshot below.
 

3.3) Set Up Global Access for the Python SDK (Windows 10/11)

To ensure the Python SDK can be used globally, you need to configure environment variables.

From the Start menu, search for “Edit the system environment variables”, then open it. In the System Properties window, click Environment Variables.

Under System variables (or User variables), click New, then create a variable named PYTHONPATH.

For the value, add the path to your Python SDK, for example:

\path\to\python\sdk\windows

Info
Make sure to replace this with the actual location of your SDK installation.





    • Related Articles

    • 3D Object Mapping using Force Sensor & Servo Cart (Python SDK)

      This article contains code for mapping and visualizing an object from probing the target **PLEASE NOTE THIS CODE IS MEANT AS AN EXAMPLE/TEMPLATE AND SHOULD NOT BE RAN!!! USE THIS TO CREATE MODIFICATIONS TO ENSURE SAFETY AND COMPATABILITY WITH YOUR ...
    • Fairino Servo Commands (SDK)

      Servo commands, while being intimidating and complex at first, are a low level way to control your robot while getting precise movements and are ideal for low level control and accuracy. When using these servo commands with the SDK, you may notice a ...
    • Setting Collision Level

      Fairino Collision detection sensitivity The Fairino robotic arms are Cobots, meaning they are meant to work around people safely. A key to accomplishing this is the "Collision detection" setting. This article will cover how to set the collision level ...
    • Example Pick and place (Python SDK)

      The following examples are written on the 3.8.2 software version; some functions/arguments are subject to change, but the core structure will remain **PLEASE NOTE THAT THIS IS MEANT TO BE AN OUTLINE/GUIDE NOT AN OUT OF THE BOX PROGRAM! PLEASE ...
    • Working with Asynchronous and Parallel Applications

      In this article, we discuss how to use the Background Application feature, which allows the user to run more than one application at the same time. This feature is alternative for Auxiliary Thread feature, which is not recommended to use according to ...