Executing Commands

Command execution is carried out via the special parameter ‘do_execute’ in the ‘set_framegrabber_param’ function. When parallel execution is disabled, the ‘do_execute’ parameter is only supported on handles referencing the tree’s root node.

After opening a stereo camera, you can capture a depth image by simply executing the three commands, with default parameters:

set_framegrabber_param (RootHandle'do_execute''Capture')
set_framegrabber_param (RootHandle'do_execute''ComputeDisparityMap')
set_framegrabber_param (RootHandle'do_execute''ComputePointMap')

To specify additional parameters for the execution, you can simply set the Parameters node before the execution:

set_framegrabber_param (RootHandle'/Execute/Parameters/FinalTrigger''All')
set_framegrabber_param (RootHandle'do_execute''Capture')

Parameters can also be specified inline in JSON notation, after the command:

set_framegrabber_param (RootHandle'do_execute', ['Capture''{"FinalTrigger":"All"}'])

Parallel Execution


You need at least version 1.9 of the NxLib to use the parallel execution.

By default, the ‘do_execute’ parameter uses the NxLib’s default execute node to execute commands. This means that your commands will be executed sequentially, even if you issue them from different handles. When a handle’s ‘parallel_execution’ flag is enabled, it will use its own execute node instead.

If you want to set parameters or get the results of such a command, you can use the ‘exec:’ prefix. It will automatically be replaced with the path to the handle’s execute node.

set_framegrabber_param (RootHandle'exec:Parameters/FinalTrigger''All')
set_framegrabber_param (RootHandle'do_execute''Capture')