chongxi / playground

Low-latency interactive multi-stream Behavior Platform: a control console that integrate Jovian (Virtual Reality Platform) and FPGA&Spiketag (Real-time Ephys) and other sensor streams
Other
3 stars 0 forks source link

Jovian abstraction #6

Closed chongxi closed 6 years ago

chongxi commented 6 years ago

1. The Jovian/MouseOver part

This Jovian abstraction receives input from Jovian just as the obsolete behaviour box, except it sits in a CPU rather than a microcontroller, and it uses socket rather than UART image

When MouseoVeR is in the ‘Connected’ state, as set in Console Setup tab (see MouseOver Documentation section 1.4.1-[13]), data describing the current state of the virtual camera (see MouseOver Documentation section 2.1.1) in the scene model (current time relative to the time of ‘Connect’, X-position, Y-position, Z-position, Speed, Heading Direction, and other user-defined events) is continuously printed out via serial port (set in the Configuration tab, in the ‘Input-Output Communication’ panel’s ‘Data Output’, or if undefined, is by default output to the Console terminal window.

The data output is an ASCII string comprised of comma-separated arguments. Each line of data corresponds to the activity of the virtual camera during (or at the end) of the previous frame. An example of a typical data line is:

‘3301, 24105, 42017, 200, 1615, 8556, 0, 2, p1, p2/n/r/’

This particular data line corresponds to:

‘Timestamp, X-position, Y-position, Z-position, Speed, Heading Direction, …
Format Type, Event Count, Event 1, Event 2’

NOTE: Each data line is ended with ‘/n/r’.

2. The Jovian abstract (input)

The desired usage:

In [1]: from playground.base import Jovian

In [2]: jov = Jovian()

In [3]: jov.readline()
Out[3]: '16570896,123847,117408,503,0,0,1,0,0,1,2dreporter_001\n'

In [4]: jov.readline()
Out[4]: '16570914,123847,117408,503,0,0,1,0,0,1,2dreporter_001\n'

In [5]: jov.readline()
Out[5]: '16570929,123847,117408,503,0,0,1,0,0,1,2dreporter_001\n'

In [7]: jov.readline()
Out[7]: '16595462,123847,117408,503,0,0,1,0,0,1,2dreporter_001\n'

In [8]: jov.readline()
Out[8]: '16595480,123847,117408,503,0,0,1,0,0,1,2dreporter_001\n'

In [9]: jov.readline()
Out[9]: '16595496,123847,117408,503,0,0,1,0,0,1,2dreporter_001\n'
In [10]: jov.readline().parse()
Out[10]: (16595513, [123847, 117408])

In [11]: jov.readline().parse()
Out[11]: (16595529, [123847, 117408])

In [12]: jov.readline().parse()
Out[12]: (16595546, [123847, 117408])

Hence the API:

t, coord = jov.readline().parse()
chongxi commented 6 years ago

This is implemented through a buffer which is a generator to force each time it generates a complete line.

chongxi commented 6 years ago

The parse() part is through inheriting from base str class, by adding a parse method.

chongxi commented 6 years ago

3. The Jovian abstract (output)

The output of jovian abstraction teleportation example:

from playground.base import Jovian
jov = Jovian()
x,y,_ = (target_pos - origin)/scale
jov.teleport(prefix='console', target_pos=(x,y,5))
chongxi commented 5 years ago

Introduction to Jovian: Jovian.pdf

Introduction to MouseOver: MouseoVeR_Documentation.docx

chongxi commented 5 years ago

image