Page tree
Skip to end of metadata
Go to start of metadata

Read here the definition of the Perception Core UDP control protocol.

 

Client Application - Perception Core Communication

 

Setting up UDP communication

The addresses, ports and maximum packet size for UDP communication have to be set in the application's ini file,

which is located at "C:\Users\<user name>\AppData\Roaming\Perception Park\Perception Core.ini".

The ini file needs the following entry

UDP Exchange Settings
[PP.PerceptionCore.Controller.Network]
Core.Control.IP=<an ip address>
Core.Control.Port=<a port number>
Core.Control.MaxUdpPacketSize=<a maximum UDP packet size>
Client.Control.IP=<an ip address>
Client.Control.Port=<a port number>

Parameter Explanation

Parameter NameParameter Information
Core.Control.IP

The ip address of the network card of the Perception Core machine. The external application can then send UDP packets to this address

when the Perception Core should receive it.

Core.Control.Port

The port number on the Perception Core machine. The external application has to send to this port if the Perception Core should receive the packet.

Core.Control.MaxUdpPacketSize
The maximum size in bytes one UDP command packet may have when sent by the Perception Core. A command packet exceeding this amount of bytes will be split into several fragments which will be sent one after the other.
Client.Control.IP
The ip address of the target machine (running an external application). The Perception Core will send all UDP control packets to this address.
Client.Control.Port
The port on the target machine (running an external application). The Perception Core will use this port when sending UDP control packets.

Keep in mind that the ip addresses should be the ones of the network cards which are connected (Core to Client) if multiple cards are installed in the machines.

Both cards, Core and Client need to be set to a fixed ip (DHCP disabled).

Also, the used ports need to be chosen so that no other application on the machines will use them. This can be checked with network monitoring software (not provided by Perception Park).

Example

A machine with a Perception Core installed (Core) has a network card with the ip address 192.168.1.4 and the target machine (Client) has a network card with ip 192.168.1.14.

The Core should receive UDP messages on port 1264 and the Client should receive UDP messages on port 1265. Therefor the ini file should contain the following values

UDP Setup Example
[PP.PerceptionCore.Controller.Network]
Core.Control.IP=192.168.1.4
Core.Control.Port=2048
Core.Control.MaxUdpPacketSize=1500
Client.Control.IP=192.168.1.14
Client.Control.Port=2049

Once this is done, the Client can send UDP messages to the Core by sending to 192.168.1.4:2048 and the Client can listen at 192.168.1.14:2049 to receive UDP messages from the Core.

Request configurations description

A client application may request a description of available configurations on a Perception Core by sending a UDP packet to it.

The UDP packet has to have following content (in HEX):

Request Configurations Description
c0d1f1ed0000000300000001000000010000002950502e50657263657074696f6e436f72652e417661696c61626c65436f6e66696775726174696f6e73

The Perception Core will then send a UDP packet providing the description of available configurations to the client application (see Provide configurations description).

Provide configurations description

After a client application

  • has requested configurations description,
  • has set the active configuration, 
  • has imported a configuration, or
  • has deleted a configuration

the Perception Core will send a UDP packet containing a description of the available configurations in xml format.

The sent UDP packet consist of a header (bytes 0 - 61) and the actual description (bytes 62 - end).

The header of this packet has the following form (in HEX):

Provide Configurations Description Header
c0d1f1ed0000000300000000000000020000002950502e50657263657074696f6e436f72652e417661696c61626c65436f6e66696775726174696f6e7300
An example of an actual description:
Configurations Description
<Parameter name="Configurations">
    <Property name="ParameterDescription" type="string" value="This parameter maps all configurations held in this set."/>
    <Property name="ParameterBaseVersion" type="qint32" value="0"/>
    <Property name="IsReadOnly" type="bool" value="0"/>
    <Property name="Visibility" type="qint32" value="0"/>
    <Property name="ParameterUnit" type="string" value=""/>
    <Property name="ParameterCategory" type="string" value="Miscellaneous"/>
    <Property name="IsEnabled" type="bool" value="1"/>
    <Property name="enum_version" type="qint32" value="0"/>
    <Property name="allows_combination" type="bool" value="0"/>
    <Property name="enum_map">
        <enum_value name="Default configuration for (Innospec 320FPA 1.7 C 1234567)" key="0"/>
        <enum_value name="256__I_2" key="1"/>
        <enum_value name="256__In_2n" key="2"/>
        <enum_value name="256__I_1_2" key="3"/>
        <enum_value name="Default configuration for (Perception Park Virtual Camera 0)" key="4"/>
        <enum_value name="Default configuration for (Perception Park Virtual Camera 1)" key="5"/>
    </Property>
    <Property name="value" type="qint64" value="4"/>
</Parameter>

The above configuration description example defines 6 configurations (lines 12-17), the active configuration is defined in line 19, i.e. configuration 4 "Default configuration for (Perception Park Virtual Camera 0)".

Set active configuration

A client application may set the active configuration on a Perception Core by sending a UDP packet to it.

The sent UDP packet consist of a header (bytes 0 - 61) and the actual key of the wanted configuration (bytes 62 - 65).

Set active configuration header
c0d1f1ed0000000300000000000000000000002950502e50657263657074696f6e436f72652e417661696c61626c65436f6e66696775726174696f6e7300

 Bytes 62-65 have to define the key of the wanted configuration, i.e.

100 00 00 01
25400 00 00 FE
174100 00 06 CD

 

Delete a configuration

A client application may delete a configuration (but not the active one) on a Perception Core by sending a UDP packet to it.

The sent UDP packet consist of a header (bytes 0 - 56) and the actual key of the configuration to be deleted (bytes 57 - 60).

Delete configuration header
c0d1f1ed0000000300000001000000000000002550502e50657263657074696f6e436f72652e52656d6f7665436f6e66696775726174696f6e

 Bytes 57-60 have to define the key of the configuration to be deleted, i.e.

100 00 00 01
25400 00 00 FE
174100 00 06 CD

Request export of a configuration

A client application may request export of a configuration from a Perception Core by sending a UDP packet to it.

The sent UDP packet consists of a header (bytes 0 - 54)  and the actual key of the configuration to be exported (bytes 55 - 58).

Export configuration header
c0d1f1ed0000000300000001000000010000002250502e50657263657074696f6e436f72652e4e6577436f6e66696775726174696f6e00

Bytes 55-58 have to define the key of the configuration to be exported, i.e.

100 00 00 01
25400 00 00 FE
174100 00 06 CD

Provide exported configuration

After a client application has requested export of a configuration the Perception Core will send UDP packets containing the exported configuration.

Since the size of a Export UDP Packet usually exceeds the maximum transfer data size for UDP datagrams the Export UDP packet is split by the Perception Core (see Splitting UDP commands on this page).

After

  • all fragments have been received, 
  • the respective fragment headers have been removed and 
  • all fragments have been stitched together

the resulting byte array consist of a header (bytes 0 - 58) and the actual binary configuration (bytes 59 - end).

Provide exported configuration header
c0d1f1ed0000000300000001000000020000002250502e50657263657074696f6e436f72652e4e6577436f6e66696775726174696f6e0000000000

Import of a configuration

A client application may import a configuration onto a Perception Core by sending a UDP packet to it.

This UDP packet consist of a header (bytes 0 - 58), the length of the configuration in bytes (bytes 59 - 62) and the actual binary content of the configuration (bytes 63 - end).

Import configuration header
c0d1f1ed0000000300000001000000000000002250502e50657263657074696f6e436f72652e4e6577436f6e66696775726174696f6e0000000000

Since the size of a Import UDP Packet usually exceeds the maximum transfer data size for UDP datagrams the Import UDP packet has to be split.

Splitting UDP commands

If a UDP command sent to the Perception Core exceeds the maximum transfer data size for UDP datagrams (can be as low as 500 bytes, usually is about 8000 bytes), it has to be split into several datagrams which then are sent one after the other.

Each fragment UDP packet consists of a header (bytes 0  - 11), the total number of fragments (bytes 12 - 15), the current fragment index (bytes 16 - 19) and one part of the original command UDP (bytes 20 - end).

Fragment header
c0d1f1ed00000003000000040000021100000002

The given example is a UDP fragment definition of fragment with index 2 (bytes 16 - 19) of 529 fragments in total (bytes 12 - 15).

 

Example Code

 

UDPControl (C++ with QT)

A sample application is provided demonstrating UDP control of a Perception Core via a client application.

Files

FileDescription
main.cppContains the entry point of the application.
UDPControl.h

Class UDPControl provides methods to trigger UDP commands for communication with the Perception Core.

Users interested in implementing their own UDP control may use this class as reference.

UDPControl.cpp
UDPControlMainWindow.hClass UDPControlMainWindow provides a GUI to easily use the methods provided by class UDPControl.
UDPControlMainWindow.cpp
UDPControlMainWindow.ui
UDPControl.proqmake build support file to easily build the application.
UDPControl.qrcResource file.
UDPControl sources.7zZip file containing all files needed to build the application.

 

Requirements

The provided source files depend on Qt 5, which can be licensed under LGPL (i.e. open source with some requirements).

Qt 5 is available at https://www.qt.io/download.

We have tested the application on Windows 7 64bit with MSVC 2012 and Qt 5.2.1

Binary

Also a binary application (Windows 7 64bit) is provided to test UDP control of a Perception Core, it can be found here: UDPControl.7z.

 

 

 

UDPControl (VB.NET)

A sample application is provided demonstrating UDP control of a Perception Core via a client application in Visual Basic.Net with Winforms

Files

The rar file contains a Visual Studio project as well as the build executables for Release and Debug configuration

 

FolderDescription
./contains the Visual Studio solution, project and source files
./bincontains the Release & Debug executables
FileDescription
Perception Park UDPControl VB.NET.slnVisual Studio Solution
Perception Park UDPControl VB.NET.vbprojVisual Studio Project
UDPControl.vbClass for controlling the Perception Core via UDP
UDPControlForm.vbUser Interface

 

Requirements

Visual Studio (at least 2012)

We have tested the application on Windows 10 64bit with MSVC 2012

Binary

Also a binary application (Windows 10 64bit) is provided to test UDP control of a Perception Core, it can be found here: 

UDPControl VisualBasic.NET.rar

 

 


© 2019 by Perception Park GmbH
The content of this page and any attached files are confidential and intended solely for the addressee(s). Any publication, transmission or other use of the information by a person or entity other than the intended addressee is prohibited. If you receive this in error please contact Perception Park and delete copied material. Perception Park GmbH, Wartingergasse 42, A-8010 Graz; Austria; FN 400381x

  • No labels