-
Notifications
You must be signed in to change notification settings - Fork 29
Closed
Labels
Description
I used this library to control a simulated robot with obstacle avoidance. Fuzzy logic is used to calculate the turn radius based on 2 distance sensors.
For example, with the fuzzy system set up as:
# inputs
leftObstacleSensor.veryStrong = S(0, 25)
leftObstacleSensor.strong = trapezoid(0, 25, 25, 50)
leftObstacleSensor.medium = trapezoid(25, 50, 50, 75)
leftObstacleSensor.weak = trapezoid(50, 75, 75, 100)
leftObstacleSensor.veryWeak = R(75, 100)
rightObstacleSensor.veryStrong = S(0, 25)
rightObstacleSensor.strong = trapezoid(0, 25, 25, 50)
rightObstacleSensor.medium = trapezoid(25, 50, 50, 75)
rightObstacleSensor.weak = trapezoid(50, 75, 75, 100)
rightObstacleSensor.veryWeak = R(75, 100)
#output
turningRadius = Domain("Theta", -50.5, 50.5, res = 0.1)
turningRadius.mediumRight = triangular(-50.5, -49.5)
turningRadius.smallRight = triangular(-25.5, -24.5)
turningRadius.noTurn = triangular(-0.5, 0.5)
turningRadius.smallLeft = triangular(24.5, 25.5)
turningRadius.mediumLeft = triangular(49.5, 50.5)
when executing this rule:
R25 = Rule({(leftObstacleSensor.veryWeak, rightObstacleSensor.veryWeak) : turningRadius.noTurn})
the output is "-50.5" opposed to the expected "0"
My simulated robot project can be found here