//Code automatically generated with fuzzylite 6.0.

FUNCTION_BLOCK ObstacleAvoidance

VAR_INPUT
  obstacle: REAL;
END_VAR

VAR_OUTPUT
  tsSteer: REAL;
END_VAR

FUZZIFY obstacle
  RANGE := (0.000 .. 1.000);
  TERM left := Ramp 1.000 0.000;
  TERM right := Ramp 0.000 1.000;
END_FUZZIFY

DEFUZZIFY tsSteer
  RANGE := (0.000 .. 1.000);
  TERM left := 0.333;
  TERM right := 0.666;
  METHOD : COGS;
  ACCU : MAX;
  DEFAULT := nan;
END_DEFUZZIFY

RULEBLOCK takagiSugeno
  RULE 1 : if obstacle is left then tsSteer is right
  RULE 2 : if obstacle is right then tsSteer is left
END_RULEBLOCK

END_FUNCTION_BLOCK
