Aller au contenu

LSL (Lab Streaming Layer) stream

VRmaze offers the ability to create an LSL stream to the outside world, so that any encrypted property (as a floating number) can be retrieved from third-party systems that take advantage of the [LSL] protocol (https://labstreaminglayer.org/).

Only one stream can be created per pass, but it will take over all channels of the protocol and update the stream at regular intervals.

As is often the case in VRmaze, one entity controls and manages the stream, while other VRmaze nodes provide the data.

Specific license

A specific license is required to send an LSL stream

LSL stream lifetime

It is recommended to create a flow control entity as a direct child of the protocol, so the flow will have the lifetime of the protocol.

Differentiated frequency ?

It is not possible to have different refresh rates between channels in an LSL stream, unless the update properties are slower than the stream rate.

Stream control node

The LSL Streaming Entity allows the creation of a stream with configurable properties including:

  • The name of the stream
  • The type
  • The source of the stream
  • The frequency of sending

Image title 2

The LSL flow controller.

Number of channels

One of the important points concerning the LSL stream is the number of channels in the stream itself. This number of channels is automatically calculated by VRmaze and depends directly on the protocol. Indeed, when creating the stream, VRmaze will search for all nodes requiring communication channels in the protocol, and reserve a space for them in the LSL stream. In this sense, the number of channels is not a modifiable parameter of the entity.

When a flow is created, communication channels are allocated to each entity that needs them. For the duration of the protocol, the channel will be reserved for the entity. If an entity is a child of any trial, the communication channel will be updated during that trial. Upstream, it will have the value of 0, downstream, it will continue to have the last value updated by the entity.

Communication channel

An LSL communication channel is assigned to an entity, even if at a time t, the entity is not active. Its value will correspond to the last known value or 0 if necessary.

Several LSL channels for a single entity ?

It is quite possible for an entity to require more than one communication channel (a vector 3 for example). In this case, the flow controller will reserve as many channels as necessary for it.

Description

An LSL flow has a description that provides information about the content of the flow in question. This description is automatically provided in XML format by VRmaze according to the different entities. Only the name of the entity will have an impact on the description of the channels assigned to it.

Hierarchical code?

One piece of description information concerns the HierarchyCode which is a numerical representation of the position of the entity in the entire protocol tree. This code is unique for each entity in the protocol and allows a distinction when the names of the entities are identical.

LSL channels

Custom attributes

The creation of LSL communication channels depends absolutely on the established need. Each protocol can send a totally different flow depending on the needs. By default, no entity sends data via the LSL protocol, it is necessary to declare them to remain selective in the data to be sent and not to send everything, which would not make sense.

It is thus possible to declare communication channels in two different ways. The first consists in declaring an entity property as being sent via the LSL flow. To do this, simply add a custom attribute of type LSL Property on the desired entity and select the property to be sent.

Image title 2

The `LSL Property` custom attribute

Change Attribute Name

The LSL Property custom attribute has an editable name. This name will be embedded in the LSL stream description which allows for more accurate information about the associated channel.

Multiple custom attributes ?

It is possible to associate multiple LSL Property custom attributes with a single entity.

While the custom attribute allows you to quickly create a new channel on a specific property, unfortunately it does not offer all the properties accessible within an entity. In some cases, it is necessary to expose properties that are not accessible via this custom attribute. In this case, it is necessary to create a behavior graph which also allows the creation of communication channels, with a much greater latitude.

Graph Variables

The behavior graph can contain LSL variables that allow any value to be sent on the LSL stream.

Image title 2

LSL variables.

There are 4 types of LSL variables:

  • Number (1x channel)
  • Vector 2 (2x channels)
  • Vector 3 (3x channels)
  • Color (4x channels)

Image title 2

Graph having LSL variables.

This makes it possible to associate a value with an LSL variable and have it exposed via the LSL stream.

Update Value.

The communication channel is updated when a new value is assigned to the variable (via the Set Variable Property node).