Exemplo n.º 1
0
def main():
    global debug_data
    global debug_parameters
    global debug_proof_of_life

    gu.register_exit_signals(close_all_sockets)

    args = sys.argv[1:]
    debug_data = args[0] == 'True'
    debug_parameters = args[1] == 'True'
    debug_proof_of_life = args[2] == 'True'

    data_thread = threading.Thread(target=data_forwarder_loop, daemon=True)
    data_thread.start()
    parameters_thread = threading.Thread(target=parameters_forwarder_loop,
                                         daemon=True)
    parameters_thread.start()
    proof_of_life_thread = threading.Thread(
        target=proof_of_life_forwarder_loop, daemon=True)
    proof_of_life_thread.start()

    while True:
        time.sleep(1)
sys.path.insert(0, path.dirname(current_dir))

from Heron import general_utils as gu
Exec = os.path.abspath(__file__)


# <editor-fold desc="The following code is called from the GUI process as part of the generation of the node.
# It is meant to create node specific elements (not part of a generic node).
# This is where a new node's individual elements should be defined">

"""
Properties of the generated Node
"""
BaseName = 'Save FFMPEG video'
NodeAttributeNames = ['Parameters', 'Frame In']
NodeAttributeType = ['Static', 'Input']
ParameterNames = ['File name', 'Timestamp', 'Pixel Format In', 'Pixel Format Out', 'Fps']
ParameterTypes = ['str', 'bool', 'str', 'str', 'int']
ParametersDefaultValues = ['output.avi', True, 'bayer_rggb8', 'rgb0', 120]
WorkerDefaultExecutable = os.path.join(os.path.dirname(Exec), 'save_ffmpeg_video_worker.py')
# </editor-fold>


# <editor-fold desc="The following code is called as its own process when the editor starts the graph">
if __name__ == "__main__":
    save_video_com = gu.start_the_sink_communications_process()
    gu.register_exit_signals(save_video_com.on_kill)
    save_video_com.start_ioloop()

# </editor-fold>
Exemplo n.º 3
0
    current_dir = path.dirname(current_dir)
sys.path.insert(0, path.dirname(current_dir))

from Heron import general_utils as gu

Exec = os.path.abspath(__file__)

# <editor-fold desc="The following code is called from the GUI process as part of the generation of the node.
# It is meant to create node specific elements (not part of a generic node).
# This is where a new nodes individual elements should be defined">
"""
Properties of the generated Node
"""
BaseName = 'User Input'
NodeAttributeNames = ['Parameters', 'Text Out']
NodeAttributeType = ['Static', 'Output']
ParameterNames = ['Visualisation', 'Output Type', 'User Input']
ParameterTypes = ['bool', 'list', 'str']
ParametersDefaultValues = [False, ['string', 'int', 'float'], '']
WorkerDefaultExecutable = os.path.join(os.path.dirname(Exec),
                                       'user_input_worker.py')
# </editor-fold>

# <editor-fold desc="The following code is called as its own process when the editor starts the graph">
if __name__ == "__main__":
    user_input_com = gu.start_the_source_communications_process(
        NodeAttributeType, NodeAttributeNames)
    gu.register_exit_signals(user_input_com.on_kill)
    user_input_com.start_ioloop()
# </editor-fold>
Exemplo n.º 4
0
from Heron import general_utils as gu
Exec = os.path.abspath(__file__)


# <editor-fold desc="The following code is called from the GUI process as part of the generation of the node.
# It is meant to create node specific elements (not part of a generic node).
# This is where a new node's individual elements should be defined">

"""
Properties of the generated Node
"""
BaseName = 'Save Array To Binary'
NodeAttributeNames = ['Parameters', 'Array In']
NodeAttributeType = ['Static', 'Input']
ParameterNames = ['File name', 'Timestamp', 'Expand Or Append', 'on Axis', 'dtype']
ParameterTypes = ['str', 'bool', 'bool', 'int', 'list']
ParametersDefaultValues = ['output.bin', True, True, 0, ['Same', 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32',
                                                    'uint64', 'float16', 'float32', 'float64']]
WorkerDefaultExecutable = os.path.join(os.path.dirname(Exec), 'save_numpy_array_to_binary_worker.py')
# </editor-fold>


# <editor-fold desc="The following code is called as its own process when the editor starts the graph">
if __name__ == "__main__":
    save_numpy_array_com = gu.start_the_sink_communications_process()
    gu.register_exit_signals(save_numpy_array_com.on_kill)
    save_numpy_array_com.start_ioloop()

# </editor-fold>
Exemplo n.º 5
0
# (i.e. neither an Output nor and Input).

ParameterNames = [
    'Visualisation', 'Parameter 1', 'Parameter 2', 'Parameter 3', 'Parameter 4'
]  # If there are
# parameters then write their names here. If there are not make an empty list (i.e. ParameterNames = [])

ParameterTypes = ['bool', 'str', 'list', 'float',
                  'int']  # The types of the parameters (in string form).
# types allowed are: 'bool', 'str', 'list', 'int' and 'float'. Again for no parameters make an empty list.

ParametersDefaultValues = [
    False, 'True', ['item 1', 'item 2'], 0.0, 2
]  # The default values of each parameter.  These are the values the Node will
# have when first created into the Node Editor. Parameter of 'list' type become drop down menus and the list of their
# default values becomes the drop down menu items. The Node by default uses the first item (so the order matters).

# The following line needs to exist with the correct name for the xxx_worker.py script
WorkerDefaultExecutable = os.path.join(os.path.dirname(Exec),
                                       'source_template_worker.py')
# </editor-fold>

# <editor-fold desc="The following code is called as its own process when the editor starts the graph.
#  You can refactor the name of the xxx_com variable but do not change anything else">
if __name__ == "__main__":
    source_template_com = gu.start_the_source_communications_process(
        NodeAttributeType, NodeAttributeNames)
    gu.register_exit_signals(source_template_com.on_kill)
    source_template_com.start_ioloop()
# </editor-fold>
# <editor-fold desc="The following code is called from the GUI process as part of the generation of the node.
# It is meant to create node specific elements (not part of a generic node).
# This is where a new node's individual elements should be defined">
"""
Properties of the generated Node
"""
BaseName = 'User Defined Function 1I 1O'
NodeAttributeNames = ['Parameters', 'Input', 'Output']

NodeAttributeType = ['Static', 'Input', 'Output']

ParameterNames = [r"Full path to function's filename"]

ParameterTypes = ['str']

ParametersDefaultValues = [r'E:\Temp\function.py']

WorkerDefaultExecutable = os.path.join(os.path.dirname(Exec),
                                       'user_defined_function_1i1o_worker.py')
# </editor-fold>

# <editor-fold desc="The following code is called as its own process when the editor starts the graph.
#  You can refactor the name of the xxx_com variable but do not change anything else">
if __name__ == "__main__":
    transform_template_com = gu.start_the_transform_communications_process(
        NodeAttributeType, NodeAttributeNames)
    gu.register_exit_signals(transform_template_com.on_kill)
    transform_template_com.start_ioloop()

# </editor-fold>
Exemplo n.º 7
0
sys.path.insert(0, path.dirname(current_dir))

from Heron import general_utils as gu
Exec = os.path.abspath(__file__)

# <editor-fold desc="The following code is called from the GUI process as part of the generation of the node.
# It is meant to create node specific elements (not part of a generic node).
# This is where a new node's individual elements should be defined">
"""
Properties of the generated Node
"""
BaseName = 'Canny'
NodeAttributeNames = ['Parameters', 'Frame In', 'Edges Out']
NodeAttributeType = ['Static', 'Input', 'Output']
ParameterNames = ['Visualisation', 'Min Value', 'Max Value']
ParameterTypes = ['bool', 'int', 'int']
ParametersDefaultValues = [False, 100, 200]
WorkerDefaultExecutable = os.path.join(os.path.dirname(Exec),
                                       'canny_worker.py')

# </editor-fold>

# <editor-fold desc="The following code is called as its own process when the editor starts the graph">
if __name__ == "__main__":
    canny_com = gu.start_the_transform_communications_process(
        NodeAttributeType, NodeAttributeNames)
    gu.register_exit_signals(canny_com.on_kill)
    canny_com.start_ioloop()

# </editor-fold>
Exemplo n.º 8
0
Exec = os.path.abspath(__file__)

# <editor-fold desc="The following code is called from the GUI process as part of the generation of the node.
# It is meant to create node specific elements (not part of a generic node).
# This is where a new node's individual elements should be defined">
"""
Properties of the generated Node
"""
BaseName = 'Visualiser'
NodeAttributeNames = ['Parameters', 'In', 'Out']
NodeAttributeType = ['Static', 'Input', 'Output']
ParameterNames = ['Visualisation', 'Type', 'Buffer']
ParameterTypes = ['bool', 'list', 'int']
ParametersDefaultValues = [
    False, ['Image', 'Value', 'Single Pane Plot', 'Multi Pane Plot'], 100
]
WorkerDefaultExecutable = os.path.join(os.path.dirname(Exec),
                                       'visualiser_worker.py')

# </editor-fold>

# <editor-fold desc="The following code is called as its own process when the editor starts the graph">
if __name__ == "__main__":
    visualiser_com = gu.start_the_transform_communications_process(
        NodeAttributeType, NodeAttributeNames)
    gu.register_exit_signals(visualiser_com.on_kill)
    visualiser_com.start_ioloop()

# </editor-fold>
Exemplo n.º 9
0
sys.path.insert(0, path.dirname(current_dir))

from Heron import general_utils as gu

Exec = os.path.abspath(__file__)
# </editor-fold>

# <editor-fold desc="The following code is called from the GUI process as part of the generation of the node.
"""
Properties of the generated Node
"""
BaseName = 'Arduino Serial Out'  # The base name can have spaces.

NodeAttributeNames = ['Parameters', 'Signal In']
NodeAttributeType = ['Static', 'Input']
ParameterNames = ['Visualisation', 'COM Port', 'Baud Rate']
ParameterTypes = ['bool', 'str', 'int']
ParametersDefaultValues = [False, 'COM4', 9600]
WorkerDefaultExecutable = os.path.join(os.path.dirname(Exec),
                                       'arduino_serial_out_worker.py')
# </editor-fold>

# <editor-fold desc="The following code is called as its own process when the editor starts the graph.
#  You can refactor the name of the xxx_com variable but do not change anything else">
if __name__ == "__main__":
    #  In this case refactor the name sink_template_com to whatever_com
    arduino_serial_out_com = gu.start_the_sink_communications_process()
    gu.register_exit_signals(arduino_serial_out_com.on_kill)
    arduino_serial_out_com.start_ioloop()
# </editor-fold>
Exemplo n.º 10
0
# Static (i.e. neither an Output nor and Input).

ParameterNames = [
    'Visualisation', 'Parameter 1', 'Parameter 2', 'Parameter 3', 'Parameter 4'
]  # If there are
# parameters then write their names here. If there are not make an empty list (i.e. ParameterNames = [])

ParameterTypes = ['bool', 'str', 'list', 'float',
                  'int']  # The types of the parameters (in string form).
# types allowed are: 'bool', 'str', 'list', 'int' and 'float'. Again for no parameters make an empty list.

ParametersDefaultValues = [
    False, 'True', ['item 1', 'item 2'], 0.0, 2
]  # The default values of each parameter.  These are the values the Node will
# have when first created into the Node Editor. Parameter of 'list' type become drop down menus and the list of their
# default values becomes the drop down menu items. The Node by default uses the first item (so the order matters).

# The following line needs to exist with the correct name for the xxx_worker.py script
WorkerDefaultExecutable = os.path.join(os.path.dirname(Exec),
                                       'sink_template_worker.py')
# </editor-fold>

# <editor-fold desc="The following code is called as its own process when the editor starts the graph.
#  You can refactor the name of the xxx_com variable but do not change anything else">
if __name__ == "__main__":
    #  In this case refactor the name sink_template_com to whatever_com
    sink_template_com = gu.start_the_sink_communications_process()
    gu.register_exit_signals(sink_template_com.on_kill)
    sink_template_com.start_ioloop()
# </editor-fold>
Exemplo n.º 11
0
"""
Properties of the generated Node
"""
BaseName = 'Timer'
NodeAttributeNames = ['Parameters', 'Signal Out']
NodeAttributeType = ['Static', 'Output']
ParameterNames = [
    'Visualisation', 'SignalOut', 'Delay Generator (sec)', 'a', 'b', 'c'
]
ParameterTypes = ['bool', 'str', 'list', 'float', 'float', 'float']
ParametersDefaultValues = [
    False, 'True',
    [
        'constant: a=const', 'random uniform: a=min, b=max',
        'random exponential: a=lambda',
        'random truncated exponential: a=min, b=max, c=lambda',
        'random gaussian: a=mu, b=sigma'
    ], 0.0, 0.0, 0.0
]
WorkerDefaultExecutable = os.path.join(os.path.dirname(Exec),
                                       'timer_worker.py')
# </editor-fold>

# <editor-fold desc="The following code is called as its own process when the editor starts the graph">
if __name__ == "__main__":
    timer_com = gu.start_the_source_communications_process(
        NodeAttributeType, NodeAttributeNames)
    gu.register_exit_signals(timer_com.on_kill)
    timer_com.start_ioloop()
# </editor-fold>
# <editor-fold desc="The following code is called from the GUI process as part of the generation of the node.
# It is meant to create node specific elements (not part of a generic node).
# This is where a new node's individual elements should be defined">
"""
Properties of the generated Node
"""
BaseName = 'User Defined Function 2I 1O'
NodeAttributeNames = ['Parameters', 'Input', 'Input', 'Output']

NodeAttributeType = ['Static', 'Input', 'Input', 'Output']

ParameterNames = [r"Full path to function's filename"]

ParameterTypes = ['str']

ParametersDefaultValues = [r'E:\Temp\function.py']

WorkerDefaultExecutable = os.path.join(os.path.dirname(Exec), 'user_defined_function_2i1o_worker.py')
# </editor-fold>


# <editor-fold desc="The following code is called as its own process when the editor starts the graph.
#  You can refactor the name of the xxx_com variable but do not change anything else">
if __name__ == "__main__":
    user_defined_function_2i1o_com = gu.start_the_transform_communications_process(NodeAttributeType, NodeAttributeNames)
    gu.register_exit_signals(user_defined_function_2i1o_com.on_kill)
    user_defined_function_2i1o_com.start_ioloop()

# </editor-fold>
        'multivariate_normal: a=mean, b=cov, c=size',
        'negative_binomial: a=n, b=p, c=size',
        'noncentral_chisquare: a=df, b=nonc, c=size',
        'noncentral_f: a=dfnum, b=dfden, c=nonc, d=size',
        'normal: a=loc, b=scale, c=size', ' pareto: a=a, b=size',
        'poisson: a=lam, b=size', ' power: a=a, b=size',
        'rayleigh: a=scale, b=size', ' standard_cauchy: a=size',
        'standard_exponential: a=size, b=dtype, c=method, c=out',
        'standard_gamma: a=shape, b=size, c=dtype, d=out',
        'standard_normal: a=size, b=dtype, c=out', 'standard_t: a=df, b=size',
        'triangular: a=left, b=mode, c=right, d=size',
        'uniform: a=low, b=high, c=size', 'vonmises: a=mu, b=kappa, c=size',
        'wald: a=mean, b=scale, c=size', 'weibull: a=a, b=size',
        'zipf: a=a, b=size'
    ], 'None', 'None', 'None', 'None'
]
WorkerDefaultExecutable = os.path.join(os.path.dirname(Exec),
                                       'random_number_generator_worker.py')

# </editor-fold>

# <editor-fold desc="The following code is called as its own process when the editor starts the graph">
if __name__ == "__main__":
    random_number_generator_com = gu.start_the_transform_communications_process(
        NodeAttributeType, NodeAttributeNames)
    gu.register_exit_signals(random_number_generator_com.on_kill)
    random_number_generator_com.start_ioloop()
    random_number_generator_com.start_ioloop()

# </editor-fold>
Exemplo n.º 14
0
from Heron import general_utils as gu

Exec = os.path.abspath(__file__)
# </editor-fold>

# <editor-fold desc="The following code is called from the GUI process as part of the generation of the node.
# It is meant to create Node specific elements.
# This is where a new Node's individual elements should be defined">
"""
Properties of the generated Node
"""
BaseName = 'Save Pandas DF'  # The base name can have spaces.

NodeAttributeNames = ['Parameters', 'Row In']
NodeAttributeType = ['Static', 'Input']
ParameterNames = ['Visualisation', 'Columns', 'File Name', 'Overwrite']
ParameterTypes = ['bool', 'str', 'str', 'bool']
ParametersDefaultValues = [False, 'Column 1, Column 2', r'C:\test.df', False]
WorkerDefaultExecutable = os.path.join(os.path.dirname(Exec),
                                       'save_pandas_df_worker.py')
# </editor-fold>

# <editor-fold desc="The following code is called as its own process when the editor starts the graph.
#  You can refactor the name of the xxx_com variable but do not change anything else">
if __name__ == "__main__":
    #  In this case refactor the name sink_template_com to whatever_com
    save_pandas_df_com = gu.start_the_sink_communications_process()
    gu.register_exit_signals(save_pandas_df_com.on_kill)
    save_pandas_df_com.start_ioloop()
# </editor-fold>
Exemplo n.º 15
0
    current_dir = path.dirname(current_dir)
sys.path.insert(0, path.dirname(current_dir))

from Heron import general_utils as gu
Exec = os.path.abspath(__file__)

# <editor-fold desc="The following code is called from the GUI process as part of the generation of the node.
# It is meant to create node specific elements (not part of a generic node).
# This is where a new node's individual elements should be defined">
"""
Properties of the generated Node
"""
BaseName = 'cvtColor'
NodeAttributeNames = ['Parameters', 'Frame In', 'Frame Out']
NodeAttributeType = ['Static', 'Input', 'Output']
ParameterNames = ['Visualisation', 'cvt Enum']
ParameterTypes = ['bool', 'str']
ParametersDefaultValues = [False, 'COLOR_RGB2RGBA']
WorkerDefaultExecutable = os.path.join(os.path.dirname(Exec),
                                       'cvtColor_worker.py')
# </editor-fold>

# <editor-fold desc="The following code is called as its own process when the editor starts the graph">
if __name__ == "__main__":
    cvtColor_com = gu.start_the_transform_communications_process(
        NodeAttributeType, NodeAttributeNames)
    gu.register_exit_signals(cvtColor_com.on_kill)
    cvtColor_com.start_ioloop()

# </editor-fold>
Exemplo n.º 16
0
from Heron import general_utils as gu

Exec = os.path.abspath(__file__)

# <editor-fold desc="The following code is called from the GUI process as part of the generation of the node.
# It is meant to create node specific elements (not part of a generic node).
# This is where a new node's individual elements should be defined">
"""
Properties of the generated Node
"""
BaseName = 'Differencing'
NodeAttributeNames = [
    'Parameters', 'Frame_1_In', 'Frame_2_In', 'Difference_Out'
]
NodeAttributeType = ['Static', 'Input', 'Input', 'Output']
ParameterNames = ['Visualisation', 'Frame 2 - Frame In']
ParameterTypes = ['bool', 'bool']
ParametersDefaultValues = [False, False]
WorkerDefaultExecutable = os.path.join(os.path.dirname(Exec),
                                       'differencing_worker.py')
# </editor-fold>

# <editor-fold desc="The following code is called as its own process when the editor starts the graph">
if __name__ == "__main__":
    differencing_com = gu.start_the_transform_communications_process(
        NodeAttributeType, NodeAttributeNames)
    gu.register_exit_signals(differencing_com.on_kill)
    differencing_com.start_ioloop()

# </editor-fold>
Exemplo n.º 17
0
    current_dir = path.dirname(current_dir)
sys.path.insert(0, path.dirname(current_dir))

from Heron import general_utils as gu

Exec = os.path.abspath(__file__)

# <editor-fold desc="The following code is called from the GUI process as part of the generation of the node.
# It is meant to create node specific elements (not part of a generic node).
# This is where a new nodes individual elements should be defined">
"""
Properties of the generated Node
"""
BaseName = 'Camera'
NodeAttributeNames = ['Parameters', 'Frame Out']
NodeAttributeType = ['Static', 'Output']
ParameterNames = ['Visualisation', 'Cam Index']
ParameterTypes = ['bool', 'int']
ParametersDefaultValues = [False, 0]
WorkerDefaultExecutable = os.path.join(os.path.dirname(Exec),
                                       'camera_worker.py')
# </editor-fold>

# <editor-fold desc="The following code is called as its own process when the editor starts the graph">
if __name__ == "__main__":
    camera_com = gu.start_the_source_communications_process(
        NodeAttributeType, NodeAttributeNames)
    gu.register_exit_signals(camera_com.on_kill)
    camera_com.start_ioloop()
# </editor-fold>
Exemplo n.º 18
0
    current_dir = path.dirname(current_dir)
sys.path.insert(0, path.dirname(current_dir))

from Heron import general_utils as gu
Exec = os.path.abspath(__file__)

# <editor-fold desc="The following code is called from the GUI process as part of the generation of the node.
# It is meant to create node specific elements (not part of a generic node).
# This is where a new node's individual elements should be defined">
"""
Properties of the generated Node
"""
BaseName = 'Resize'
NodeAttributeNames = ['Parameters', 'Frame In', 'Frame Out']
NodeAttributeType = ['Static', 'Input', 'Output']
ParameterNames = ['Visualisation', 'X', 'Y']
ParameterTypes = ['bool', 'int', 'int']
ParametersDefaultValues = [False, 600, 400]
WorkerDefaultExecutable = os.path.join(os.path.dirname(Exec),
                                       'resize_worker.py')
# </editor-fold>

# <editor-fold desc="The following code is called as its own process when the editor starts the graph">
if __name__ == "__main__":
    resize_com = gu.start_the_transform_communications_process(
        NodeAttributeType, NodeAttributeNames)
    gu.register_exit_signals(resize_com.on_kill)
    resize_com.start_ioloop()

# </editor-fold>