Skip to content

Commit 0181ae7

Browse files
committed
Add close loop latency blurb and device pattern
1 parent 3f3637a commit 0181ae7

3 files changed

Lines changed: 131 additions & 2 deletions

File tree

tutorials/hobgoblin-closeloop.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1-
# Close Loop Control
1+
# Close-Loop Systems
22

3-
The exercises below will help you become familiar with using the [Harp Hobgoblin](https://github.com/harp-tech/device.hobgoblin) device for close-loop experiments. You will also learn how to use the [Harp Hobgoblin](https://github.com/harp-tech/device.hobgoblin) to interface with external cameras. Before you begin, it is recommended that you review the Bonsai [Acquisition and Tracking](https://bonsai-rx.org/docs/tutorials/acquisition.html) tutorial, which covers key video concepts.
3+
The exercises below will help you become familiar with using the [Harp Hobgoblin](https://github.com/harp-tech/device.hobgoblin) device for close-loop experiments. You will also learn how to use the [Harp Hobgoblin](https://github.com/harp-tech/device.hobgoblin) to interface with external cameras. Before you begin, it is recommended that you review the Bonsai [Acquisition and Tracking](https://bonsai-rx.org/docs/tutorials/acquisition.html) tutorial, which covers key video concepts.
4+
5+
## Close-loop latency
6+
In a closed-loop experiment, we want the behaviour data to generate feedback in real-time into the external world, establishing a relationship where the output of the system depends on detected sensory input. Many behavioural experiments in neuroscience require some kind of closed-loop interaction between the subject and the experimental setup.
7+
8+
One of the most important benchmarks to evaluate the performance of a closed-loop system is the latency, or the time it takes for a change in the output to be generated in response to a change in the input. The easiest way to measure the latency of a closed-loop system is to use a digital feedback test.
9+
10+
In this test, we measure a binary output from the closed-loop system and feed it directly into the input sensor. We then record a series of measurements where we change the output to `HIGH` if the sensor detects `LOW`, and change it to `LOW` if the sensor detects `HIGH`. The time interval between `HIGH` and `LOW` signals will give us the total closed-loop latency of the system, also known as the round-trip time.
11+
12+
Before begining, set up the `Hobgoblin` with the following `device pattern` that we learned about in the previous tutorial.
13+
14+
:::workflow
15+
![Hobgoblin Device Pattern](../workflows/hobgoblin-closeloop-devicepattern.bonsai)
16+
:::
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<WorkflowBuilder Version="2.8.5"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
5+
xmlns:harp="clr-namespace:Bonsai.Harp;assembly=Bonsai.Harp"
6+
xmlns:p1="clr-namespace:Harp.Hobgoblin;assembly=Harp.Hobgoblin"
7+
xmlns="https://bonsai-rx.org/2018/workflow">
8+
<Workflow>
9+
<Nodes>
10+
<Expression xsi:type="rx:BehaviorSubject" TypeArguments="harp:HarpMessage">
11+
<rx:Name>Hobgoblin Commands</rx:Name>
12+
</Expression>
13+
<Expression xsi:type="Combinator">
14+
<Combinator xsi:type="p1:Device">
15+
<harp:OperationMode>Active</harp:OperationMode>
16+
<harp:OperationLed>On</harp:OperationLed>
17+
<harp:DumpRegisters>true</harp:DumpRegisters>
18+
<harp:VisualIndicators>On</harp:VisualIndicators>
19+
<harp:Heartbeat>Disabled</harp:Heartbeat>
20+
<harp:IgnoreErrors>false</harp:IgnoreErrors>
21+
<harp:PortName>COM7</harp:PortName>
22+
</Combinator>
23+
</Expression>
24+
<Expression xsi:type="Combinator">
25+
<Combinator xsi:type="p1:DeviceDataWriter">
26+
<p1:Path>Hobgoblin.harp</p1:Path>
27+
<p1:Buffered>true</p1:Buffered>
28+
<p1:Overwrite>false</p1:Overwrite>
29+
<p1:FilterType>Include</p1:FilterType>
30+
<p1:MessageType xsi:nil="true" />
31+
</Combinator>
32+
</Expression>
33+
<Expression xsi:type="rx:PublishSubject">
34+
<Name>Hobgoblin Events</Name>
35+
</Expression>
36+
</Nodes>
37+
<Edges>
38+
<Edge From="0" To="1" Label="Source1" />
39+
<Edge From="1" To="2" Label="Source1" />
40+
<Edge From="2" To="3" Label="Source1" />
41+
</Edges>
42+
</Workflow>
43+
</WorkflowBuilder>
Lines changed: 73 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)