Commit 6ca27a04 authored by Jussi Lindgren's avatar Jussi Lindgren

Tutorials: Added an example of stimulation passing to Python

parent dd555f6b
<OpenViBE-Scenario>
<Boxes>
<Box>
<Identifier>(0x00004db4, 0x00006a35)</Identifier>
<Name>Python scripting</Name>
<AlgorithmClassIdentifier>(0x5dc4f669, 0xd3fd4d64)</AlgorithmClassIdentifier>
<Inputs>
<Input>
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier>
<Name>New input</Name>
</Input>
</Inputs>
<Settings>
<Setting>
<TypeIdentifier>(0x007deef9, 0x2f3e95c6)</TypeIdentifier>
<Name>Clock frequency (Hz)</Name>
<DefaultValue>64</DefaultValue>
<Value>64</Value>
<Modifiability>false</Modifiability>
</Setting>
<Setting>
<TypeIdentifier>(0xb0d0db45, 0x49cbc34a)</TypeIdentifier>
<Name>Script</Name>
<DefaultValue></DefaultValue>
<Value>${Player_ScenarioDirectory}/scripts/python-print-stimulations.py</Value>
<Modifiability>false</Modifiability>
</Setting>
</Settings>
<Attributes>
<Attribute>
<Identifier>(0x17ee7c08, 0x94c14893)</Identifier>
<Value></Value>
</Attribute>
<Attribute>
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier>
<Value>128.000000</Value>
</Attribute>
<Attribute>
<Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier>
<Value>33</Value>
</Attribute>
<Attribute>
<Identifier>(0x207c9054, 0x3c841b63)</Identifier>
<Value>400.000000</Value>
</Attribute>
<Attribute>
<Identifier>(0x30a4e5c9, 0x83502953)</Identifier>
<Value></Value>
</Attribute>
<Attribute>
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier>
<Value>(0x2a651510, 0xb4fad0d4)</Value>
</Attribute>
<Attribute>
<Identifier>(0x527ad68d, 0x16d746a0)</Identifier>
<Value></Value>
</Attribute>
<Attribute>
<Identifier>(0x61d11811, 0x71e65362)</Identifier>
<Value></Value>
</Attribute>
<Attribute>
<Identifier>(0xad100179, 0xa3c984ab)</Identifier>
<Value>114</Value>
</Attribute>
<Attribute>
<Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier>
<Value>(0x00000000, 0x05874423)</Value>
</Attribute>
<Attribute>
<Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier>
<Value>false</Value>
</Attribute>
<Attribute>
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier>
<Value>2</Value>
</Attribute>
<Attribute>
<Identifier>(0xf191c1c8, 0xa0123976)</Identifier>
<Value></Value>
</Attribute>
<Attribute>
<Identifier>(0xfba64161, 0x65304e21)</Identifier>
<Value></Value>
</Attribute>
</Attributes>
</Box>
<Box>
<Identifier>(0x00005777, 0x00006c19)</Identifier>
<Name>Clock stimulator</Name>
<AlgorithmClassIdentifier>(0x4f756d3f, 0x29ff0b96)</AlgorithmClassIdentifier>
<Outputs>
<Output>
<TypeIdentifier>(0x6f752dd0, 0x082a321e)</TypeIdentifier>
<Name>Generated stimulations</Name>
</Output>
</Outputs>
<Settings>
<Setting>
<TypeIdentifier>(0x512a166f, 0x5c3ef83f)</TypeIdentifier>
<Name>Interstimulation interval (in sec)</Name>
<DefaultValue>1.0</DefaultValue>
<Value>1.0</Value>
<Modifiability>false</Modifiability>
</Setting>
<Setting>
<TypeIdentifier>(0x2c132d6e, 0x44ab0d97)</TypeIdentifier>
<Name>Stimulation</Name>
<DefaultValue>OVTK_StimulationId_Label_00</DefaultValue>
<Value>OVTK_StimulationId_Label_00</Value>
<Modifiability>false</Modifiability>
</Setting>
</Settings>
<Attributes>
<Attribute>
<Identifier>(0x1fa7a38f, 0x54edbe0b)</Identifier>
<Value>48.000000</Value>
</Attribute>
<Attribute>
<Identifier>(0x1fa963f5, 0x1a638cd4)</Identifier>
<Value>23</Value>
</Attribute>
<Attribute>
<Identifier>(0x207c9054, 0x3c841b63)</Identifier>
<Value>400.000000</Value>
</Attribute>
<Attribute>
<Identifier>(0x4e7b798a, 0x183beafb)</Identifier>
<Value>(0x27b3ee3c, 0xc50527e6)</Value>
</Attribute>
<Attribute>
<Identifier>(0xad100179, 0xa3c984ab)</Identifier>
<Value>114</Value>
</Attribute>
<Attribute>
<Identifier>(0xc46b3d00, 0x3e0454e1)</Identifier>
<Value>(0x00000000, 0x0062599e)</Value>
</Attribute>
<Attribute>
<Identifier>(0xc73e83ec, 0xf855c5bc)</Identifier>
<Value>false</Value>
</Attribute>
<Attribute>
<Identifier>(0xc80ce8af, 0xf699f813)</Identifier>
<Value>1</Value>
</Attribute>
<Attribute>
<Identifier>(0xce18836a, 0x9c0eb403)</Identifier>
<Value>2</Value>
</Attribute>
</Attributes>
</Box>
</Boxes>
<Links>
<Link>
<Identifier>(0x0000412b, 0x00003ac4)</Identifier>
<Source>
<BoxIdentifier>(0x00005777, 0x00006c19)</BoxIdentifier>
<BoxOutputIndex>0</BoxOutputIndex>
</Source>
<Target>
<BoxIdentifier>(0x00004db4, 0x00006a35)</BoxIdentifier>
<BoxInputIndex>0</BoxInputIndex>
</Target>
<Attributes>
<Attribute>
<Identifier>(0x1b32c44c, 0x1905e0e9)</Identifier>
<Value>66</Value>
</Attribute>
<Attribute>
<Identifier>(0x358ae8b5, 0x0f8bacd1)</Identifier>
<Value>400</Value>
</Attribute>
<Attribute>
<Identifier>(0x3f0a3b27, 0x570913d2)</Identifier>
<Value>107</Value>
</Attribute>
<Attribute>
<Identifier>(0x6267b5c5, 0x676e3e42)</Identifier>
<Value>400</Value>
</Attribute>
</Attributes>
</Link>
</Links>
<MessageLinks></MessageLinks>
<Comments>
<Comment>
<Identifier>(0x00003cb4, 0x00004c5e)</Identifier>
<Text>The clock stimulator generates
1 stim per second.
The associated python script should
print all the received stimulations.</Text>
<Attributes>
<Attribute>
<Identifier>(0x473d9a43, 0x97fc0a97)</Identifier>
<Value>640.000000</Value>
</Attribute>
<Attribute>
<Identifier>(0x7234b86b, 0x2b8651a5)</Identifier>
<Value>96.000000</Value>
</Attribute>
</Attributes>
</Comment>
</Comments>
<VisualisationTree>
<VisualisationWidget>
<Identifier>(0x000051c6, 0x0000403f)</Identifier>
<Name>Default window</Name>
<Type>1</Type>
<ParentIdentifier>(0xffffffff, 0xffffffff)</ParentIdentifier>
<BoxIdentifier>(0xffffffff, 0xffffffff)</BoxIdentifier>
<NumChildren>1</NumChildren>
<Attributes>
<Attribute>
<Identifier>(0x4c90d4ad, 0x7a2554ec)</Identifier>
<Value>1</Value>
</Attribute>
<Attribute>
<Identifier>(0x7b814cca, 0x271df6dd)</Identifier>
<Value>1</Value>
</Attribute>
</Attributes>
</VisualisationWidget>
<VisualisationWidget>
<Identifier>(0x00006099, 0x00001a73)</Identifier>
<Name>Default tab</Name>
<Type>2</Type>
<ParentIdentifier>(0x000051c6, 0x0000403f)</ParentIdentifier>
<Index>0</Index>
<BoxIdentifier>(0xffffffff, 0xffffffff)</BoxIdentifier>
<NumChildren>1</NumChildren>
</VisualisationWidget>
<VisualisationWidget>
<Identifier>(0x00004197, 0x00001dca)</Identifier>
<Name>Empty</Name>
<Type>0</Type>
<ParentIdentifier>(0x00006099, 0x00001a73)</ParentIdentifier>
<Index>0</Index>
<BoxIdentifier>(0xffffffff, 0xffffffff)</BoxIdentifier>
<NumChildren>0</NumChildren>
</VisualisationWidget>
</VisualisationTree>
</OpenViBE-Scenario>
\ No newline at end of file
class MyOVBox(OVBox):
def __init__(self):
OVBox.__init__(self)
def initialize(self):
# nop
return
def process(self):
for chunkIndex in range( len(self.input[0]) ):
chunk = self.input[0].pop()
if(type(chunk) == OVStimulationSet):
for stimIdx in range(len(chunk)):
stim=chunk.pop();
print 'Received stim', stim.identifier, 'stamped at', stim.date, 's'
#else:
# print 'Received chunk of type ', type(chunk), " looking for StimulationSet"
return
def uninitialize(self):
# nop
return
box = MyOVBox()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment