Lego Robot and Neural Networks

An overview of using Lego RCX  robots for teaching neural networks present at workshop in 2011.

The video below shows the robot trying out sets of weights for two neurones, until a set of weights are found that enable the robot to go around the circle.

As a part of a set of tools I have found the following useful for teaching the principles of simple neurones.

 Example code:

import josx.platform.rcx.*;

public class annlf{
 public static void main(String[] args)
  int w[][] ={//put weights here};
  int o[]={1,1};
  int s1,s2,res1,res2;
  int sensor1=0,sensor2=0;
  robot_1 tom=new robot_1();
   if (sensor1<42)
   if (sensor2<42)
   if (res1>=0)
   if (res2>=0)
   if ((o[0]==1)&&(o[1]==1))
   if ((o[0]==0)&&(o[1]==0))
   if ((o[0]==1)&&(o[1]==0))
   if ((o[0]==0)&&(o[1]==1))

The example code uses two neurones to produce a line follower. The nice thing about this though is it easy to adapted this for a single neuron or multiple neuron tasks. For more on this some examples can be found here.
The above approaches used the Mindstorms RCX robots but it can equally be done with the newer NXT robots

 All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with.

1 comment: