LiveLink Developer Guide

LiveLink Developer Guide

LiveLink Plugin User Data

The LONET Client Unreal plugin adds a function that allows users to pass arbitrary numerical data into Unreal, which is exposed as a subject in LiveLink.

Users can create an unlimited amount of subjects, and each subject can have up to six numerical values. To create a subject, simply form a data packet following the User Data Structure, and send to the Unreal machine through UDP.

User Data Packet Structure

<0XF2><,><Source Name><,><arbitrary1><,><arbitrary2><,><arbitrary3><,><arbitrary4><,><arbitrary5><,><arbitrary6>

There is a byte limit of 1024 total per packet. The packet is delimited by commas. If a packet is sent from a subject name that has not yet been received, it will be added as a new subject. Subsequent packets sent with that name will automatically update that subjects frame data.

Example Python Code

import socket
import sys

UDP_IP = ""
UDP_PORT = 3333
PREFIX = bytes.fromhex("F2")
MESSAGE = ",Hello,1,2,3,4,5,6"
BUFFER = PREFIX + bytes(MESSAGE, "utf-8")

print("UDP target IP: %s" % UDP_IP)
print("UDP target port: %s" % UDP_PORT)
print("message: %s" % MESSAGE)

sock = socket.socket(socket.AF_INET, 
sock.sendto(BUFFER, (UDP_IP, UDP_PORT)) #Sends data to Hello source

MESSAGE = ",World,7,8,9,10,11,12"
BUFFER = PREFIX + bytes(MESSAGE, "utf-8")

sock.sendto(BUFFER, (UDP_IP, UDP_PORT)) #Sends data to World source

Result of code in Unreal:

alt text

The six user data properties can be accessed with the Get Property Values node on the frame data in Blueprints, or in the array created by breaking the LiveLink frame data.

alt text

Example Arduino Code

#include "WiFi.h"
#include "AsyncUDP.h"

const char * ssid = "******";
const char * password = "******";

const char * udpAddress = "";
const int udpPort = 3333;

byte prefix = 0XF2;
uint8_t buffer[50];
int analog1;
int analog2;
int analog3;

WiFiUDP udp;

void setup()
    WiFi.begin(ssid, password);

void loop()
    analog1 = analogRead(0);
    analog2 = hallRead();
    analog3 = analogRead(2);

    memset(buffer, prefix, 1);
    udp.printf(",Analog Values,%d,%d,%d,0,0,0", analog1,analog2,analog3);