Walabot API Beta
All you need to know to create a Walabot Application
Walabot Python API Documentation

The Walabot library now supports Python, with its own Python API module for both Python 2 and 3, and makes it incredibly easy to take your first steps in developing Walabot applications. Importing WalabotAPI To use the WalabotAPI module in your Python code, you must import the module. You have two options for this: you can install WalabotAPI as a Python package, or you can import the Python file WalabotAPI.py into your specific script, using its file location.

Installing WalabotAPI as a Package

You must have both Python and pip installed.

On Windows

Run the Command Prompt as an Administrator, and enter:

pip install WalabotAPI --no-index --find-links="%PROGRAMFILES%/Walabot/WalabotSDK/python/"

On Linux

You may need to use sudo.

pip install WalabotAPI --no-index --find-links="/usr/share/walabot/python/"

Once you have installed the package, simply import the package in your Python code using: import WalabotAPI

Importing WalabotAPI by Location

It is recommended to use the built-in imp.load_source() to load the module easily.

For Windows

from imp import load_source
WalabotAPI = load_source(‘WalabotAPI’,
‘C:/Program Files/Walabot/WalabotSDK/python/WalabotAPI.py’)

For Linux

from imp import load_source
WalabotAPI = load_source(‘WalabotAPI’,
‘/usr/share/walabot/python/WalabotAPI.py’)

Getting Started

Module Initialization

Before using any other Walabot calls, you must call WalabotAPI.Init(). The Python API is using the ‘low-level’ library for C++ (WalabotAPI.dll on Windows and libWalabotAPI.so on Linux).

In order to direct the Python API to the library you need to use the WalabotAPI.Init() function and pass it the path to the library. Moving the library file is not recommended. In case you do move it, you can pass Init() the new path to the library, e.g.:

WalabotAPI.Init(“C:/MyCode/MyWalabotProject/WalabotAPI.dll”)

Using Walabot Functions

Every function in the C++ API has a corresponding function in the Python API module which is designed to match the Python language flow. It is advised to look at the Python examples to fully understand how to use them. A detailed documentation about all available functions is given below, and can also be found using Python’s help() function.

Calling functions example

As an example, the original Walabot_GetStatus() function which is implemented as such in the C++ example code:

res = Walabot_GetStatus(&appStatus, &calibrationProcess);

Should be written in Python as such:

appStatus, calibrationProcess = WalabotAPI.GetStatus()

Handling Exceptions

Unlike the C++ functions, the functions in Python does not return WALABOT_RESULT. The Python module will raise WalabotError in case it encounters one. You can catch those errors and act accordingly.

WalabotResult fields

code: WALABOT_SUCCESS for success, WALABOT_ERROR for error.
error string: A short description of the occurred error. Call Walabot_GetErrorString() to get it after getting a WALABOT_ERROR as a return value.

Debugging Example

The following example can be used in order to test that there is a connected Walabot:

try:
WalabotAPI.ConnectAny()
except WalabotAPI.WalabotError:

Module ‘Constants’

The C++ enums are available as simply ‘constants’ variables and are corresponding to them. For example: PROF_SENSOR is accessible in Python simply as WalabotAPI.PROF_SENSOR. Available ‘Constants’

  • For APP_PROFILE:
  • PROF_SHORT_RANGE_IMAGING
  • PROF_SENSOR
  • PROF_SENSOR_NARROW
  • PROF_TRACKER
  • For APP_STATUS:
  • STATUS_CLEAN
  • STATUS_INITIALIZED
  • STATUS_CONNECTED
  • STATUS_CONFIGURED
  • STATUS_SCANNING
  • STATUS_CALIBRATING
  • STATUS_CALIBRATING_NO_MOVEMENT
    - For FILTER_TYPE:
  • FILTER_TYPE_NONE
  • FILTER_TYPE_DERIVATIVE
  • FILTER_TYPE_MTI
  • For TARGET_TYPE:
  • TARGET_TYPE_UNKNOWN
  • TARGET_TYPE_PIPE
  • TARGET_TYPE_STUD
  • TARGET_TYPE_STUD90
  • TARGET_TYPE_STUD_METAL
  • TARGET_TYPE_OTHER
    Custom Types
    The Python API implements the original C++ structs as namedtuples.
    Available Types
    AntennaPair:
  • (int) txAntenna
  • (int) rxAntenna
    ImagingTarget
  • (TARGET_TYPE) type
  • (double) angleDeg
  • (double) xPosCm
  • (double) yPosCm
  • (double) zPosCm
  • (double) widthCm
  • (double) amplitude
    SensorTarget
  • (double) xPosCm
  • (double) yPosCm
  • (double) zPosCm
  • (double) amplitude
    Custom Types Example
    WalabotAPI.GetImagingTargets() function returns a list of ImagingTarget type.
    You can access the width of the first element in this list with targets[0].widthCm.
    Example Code: InWallApp
    from __future__ import print_function # WalabotAPI works on both Python 2 and 3.
    from sys import platform
    from os import system
    from imp import load_source
    WalabotAPI = load_source('WalabotAPI',
    'C:/Program Files/Walabot/WalabotSDK/bin/Win32/WalabotAPI.py')
    WalabotAPI.Init()
    def PrintSensorTargets(targets):
    system('cls' if platform == 'win32' else 'clear')
    if targets:
    for i, target in enumerate(targets):
    print (('Target #{}:\ntype: {}\nangleDeg: {}\nx: {}\ny: {}\nz: {}'+
    '\nwidth: {}\namplitude: {}\n').format(i + 1, target.type,
    target.angleDeg, target.xPosCm, target.yPosCm, target.zPosCm,
    target.widthCm, target.amplitude))
    else:
    print ('No Target Detected')
    def InWallApp():
    # WalabotAPI.SetArenaX - input parameters
    xArenaMin, xArenaMax, xArenaRes = -3, 4, 0.5
    # WalabotAPI.SetArenaY - input parameters
    yArenaMin, yArenaMax, yArenaRes = -6, 4, 0.5
    # WalabotAPI.SetArenaZ - input parameters
    zArenaMin, zArenaMax, zArenaRes = 3, 8, 0.5
    # Configure Walabot database install location (for windows)
    WalabotAPI.SetSettingsFolder()
    # 1) Connect: Establish communication with walabot.
    WalabotAPI.ConnectAny()
    # 2) Configure: Set scan profile and arena
    # Set Profile - to Short-range.
    WalabotAPI.SetProfile(WalabotAPI.PROF_SHORT_RANGE_IMAGING)
    # Set arena by Cartesian coordinates, with arena resolution
    WalabotAPI.SetArenaX(xArenaMin, xArenaMax, xArenaRes)
    WalabotAPI.SetArenaY(yArenaMin, yArenaMax, yArenaRes)
    WalabotAPI.SetArenaZ(zArenaMin, zArenaMax, zArenaRes)
    # Walabot filtering disable
    WalabotAPI.SetDynamicImageFilter(WalabotAPI.FILTER_TYPE_NONE)
    # 3) Start: Start the system in preparation for scanning.
    WalabotAPI.Start()
    # calibrates scanning to ignore or reduce the signals
    WalabotAPI.StartCalibration()
    while True:
    appStatus, calibrationProcess = WalabotAPI.GetStatus()
    # 5) Trigger: Scan (sense) according to profile and record signals
    # to be available for processing and retrieval.
    WalabotAPI.Trigger()
    # 6) Get action: retrieve the last completed triggered recording
    targets = WalabotAPI.GetImagingTargets()
    rasterImage, sliceDepth, power = WalabotAPI.GetRawImageSlice()
    # print targets found
    PrintSensorTargets(targets)
    # 7) Stop and Disconnect.
    WalabotAPI.Stop()
    WalabotAPI.Disconnect()
    print ('Terminate successfully')
    if __name__ == '__main__':
    InWallApp()