Input: 
scalar : LREAL;
vector : ARRAY [0..2] OF LREAL;

Output:

scalar_multiply : ARRAY [0..2] OF LREAL

Type: Function

Responsible: Magnus


Simple helper function for 24_7 Forward Kinematics. Multiplies X,Y,Z with a scalar, and returns the new vector. 

Code Overview
FUNCTION scalar_multiply : ARRAY [0..2] OF LREAL
VAR_INPUT
	scalar : LREAL;
	vector : ARRAY [0..2] OF LREAL;
END_VAR
VAR
	result : ARRAY [0..2] OF LREAL;
	i : INT;
END_VAR

FOR i := 0 TO 2 DO
    result[i] := scalar * vector[i];
END_FOR
scalar_multiply := result;


  • No labels