Let's Make Robots!

motoko reloaded - msp430 neural network line follower

line follower
AttachmentSize
board.png236.42 KB
schem.png264.8 KB
IMG_20131220_062919.jpg1.73 MB
IMG_20131220_062833.jpg1.65 MB

line follower using two linear neurons (controllers) PD for differential and I for speed; both with antiwindup, error filtering and simulated annealing tunning (take about 80 loops in short testing line loop); second controll stage is curve predictor - table of curves to prevent overshoot (still present)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

you send me the code to study? I'm from Brazil and I became interested in control. misaelgpereira <at> gmail . com

currently i'm working on new firmware - evolution strategy PID tuning, motor controll transfer function has been also changed

sources will be released in approximately one month

How did you implement a nueral PID controller. It's interesting

my PID controller equation (single neuron, with linear transfer with 4 inputs):

u(t) = u(t-1) + k1*e(t) + k2*e(t) + k3*e(t)

don't forget limit u(t) value (real motor have maximal speed limited)

e(t) is error input from sensor; left sensor value is -4, right +4, in center is 0;

this should be filtered first, because difference calculation, and high quantization noise (from sensors you have only 8 values! (3 bits)), the best way is comb filter - i used 4th order, and if you are using fixed point don't divide sum result with filter order

constants calculation from "textbook" equations :

k1 = kp + ki + kd

k2 = -kp - 2kd

k3 = kd

real magic is how to set kp, ki, kd; hebbian rule, backpropagation, Ziegler-Nichols or gradient self tuning may converge in local minima; simulated annealing can avoid this (but take long time), and it is simple to implement - only high quality random generator necessary (i used LFSR ^_^) ; all you need is fitness function; i used this : q = sum ( abs( err(t) ), where err is error obtained from line sensor, goal is to minimize q; one round takes 800 samples (about 4s with 200Hz sampling)

very fast