Expression Items: Difference between revisions

From Software Product Documentation
Jump to navigation Jump to search
Line 66: Line 66:


The general rule is to surround the pipeline parameter with ampersands.
The general rule is to surround the pipeline parameter with ampersands.
===Using a pipeline parameter as part of a signal definition===
The syntax is a little funky when it comes to using pipeline parameters in the middle of a signal definition because of the order in which equations are parsed.
The following subtracts two signals.
:'''Evaluate_Expression'''
:/EXPRESSION=ANALOG::FILTERED&:&:&::INDEX&:&:&X&-METRIC::PROCESSED&:&:&::INDEX&_zero
:/RESULT_NAME=::INDEX
:/RESULT_TYPE=ANALOG
:/RESULT_FOLDER=OFFSET
:''';'''

Revision as of 20:05, 4 January 2024

Data_Tree

Signals should be placed into the expression in the form:

SIGNAL_TYPE::SIGNAL_FOLDER::SIGNAL_NAME

To define a specific element of a signal (e.g. the X Component)

SIGNAL_TYPE::SIGNAL_FOLDER::SIGNAL_NAME::X

To define a specific frame of a data of signal (e.g. Frame 2)

SIGNAL_TYPE::SIGNAL_FOLDER::SIGNAL_NAME[2]

Data stored in the GLOBAL Workspace should be expressed as follows:

GLOBAL::SIGNAL_TYPE::SIGNAL_FOLDER::SIGNAL_NAME

NOTE: Global signals can be accessed regardless of the ACTIVE FILES.

Examples for Specifying a Data Tree Signal

TARGET::ORIGINAL::RFT1 = Signal RFT1 in the TARGET type and ORIGINAL folder
ANALOG::PROCESSED::FX1 = Signal FX1 in the ANALOG type and PROCESSED folder
PARAMETER::ANALOG::RATE= Parameter RATE in the ANALOG group of the C3D PARAMETERS

Model_Builder

Model metrics have a simpler syntax. The Signal Type and Signal Folder need not be specified because there is only one version of a signal.

Creating a Landmark at the center of a ball

Given 6 markers placed on the surface of a round ball
BALL1, BALL2, BALL3, BALL4, BALL5, BALL6
Create a model metric at the center of a best fit sphere to the ball.
Metric Name= BALL
Metric Expression = Best_Fit_Sphere(List(BALL1, BALL2, BALL3, BALL4, BALL5, BALL6))
The resulting metric will have 3 values separated by a comma (e.g. the 3 components of the center)
As an example a center value of (0.5, 0.6, 0.7) would appear as
0.5,0.6,0.7
Create a landmark using this metric data

Note the syntax for the offsets
BALL[1,1]
The syntax may seem a little strange, but [1,1] refers to the first element of the first frame

Pipeline_Parameters

The syntax for using a pipeline parameter as part of an expression is a bit unusual and takes an understanding of how Visual3D parses parameters and pre-processes commands.

The ampersand & is used in pipeline commands to concatenate strings together, and thus is a separator for the parser to find the pieces that need to be parsed separately.

For example, to use a pipeline parameter LP_FREQ:

/EXPRESSION=2*pi()*&::LP_FREQ

The ampersand tells the parser to take the 2*pi()* and the ::LP_FREQ separately through the pre-parser. The first part is just taken as is since it doesn't have a prefix of ::. The value after the & does have a :: prefix, so it is substituted with the pipeline parameter.

If you have more complex expressions, you might need to surround each pipeline parameter with an ampersand

&::LP_FREQ&*&::MULTIPLIER&-&::CONSTANT which may evaluate to something like: 60*1.4-90.0 once all the pipeline parameters are substituted.

The general rule is to surround the pipeline parameter with ampersands.

Using a pipeline parameter as part of a signal definition

The syntax is a little funky when it comes to using pipeline parameters in the middle of a signal definition because of the order in which equations are parsed.

The following subtracts two signals.

Evaluate_Expression
/EXPRESSION=ANALOG::FILTERED&:&:&::INDEX&:&:&X&-METRIC::PROCESSED&:&:&::INDEX&_zero
/RESULT_NAME=::INDEX
/RESULT_TYPE=ANALOG
/RESULT_FOLDER=OFFSET
;
Retrieved from ""