Skip to content

Commit bb13d65

Browse files
authored
Merge pull request #343 from AllenNeuralDynamics/reafactor-use-whiterabbit-as-timestamp-source
Replace `HarpBehavior` for `HarpWhiteRabbit` as the source of software timestamping
2 parents 7e523ec + 24f7749 commit bb13d65

File tree

9 files changed

+2448
-857
lines changed

9 files changed

+2448
-857
lines changed

bonsai/Bonsai.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<Package id="AllenNeuralDynamics.AindManipulator" version="0.1.6" />
99
<Package id="AllenNeuralDynamics.Core" version="0.4.0" />
1010
<Package id="AllenNeuralDynamics.Core.Design" version="0.2.3" />
11-
<Package id="AllenNeuralDynamics.EnvironmentSensor" version="0.2.0" />
11+
<Package id="AllenNeuralDynamics.EnvironmentSensor" version="0.3.0" />
1212
<Package id="AllenNeuralDynamics.HarpUtils" version="0.3.2" />
1313
<Package id="AllenNeuralDynamics.LicketySplit" version="0.2.0" />
1414
<Package id="AllenNeuralDynamics.SniffDetector" version="0.2.0" />
@@ -130,7 +130,7 @@
130130
<AssemblyLocation assemblyName="AllenNeuralDynamics.AindManipulator" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.AindManipulator.0.1.6/lib/net48/AllenNeuralDynamics.AindManipulator.dll" />
131131
<AssemblyLocation assemblyName="AllenNeuralDynamics.Core" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.Core.0.4.0/lib/net472/AllenNeuralDynamics.Core.dll" />
132132
<AssemblyLocation assemblyName="AllenNeuralDynamics.Core.Design" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.Core.Design.0.2.3/lib/net472/AllenNeuralDynamics.Core.Design.dll" />
133-
<AssemblyLocation assemblyName="AllenNeuralDynamics.EnvironmentSensor" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.EnvironmentSensor.0.2.0/lib/net462/AllenNeuralDynamics.EnvironmentSensor.dll" />
133+
<AssemblyLocation assemblyName="AllenNeuralDynamics.EnvironmentSensor" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.EnvironmentSensor.0.3.0/lib/net462/AllenNeuralDynamics.EnvironmentSensor.dll" />
134134
<AssemblyLocation assemblyName="AllenNeuralDynamics.HarpUtils" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.HarpUtils.0.3.2/lib/net472/AllenNeuralDynamics.HarpUtils.dll" />
135135
<AssemblyLocation assemblyName="AllenNeuralDynamics.LicketySplit" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.LicketySplit.0.2.0/lib/net462/AllenNeuralDynamics.LicketySplit.dll" />
136136
<AssemblyLocation assemblyName="AllenNeuralDynamics.SniffDetector" processorArchitecture="MSIL" location="Packages/AllenNeuralDynamics.SniffDetector.0.2.0/lib/net462/AllenNeuralDynamics.SniffDetector.dll" />

bonsai/NuGet.config

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<packageSources>
4-
<add key="Gallery" value="Gallery" />
5-
<add key="Bonsai Packages" value="https://www.myget.org/F/bonsai/api/v3/index.json" />
6-
<add key="Community Packages" value="https://www.myget.org/F/bonsai-community/api/v3/index.json" />
7-
<add key="Bonsai Boost" value="https://www.myget.org/F/bonsai-boost/api/v3/index.json" />
8-
</packageSources>
4+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
5+
</packageSources>
96
</configuration>
Lines changed: 56 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<WorkflowBuilder Version="2.8.5"
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xmlns:harp="clr-namespace:Bonsai.Harp;assembly=Bonsai.Harp"
54
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
5+
xmlns:harp="clr-namespace:Bonsai.Harp;assembly=Bonsai.Harp"
66
xmlns:beh="clr-namespace:Harp.Behavior;assembly=Harp.Behavior"
77
xmlns="https://bonsai-rx.org/2018/workflow">
88
<Workflow>
99
<Nodes>
10+
<Expression xsi:type="rx:BehaviorSubject" TypeArguments="harp:HarpMessage">
11+
<rx:Name>HarpBehaviorCommands</rx:Name>
12+
</Expression>
1013
<Expression xsi:type="SubscribeSubject">
1114
<Name>RigSchema</Name>
1215
</Expression>
@@ -18,36 +21,35 @@
1821
<Property Name="PortName" />
1922
</PropertyMappings>
2023
</Expression>
21-
<Expression xsi:type="IncludeWorkflow" Path="AllenNeuralDynamics.HarpUtils:HarpBehaviorDevice.bonsai">
22-
<PortName>COM5</PortName>
23-
<TriggerHarpReadDumpSubjectName>TriggerHarpReadDump</TriggerHarpReadDumpSubjectName>
24-
</Expression>
25-
<Expression xsi:type="WorkflowOutput" />
26-
<Expression xsi:type="SubscribeSubject">
27-
<Name>HarpBehaviorEvents</Name>
28-
</Expression>
29-
<Expression xsi:type="harp:Parse">
30-
<harp:Register xsi:type="harp:TimestampedTimestampSeconds" />
24+
<Expression xsi:type="Combinator">
25+
<Combinator xsi:type="beh:Device">
26+
<harp:OperationMode>Active</harp:OperationMode>
27+
<harp:OperationLed>On</harp:OperationLed>
28+
<harp:DumpRegisters>false</harp:DumpRegisters>
29+
<harp:VisualIndicators>On</harp:VisualIndicators>
30+
<harp:Heartbeat>Enabled</harp:Heartbeat>
31+
<harp:IgnoreErrors>false</harp:IgnoreErrors>
32+
<harp:PortName>COMX</harp:PortName>
33+
</Combinator>
3134
</Expression>
3235
<Expression xsi:type="rx:PublishSubject">
33-
<Name>HarpBehaviorHeartBeat</Name>
34-
</Expression>
35-
<Expression xsi:type="SubscribeSubject">
3636
<Name>HarpBehaviorEvents</Name>
3737
</Expression>
38-
<Expression xsi:type="Combinator">
39-
<Combinator xsi:type="rx:Take">
40-
<rx:Count>1</rx:Count>
41-
</Combinator>
38+
<Expression xsi:type="ExternalizedMapping">
39+
<Property Name="Name" DisplayName="TriggerHarpReadDumpSubjectName" />
4240
</Expression>
43-
<Expression xsi:type="Annotation">
44-
<Name>Valve+Speaker</Name>
45-
<Text><![CDATA[]]></Text>
41+
<Expression xsi:type="SubscribeSubject">
42+
<Name>TriggerHarpReadDump</Name>
4643
</Expression>
47-
<Expression xsi:type="beh:CreateMessage">
44+
<Expression xsi:type="harp:CreateMessage">
4845
<harp:MessageType>Write</harp:MessageType>
49-
<harp:Payload xsi:type="beh:CreateOutputPulseEnablePayload">
50-
<beh:OutputPulseEnable>SupplyPort0 DO2</beh:OutputPulseEnable>
46+
<harp:Payload xsi:type="harp:CreateOperationControlPayload">
47+
<harp:OperationMode>Active</harp:OperationMode>
48+
<harp:DumpRegisters>true</harp:DumpRegisters>
49+
<harp:MuteReplies>false</harp:MuteReplies>
50+
<harp:VisualIndicators>On</harp:VisualIndicators>
51+
<harp:OperationLed>On</harp:OperationLed>
52+
<harp:Heartbeat>Enabled</harp:Heartbeat>
5153
</harp:Payload>
5254
</Expression>
5355
<Expression xsi:type="MulticastSubject">
@@ -67,16 +69,21 @@
6769
<beh:OutputClear>SupplyPort1 SupplyPort2</beh:OutputClear>
6870
</harp:Payload>
6971
</Expression>
70-
<Expression xsi:type="MulticastSubject">
71-
<Name>HarpBehaviorCommands</Name>
72+
<Expression xsi:type="beh:CreateMessage">
73+
<harp:MessageType>Write</harp:MessageType>
74+
<harp:Payload xsi:type="beh:CreateEventEnablePayload">
75+
<beh:EventEnable>PortDI PortDIO Camera0 Camera1</beh:EventEnable>
76+
</harp:Payload>
7277
</Expression>
73-
<Expression xsi:type="SubscribeSubject">
74-
<Name>HarpBehaviorEvents</Name>
78+
<Expression xsi:type="Annotation">
79+
<Name>Valve+Speaker</Name>
80+
<Text><![CDATA[]]></Text>
7581
</Expression>
76-
<Expression xsi:type="Combinator">
77-
<Combinator xsi:type="rx:Take">
78-
<rx:Count>1</rx:Count>
79-
</Combinator>
82+
<Expression xsi:type="beh:CreateMessage">
83+
<harp:MessageType>Write</harp:MessageType>
84+
<harp:Payload xsi:type="beh:CreateOutputPulseEnablePayload">
85+
<beh:OutputPulseEnable>SupplyPort0 DO2</beh:OutputPulseEnable>
86+
</harp:Payload>
8087
</Expression>
8188
<Expression xsi:type="Annotation">
8289
<Name>Photodiode</Name>
@@ -88,28 +95,34 @@
8895
<beh:PokeInputFilter>1</beh:PokeInputFilter>
8996
</harp:Payload>
9097
</Expression>
98+
<Expression xsi:type="Combinator">
99+
<Combinator xsi:type="rx:Merge" />
100+
</Expression>
91101
<Expression xsi:type="MulticastSubject">
92102
<Name>HarpBehaviorCommands</Name>
93103
</Expression>
94104
</Nodes>
95105
<Edges>
96-
<Edge From="0" To="1" Label="Source1" />
106+
<Edge From="0" To="4" Label="Source1" />
97107
<Edge From="1" To="2" Label="Source1" />
98108
<Edge From="2" To="3" Label="Source1" />
99-
<Edge From="3" To="4" Label="Source1" />
100-
<Edge From="5" To="6" Label="Source1" />
109+
<Edge From="3" To="4" Label="Source2" />
110+
<Edge From="4" To="5" Label="Source1" />
101111
<Edge From="6" To="7" Label="Source1" />
112+
<Edge From="7" To="8" Label="Source1" />
102113
<Edge From="8" To="9" Label="Source1" />
103-
<Edge From="9" To="11" Label="Source1" />
104-
<Edge From="10" To="11" Label="Source2" />
114+
<Edge From="10" To="11" Label="Source1" />
105115
<Edge From="11" To="12" Label="Source1" />
106-
<Edge From="13" To="14" Label="Source1" />
116+
<Edge From="11" To="13" Label="Source1" />
117+
<Edge From="11" To="15" Label="Source2" />
118+
<Edge From="11" To="17" Label="Source2" />
119+
<Edge From="12" To="18" Label="Source1" />
120+
<Edge From="13" To="18" Label="Source2" />
107121
<Edge From="14" To="15" Label="Source1" />
108-
<Edge From="15" To="16" Label="Source1" />
109-
<Edge From="17" To="18" Label="Source1" />
110-
<Edge From="18" To="20" Label="Source1" />
111-
<Edge From="19" To="20" Label="Source2" />
112-
<Edge From="20" To="21" Label="Source1" />
122+
<Edge From="15" To="18" Label="Source3" />
123+
<Edge From="16" To="17" Label="Source1" />
124+
<Edge From="17" To="18" Label="Source4" />
125+
<Edge From="18" To="19" Label="Source1" />
113126
</Edges>
114127
</Workflow>
115128
</WorkflowBuilder>

src/Extensions/HarpWhiteRabbit.bonsai

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)