# Blocks¶

Veronte autopilot allows the user to perform custom operations, thus adapting to the user’s data management requirements. Within this menu the user can select the desired input variables, a wide variety of operations to transform the latter, and the output variables where the final processed value will be stored. For instance, in this menu it is possible to configure a Lidar sensor, converting the measured variable by the sensor (voltage) into a physical variable (meters).

The menu to create custom operations is called **Blocks** – see the Figure below. Within the menu the user has:

*Add button*to add a new custom operation.Custom operations display. Next to every operation entry the user will find the following buttons . The

*trash bin*deletes the operation, the*lightning bolt*marks that operation so it is executed continuously, and the*arrows*allow the user to arrange the priority of the operations that have been marked. The non-marked operations are reserved to be executed on demand by creating an Automation.Operation’s name.

Operation definition: input variable(s), output variable(s) and transformations to be executed.

Clicking on the button will enlarge the working space

**Blocks Menu**

As mentioned above, when the *lightning bolt* is marked the operation is then executed at the same frequency as the GNC algorithm (Guidance, Navigation and Control). Following, the blocks available to define an operation are presented. To add a block, the user needs to right-click on the background of the menu – see Figure below.

**Adding Blocks**

The user will commonly want to start reading a variable coming from either the autopilot or a sensor/device. The option

**Read value**must be selected, choosing among*boolean*,*integer*or*real*as the variable type.**Type casting**: this block is used to change from one data type to another. The options available are*Bool to real*,*Integer to real*,*Real to bool*and*Real to integer*.**Wrap**: the output variable is wrapped to keep a value between the upper and lower limits. For example, if the desired Inidicated Air Speed (IAS) is wrapped between 0 and 12 m/s, the output variable will have a value of 12 when the desired IAS is greater than this value, and a value of 0 when it is negative.

**Wrap Block**

**Angle Unwrap**: when an angle is wrapped in the PIDs, e.g. the heading angle, its value is delimited between \(\pi\) and \(-\pi\) radians. The operation presented here undoes that calculation by representing the angle in a range starting at 0 radians.**Build real array**: when choosing this block, the user needs to define the length of the array. The default value is 3. A block with as many entries as defined will appear. Only one exit dot will be available.**Dot product**: this block allows the user to multiply two real arrays of the same length.**Real constant**: when choosing this block, a single constant or an array of constants can be defined. The user needs to define the length of the array, which by default is 1 – i.e. a single constant.**Save value**: the user must choose a variable or several variables to save the transformed information. The variable type can be*boolean*,*integer*or*real*.**Functions**: there are 3 kinds of functions depending on the number of input variables required. There are**1x1**,**2x1**and**Nx1 functions**.**1x1 functions**:**Abs**: returns the absolute value, i.e. the non-negative value, of a variable/operation.**Sin**: returns the sine of an angle (in*rad*).**Cos**: returns the cosine of an angle (in*rad*).**Tan**: returns the tangent of an angle (in*rad*).**Arcsin**: inverse function of the sine. It returns an angle (in*rad*).**Arccos**: inverse function of the cosine. It returns an angle (in*rad*).**Arctan**: inverse function of the tangent. It returns an angle (in*rad*).**Sqrt**: returns the square root of a variable/operation.**Exp**: returns the exponential of a variable/operation.**Log**: returns the natural logarithm of a variable/operaton.**Ceil**: returns the least integer greater than or equal to the incoming variable/operation.**Floor**: returns the greatest integer less than or equal to the incoming variable/operation.**Wrap[pi,-pi]**: returns an angle (in*rad*) wrapped between \(\pi\) and \(-\pi\).**Wrap[0,2pi]**: returns an angle (in*rad*) wrapped between \(0\) and \(2\pi\).**IIR**digital filter: the output filtered variable depends on the present and past inputs (numerator) as well as the past outputs (denominator). The order \(n\) and \(m\) of both the numerator and denominator, respectively, is chosen by adding the desired amount of \(n\) and \(m\) terms – see the Figure below.

**IIR Filter Block**

**2x1 functions**:**Add**: returns the sum of two variables.**Substract**: returns the substraction of two variables – the*upper dot*minus the*lower dot*.**Multiply**: returns the multiplication of two variables.**Divide**: returns the division of two variables – the*upper dot*divided by the*lower dot*.**Power**: returns \(a\) raised to the \(b\) power – where \(a\) is the*upper dot*and \(b\) the*lower dot*.**Max**: returns the maximum value of two variables.**Min**: returns the minimum value of two variables.**Remainder**: returns the remainder after dividing one variable by another – the remainder of the*upper dot*divided by the*lower dot*.**Atan2**: returns an angle in*rad*following the function \(atan2(y,x)\)– where \(y\) is the*upper dot*and \(x\) the*lower dot*.**RTable3D**: returns a variable according to the mapping of two variables – a mapping matrix/table must be defined, where the output variable will be interpolated from.

**RTable3D Block**

**Nx1 functions**:**Array max**: returns two variables, the maximum value of the array and an integer with the position (starting from 0) of the maximum value on the array. The block has one*input dot*(left side) for the array, and two*output dots*(right side): one for the outcoming maximum value and another for the position (in green – that colour indicates that an integer variable must be used).**Array min**: same principle as the previous block but returning the minimum value.**Array multiply**: multiplies all the components of a real array.