Paul Elsberg
Published

Interactive LEDs with the Walabot

Learn how to connect the walabot in python to the fadecandy running in a processing sketch. The primary purpose here is building a bridge!

IntermediateShowcase (no instructions)2 hours738
Interactive LEDs with the Walabot

Things used in this project

Hardware components

Walabot Developer Pack
Walabot Developer Pack
×1
Adafruit Fadecandy
×1
Adafruit Neopixel grid
×1

Story

Read more

Code

ScanTargets.py

Python
from __future__ import print_function
from sys import platform
from os import system
import WalabotAPI as wlbt
import socket
import time #use pip to import any of these libraries if you don't have them

host = '127.0.0.1'
port = 5000
 
mySocket = socket.socket()
mySocket.connect((host,port))

R_MIN, R_MAX, R_RES = 2, 20, 5  # SetArenaR values
THETA_MIN, THETA_MAX, THETA_RES = -25, 5, 2  # SetArenaTheta values
PHI_MIN, PHI_MAX, PHI_RES = -75, 75, 2  # SetArenaPhi values
TSHLD = 15  # SetThreshold value

wlbt.Init()  # load the WalabotSDK to the Python wrapper
wlbt.SetSettingsFolder()  # set the path to the essetial database files
wlbt.ConnectAny()  # establishes communication with the Walabot

wlbt.SetProfile(wlbt.PROF_SENSOR)  # set scan profile out of the possibilities
wlbt.SetArenaR(R_MIN, R_MAX, R_RES)
wlbt.SetArenaTheta(THETA_MIN, THETA_MAX, THETA_RES)
wlbt.SetArenaPhi(PHI_MIN, PHI_MAX, PHI_RES)
wlbt.SetThreshold(TSHLD)
wlbt.SetDynamicImageFilter(wlbt.FILTER_TYPE_MTI)  # specify filter to use


wlbt.Start()  # starts Walabot in preparation for scanning
wlbt.StartCalibration()

while True:
    wlbt.Trigger()  # initiates a scan and records signals
    targets = wlbt.GetSensorTargets()  # provides a list of identified targets
    #system('cls' if platform == 'win32' else 'clear')  # clear the terminal
    #time.sleep(.1)
    for i, t in enumerate(targets):
        if i==1:
            mySocket.send(str.encode('{} {} {} {}\n'.format(
            i+1, int(t.xPosCm), int(t.yPosCm), int(t.zPosCm))))
        

wlbt.Stop()  # stops Walabot when finished scanning
wlbt.Disconnect()  # stops communication with Walabot

mySocket.close()
 

 

 

 

 

 

 

Processing Sketch

Credits

Paul Elsberg

Paul Elsberg

4 projects • 19 followers

Comments