Motoko - neural network line follower

This is simple line following robot with minimalistic hardware; Controll algorithm is derivated from PID, improved for this application to two PDD2 controllers (proportional - derivative - 2nd derivative) switched with fuzzy multiplexer. Six controller constants were geneticly calculated on mathematical robot model in Ruby.

following line

  • Actuators / output devices: pololu motors 1:30
  • CPU: msp430f2232
  • Operating system: DustEntityContainer
  • Power source: 7.2V 220mAh Dualsky Li-Pol
  • Programming language: C, ruby
  • Sensors / input devices: 8xCNY70, 3xIR LED RX?TX
  • Target environment: indoor

This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/motoko-neural-network-line-follower

I agree with mogul’s

I agree with mogul’s comment. That’s impressive. 

I would like to see the

I would like to see the code. Any chance? And more info about the geneticly calculated robot model would be useful too. Furthermore an artificial neural network is substantially different from a genetic algorithm, but could be used instead of backpropagation to train the network…Really, we need more info. Thanks.

 

AI NN

Controll process can be divided into two problems

1) speed - traditional P controller, depend on moving average error value

2) diferential - neural network

My neural network controlls diferential. I used two linear neurons with three inputs, and connected them together with fuzzy multiplexer.

Output controlls motor’s speed difference :

fuzzy mux : Y(t) = S(t)A(t) + (1-S(t))B(t);, where S(t) = <0, 1>, and depends on speed value 0 - min speed, 1 - max speed (interval!, not just two values). This mux is with only 1, 0 values equivalent with digital multiplexer.

 

where A(t), B(t) are controllers (or linear neurons) :

example : A(t) = kpE(t) + kd(E(t) - E(t-1)) + kdd*(E(t) - 2*E(t-1) + E(t-2))

E(t) is error, given from line sensors -15, 15 range, 0 if line on center

where kp, kd, kdd are geneticly evolved constants. Mux linear switching controllers. One is trained for straight line, second for more  curve.

Diferential model :(in Z

Diferential model :

(in Z domain)

Y(Z) = ( A/(1+k*Z^-1) ) * (1/Z)

from Newton’s law (F = ma) :

first part represents speed, A is motor power (or something similar…), k is inertia.

second part by integrating speed we get trajectory - robot position;

 

after this we can run genetic algorithm to evolve best controller;

neural network, PID, fuzzy table… anything can be evolved

 

A an k can be obtained from step response - run full speed one motor and scan line position into memory, until leave.

A little more explanation would be appreciated

Hi, I’m really interested in your project. I’m doing the same project at school and I want to apply neural nets as well. I have read some books and watched some tutorials about NN but still don’t know how to implement these into line follower. You said that the six controllers constant were genetically calculated on mathematical model. May I ask you what robot model you used? and would you mind giving me more details about fuzzy mux? Thanks in advance.

can you write me email -

can you write me email - michal.nand <at> gmail.com? this require longer discussion