File: ObstacleAvoidance.fcl

package info (click to toggle)
fuzzylite 6.0%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,420 kB
  • sloc: cpp: 25,880; java: 1,370; sh: 85; xml: 12; makefile: 10
file content (34 lines) | stat: -rw-r--r-- 631 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//Code automatically generated with fuzzylite 6.0.

FUNCTION_BLOCK ObstacleAvoidance

VAR_INPUT
  obstacle: REAL;
END_VAR

VAR_OUTPUT
  mSteer: 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 mSteer
  RANGE := (0.000 .. 1.000);
  TERM left := Ramp 1.000 0.000;
  TERM right := Ramp 0.000 1.000;
  METHOD : COG;
  ACCU : MAX;
  DEFAULT := nan;
END_DEFUZZIFY

RULEBLOCK mamdani
  ACT : PROD;
  RULE 1 : if obstacle is left then mSteer is right
  RULE 2 : if obstacle is right then mSteer is left
END_RULEBLOCK

END_FUNCTION_BLOCK