How to cleanly teardown extension that spawns a background thread?

ueckueck Posts: 4

Hi All,

I'm currently integrating the Tracking and Sensor-Fusion Framework Ubitrack (http://campar.in.tum.de/UbiTrack/WebHome) into Fabric Engine. The extension provides access to various tracking systems and video-live streams to develop Augmented Reality applications.

Ubitrack runs a dataflow-engine as a background thread and i haven't found a clean way to start/stop and teardown the extension. I'm using the python-based Canvas implementation to test the extension.

I would like to:
a) start the ubitrack dataflow processing when play is pressed
b) stop the ubitrack dataflow processing when pause is pressed
c) teardown the background thread cleanly if the canvas graph is unloaded or if canvas is closed.

Are there any special hooks or signals that I can subscribe to in order to improve my extension?

thanks
Ulrich

Comments

  • HelgeHelge Moderator, Fabric Employee Posts: 314 Fabric Employee

    Hey Ulrich,

    that sounds like an exciting project!

    Right now there are no events / signals communicated to Canvas when the play or pause button is pressed. I suggest you customize the canvas.py application (since it's just python code) to communicate with your canvas graph directly. That way you can connect to the signals of these widgets.

    If you look at CanvasWindow.py you should see all of the things you care about. The CanvasWindow has a timeline member which provides signals for these things. It's implemented in C++ here:
    https://github.com/fabric-engine/FabricUI/blob/arbus/Viewports/TimeLineWidget.h

    As you can see it has a playbackChanged(bool) signal that you can connect to.

    I hope this helps!

    best!

    Helge

    Research Engineer @ Fabric Software

  • ueckueck Posts: 4

    Dear Helge,

    thanks for the quick response!

    I'll try your suggestion.

    best
    Ulrich

Sign In or Register to comment.