Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Input: 
IdleOn : BOOL;
Info

Type: Function

Responsible: Magnus

Simple helper function for 24_7 Forward Kinematics. Concept taken from wikipedia. Simply multiplies x1 * x2 + y1 * y2 + z1 * z2 = dot product.

Kenneth


Code Block
languageactionscript3
titleCode Overview
linenumberstrue
FUNCTION_BLOCK dot_funcIdle
VAR_INPUT
	idleON : LREALBOOL;
END_VAR
VAR_INPUT
	v1 : ARRAY [0..2] OF LREAL;
	v2 : ARRAY [0..2] OF LREAL;
END_VAR
VAR
	result : LREALOUTPUT
END_VAR
VAR
END_VAR

IF idleON THEN 
	globals.motorSpeeds[0] := 0;
	globals.motorSpeeds[1] := 0;
	globals.motorSpeeds[2] := 0;
	globals.motorSpeeds[3] := 0;
	iglobals.motorSpeeds[4] := INT0;
END_VAR

FOR i	globals.motorSpeeds[5] :=0 TO 2 DO
	result 0;
	globals.motorSpeeds[6] := result + v1[i] * v2[i]0;
	globals.motorSpeeds[7] := 0;
END_FOR
dot_func := result;IF