Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prototype implementation of triggered timeline visualizer #80

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

glopesdev
Copy link
Member

This PR describes a first approach towards implementing a triggered timeline visualizer. The current implementation allows aligning message timestamps to an arbitrary timestamped trigger sequence.

Events are labeled with their unique Harp register address or name, and the value in each of the timestamped triggers is used to offset all events in the timeline along the Y axis. Both raw Harp message inputs and grouped sequences are supported.

There are a few limitations of the visualizer which make me hesitant to merge this in its present state, specifically:

  • The plot is updated only when events are reported from the device, which can make things hard to read if the axes are on auto-scale. This is less of a problem when setting a fixed TimeSpan property since in this case we can fix the range of the X axis but I would like to make sure we have exhausted all design possibilities here.
  • Currently only Harp message events are supported. While there is some use for this, it still doesn't capture what feel like important moments such as the switching of specific bits in bitmask registers, e.g. portA vs portB inputs on a behavior board. Here I am not sure if we should continue to design something specific for Harp or whether we should aim for something more general.

An example workflow is below, followed by a snapshot of what the interface currently looks like:

image
Copy workflow
<?xml version="1.0" encoding="utf-8"?>
<WorkflowBuilder Version="2.8.0"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xmlns:beh="clr-namespace:Harp.Behavior;assembly=Harp.Behavior"
                 xmlns:harp="clr-namespace:Bonsai.Harp;assembly=Bonsai.Harp"
                 xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
                 xmlns:wie="clr-namespace:Bonsai.Windows.Input;assembly=Bonsai.Windows.Input"
                 xmlns:harpviz="clr-namespace:Bonsai.Harp.Visualizers;assembly=Bonsai.Harp.Visualizers"
                 xmlns="https://bonsai-rx.org/2018/workflow">
  <Workflow>
    <Nodes>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="beh:Device">
          <harp:OperationMode>Active</harp:OperationMode>
          <harp:OperationLed>On</harp:OperationLed>
          <harp:DumpRegisters>true</harp:DumpRegisters>
          <harp:VisualIndicators>On</harp:VisualIndicators>
          <harp:Heartbeat>Enabled</harp:Heartbeat>
          <harp:IgnoreErrors>false</harp:IgnoreErrors>
          <harp:PortName>COM4</harp:PortName>
        </Combinator>
      </Expression>
      <Expression xsi:type="rx:PublishSubject">
        <Name>Timestamp</Name>
      </Expression>
      <Expression xsi:type="beh:FilterRegister">
        <harp:FilterType>Exclude</harp:FilterType>
        <harp:Register xsi:type="beh:AnalogData" />
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="beh:GroupByRegister" />
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="wie:KeyDown">
          <wie:Filter>None</wie:Filter>
          <wie:SuppressRepetitions>false</wie:SuppressRepetitions>
        </Combinator>
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="rx:ElementIndex" />
      </Expression>
      <Expression xsi:type="MemberSelector">
        <Selector>Index</Selector>
      </Expression>
      <Expression xsi:type="IncludeWorkflow" Path="Bonsai.Harp:WithLatestTimestamp.bonsai">
        <Name>Timestamp</Name>
      </Expression>
      <Expression xsi:type="harpviz:TriggerTimelineGraphBuilder">
        <harpviz:TimeSpan xsi:nil="true" />
      </Expression>
    </Nodes>
    <Edges>
      <Edge From="0" To="1" Label="Source1" />
      <Edge From="1" To="2" Label="Source1" />
      <Edge From="2" To="3" Label="Source1" />
      <Edge From="3" To="8" Label="Source1" />
      <Edge From="4" To="5" Label="Source1" />
      <Edge From="5" To="6" Label="Source1" />
      <Edge From="6" To="7" Label="Source1" />
      <Edge From="7" To="8" Label="Source2" />
    </Edges>
  </Workflow>
</WorkflowBuilder>

Visualizer Preview

@glopesdev glopesdev added the feature New planned feature label Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New planned feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant