Showing posts with label robots. Show all posts
Showing posts with label robots. Show all posts

Monday, 9 May 2011

Robot behaviours

Behaviour based robots was used in the teaching as way of getting the students to think out AI a little deeper and in particular Do we need Human Level intelligence? or rather Do we always need to aim for Human Level Intelligence?


Lego mindstorms robot are a good vehicle for students to start trying out idea around behaviour-based robotics. They are inexpensive, programmable and with the LeJOS software installed on them have behaviours built into the programming which is done in Java.


A good example to use comes from Bagnall's book (B Bagnall (2002) Core Lego Mindstorms: 

Programming the RCX in Java , ISBN: 978-0130093646)


code 1: HitWall

//Taken from Bagnall (2002)
import josx.robotics.*;
import josx.platform.rcx.*;
public class HitWall implements Behavior
{
public boolean takeControl()
{
return Sensor.S2.readBooleanValue();
}
public void suppress()
{
Motor.A.stop();
Motor.C.stop();
}
public void action()
{
Motor.A.backward();
Motor.C.backward();
try{Thread.sleep(1000);}catch(Exception e){}
Motor.A.stop();
try{Thread.sleep(300);}catch(Exception e){}
Motor.C.stop();
}
}

Code 2: DriveForward

//Taken from Bagnall (2002)


import josx.robotics.*;
import josx.platform.rcx.*;
public class DriveForward implements Behavior
{
public boolean takeControl()
{
return true;
}
public void suppress()
{
Motor.A.stop();
Motor.C.stop();
}
public void action()
{
Motor.A.forward();
Motor.C.forward();
}
}



Code 3: Bumper Car

import josx.robotics.*;
public class BumperCar
{
public static void main(String [] args)
{
Behavior b1=new DriveForward();
Behavior b2=new HitWall();
Behavior [] bArray ={b1,b2};
Arbitrator arby=new Arbitrator(bArray);
arby.start();
}
}

Monday, 18 April 2011

robots and artificial intelligence

It has already been point out in earlier blogs (e.g 

Developing problem-solving teaching materials based upon Microsoft Robotics Studio and Problem-solving and robots ) that robots and problem-solving are a go well together. What about advanced problem-solving techniques such as artificial intelligence, do simple lego robots go well with these as a way of developing student's skills?


In my opinion it is a yes. As a part of a set of tools I have found them very 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();
  Sensor.S1.activate();
  Sensor.S3.activate();
  for(;;){
   sensor1=Sensor.S1.readValue();
   sensor2=Sensor.S3.readValue();
   LCD.showNumber(sensor1);
   if (sensor1<42)
    s1=1;
   else
    s1=0;
   if (sensor2<42)
    s2=1;
   else
    s2=0;
   res1=w[0][1]*s1+w[0][2]*s2+w[0][0];
   if (res1>=0)
    o[0]=1;
   else
    o[0]=0;
   res2=w[1][1]*s1+w[1][2]*s2+w[1][0];
   if (res2>=0)
    o[1]=1;
   else
    o[1]=0;
   if ((o[0]==1)&&(o[1]==1))
    tom.forward1(10);
   if ((o[0]==0)&&(o[1]==0))
    tom.backward1(20);
   if ((o[0]==1)&&(o[1]==0))
    tom.tlturn(20);
   if ((o[0]==0)&&(o[1]==1))
    tom.trturn(20);
   LCD.refresh();
  }
 }
}

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. 


 


Sunday, 13 March 2011

junkbots overview

The aim of this project is to introduce concepts of environmental sustainability, engineering and computing. In a fun and educational project that uses the STEM subjects. The project is delivered by university staff and students going into schools to provide guidance and support in the production of the robots.

This project sets out to engage pupils with a set of activities over 12 hours that provides an insight into STEM subjects. The workshops will be structured in the following way:
Activity 1
Introduction to waste management, its impact, recycling and reuse. An introduction to the idea of making robots from rubbish.
Activity 2
Involves some problem-solving exercises (approx. ½ hour), and then in groups investigate adding ‘junk’ with a new electrical components such as batteries and motors to use vibrations to move the robots.
Activity 3
To apply some of the ideas on problem solving and use of materials developed previously to build a little junk-clearing robot.
·         Lego based robots are provided with two light sensors;
·         a play area (containing borders and area for the junk to be placed);
The facilitators will help with programming the robots and the instructions to be used.

Activity 4
The final session will involve the students, with the help of the facilitators, demonstrating and presenting their group’s solutions.
·         Each group will present their work to the other groups in a way they feel is most appropriate- with facilitators help if needed.
·         An hour tinkering time before the presentation will be given to solve any last minute problems.

Target Audience
The project aims to provide an opportunity for year 7,8, or 9 students.

Delivery
This is can be delivered flexibly the restrictions are:
·         Students must get 12 hours of STEM activity
·         Availability of the project team.

Models of Delivery
The project has been delivered so far in two modes
·         Fours short days.
·         Two full days with 2 hours preparation outside of the sessions.

How much do it cost?
All  project team’s costs are covered by the project, as are some of the basic electrical parts essentially a few motors and wires and the Lego robots. The rest, ideally, is provided by the students and anything the school wants to contribute. Northamptonshire Enterprise Ltd and East Midlands Development Agency (emda) are, along with the University of Northampton, supporting for this project.

School resources
It is useful to have two rooms one for building the robots and  a ICT room for preparing the presentations and keeping an journal. It would be helpful for one of the rooms to be suitable for running presentations and for the project team to present a small amount of material.


Student’s Feedback
Building  Junkbots
"We had the [f]reedom to show the teachers what skills we have" (Student BW-B)
"The activity was very fun and creative. We experience lots of difficulties to overcome." (Student BW-K)
"it was nice have time off timetable once in a while" (Student BW-N)
"I found that building the junk bots has made me some new friends..." (Student BW-T)
"...as we[ we]re able to put any ideas forward to put ideas forward to create our own creation" (Student BW-V)
“I enjoyed the activity but I had a few problems” (student M-D)
“I liked this but it was hard at times” (student M-F)
“It was fun” (student M-G)

Waste Management Activity
“...it was cool to know what my carbon footprint is.”
“... made me think about all the waste in the world.”
“[I] now recycle”
"Lots of information which was useful..."(Student BW-B)
"I learnt a lot and calculating my carbon footprint was great" (Student BW-J)
"I learnt about [Eco] stuff" (Student BW-S)
"I found the waste management activity helpf[ul] because it showed me the truth of what we could do to help the earth" (Student BW-T)
"I liked the presentation we were given...interesting facts which we will remember a long time" (Student BW-V)

Programming the Robots.
"Really enjoyed it" (Student BW- G)
"It was really good and the amount I have learnt about Java is incredible" (Student BW- J)
"It was cool because we could program them" (Student BW- Q)
"It was good being the programmer" (student BW- R)
“I enjoyed this the most because it involved problem solving” (student BW- G)

The Project Overall
“it was fun and creative, I learnt quite a bit” (Student T-A)
“It let us be creative with our design.” (Student T-B)
“it opened my eyes to engineering” (Student T-C)
"The whole project was really fun and I enjoyed it lots and I liked making the robots the most" (Student BW- A)
"It was fun because I learnt about carbon emissions and the stuff you need to do the robot" (Student BW- M)
"Overall it was very fun yet informative" (Student BW- R)
"... project was great! It was a great way to teach us more about science, technology, engineering and maths. I also think it improved our problem solving skills. " (Student BW- W)
 “brilliant” (student M-L)
“It was the best activity I have ever done” (Student M-M)

Working in teams
“We liked this activity because it help us work as a team.”
“We really enjoyed ourselves over the last 4 days. We found it very useful.”

For more Information
Contact: Scott Turner
Telephone: 01604 893028

Sunday, 10 January 2010

Developing problem-solving teaching materials based upon Microsoft Robotics Studio.

A series of on-line learning material has been developed based around using Microsoft’s Robotics Studio for teaching problem-solving. It was decided early on in the project that the Visual Programming Language integral to Robotics Studio would be used due to its visual nature.
See www.computing.northampton.ac.uk/~scott/robot2.html

It is expected that these material can be integrated in teaching in two ways. First as sections 1 and 2 are general problem-solving exercises and material, admittedly with a programming bias, so can be integrated in as exercise to enhance these skills.

A spin off from this work has been that the engineering division within this University have adopted the problem-solving exercises as part of their teaching on problem-solving. The third part is the material based using the visual programming language and provides a language for practicing these skills.

Background
Preliminary work within the team (Turner and Hill, 2006), suggests that using LEGO robots within the teaching of problem solving has some benefits to the students. The main benefit being the students believe that robots provide a method to visualise the outcome of a problem.

These types of robots have been used previously for teaching programming to computing students (e.g. Lawhead et al, 2003) and team-working for engineering students (e.g. Price et al 2003). It is the teaching of problem solving within a first year programming module; the role of using robotics is
currently under investigation.

A limiting factor to the approach is availability and numbers of the robots. It is not possible for the robot kits to be available 24 hours a day or to taken home by the students. The focus for this project is to develop the material further into on-line learning packs concerned with problem-solving in first year computing courses. Instead of the robots kits, use Microsoft’s Robotics Studio as the basis of the material. This has been selected to still keep some of the advantages of the robot-based approach but increase flexibility of where and when the student’s can use the material.


Issues and Debates
Teaching issues:
1. How does this approach differ from previous approaches?
The main one is the focus here it is on developing problem solving skills and not on learning a new language so the commands are kept simpler, and then need to learn about objects (or know they are using objects) at this stage is reduced. It is not problem-based learning but really is problem-solving
learning.

2. How does this work fit with what else is going on?
I believe this fits with the work on pre-object programming that is going (Culwin et, 2006), simulation of robots (Becker et al, 2006) and the very visual approach of the work being carried out on learning objects for teaching java .

3. What changes are needed to this approach?
More development is need on making the Visual Programming Language easier to work and as it is a new language there are very resources available to support this. There has been some developments in this area though, mid-2008 at least two books on Microsoft Robotics Studio have been published.

4. Are simulators the way forward?
I think a combination of simulator and real robotics is the way forward for developing problem-solving skills. To do this the current simulator though an excellent tool, but is a little too complicated for 1st year student’s to use this early on in a course.
An interesting development in this area would be an on-line simulator (C# or Java-based), where students type in the routine and the robot actions are simulator for a restricted set of problems. With some further development on the visual programming side, the excellent simulator in the Robotics Studio will be a very useful part of teaching problem-solving.

5. What is the effect of language choice?
For teaching that developing problem-solving skills and leads to proficiency in Java programming skills this approaches has some limitations. If C# was being taught I believe that C# - simulator approach would be particularly appropriate.

Learning issues:
1. Does this approach improve the problem solving skills of students?
There is some evidence of an improvement in grades compare to the previous results. At the moment there is evidence of a slight improvement in the grades for programming compared with previous results, though there might be a bias due to the strength of the cohort.
3. What are the advantages of this approach?
Some have already been reported by others authors when discussing the use of these roots in programming (Lawhead et al, 2003; Price et al, 2003), but they equally applied to their use in problem solving. In Lawhead et al 2003 state that robots “…provide entry level programming students with a physical model to visually demonstrate concepts” and “the most important benefit of using ROBOTS in teaching introductory courses is the focus provided on learning language independent, persistent truths about programming and
programming techniques. ROBOTS readily illustrate the idea of computation as interaction” These advantages also apply to problem solving.

4. What are students’ reactions to using these robots?
Generally positive, but it was noticeable that the most positive comment came from students with more experience in programming.

5. Can these be used on their own to teach problem solving?
I believe they shouldn’t be only approach used but in combination with others.This has always been the approach adapted with this.

6. Is it suited to any other discipline?
I believe it is. The most likely discipline is engineering which has problem solving at the core of the discipline. It has potential for use in others as problem-solving is a key graduate skill. I believe the physical and visual
nature of having an idea and seeing it happen in the ‘real-world’ has potential for building self-confidence in the student’s to tackle problems.

7. How does this relate to problem-based learning?
Currently the approach is best described as problem solving learning. A possible further direction that is being considered for the problem-solving part is a problem based learning approach which seems a sensible direction to take this work. This will be done by making the problem a little more open, and the tutor’s role become much more about assisting them in groups with their problem. This would also help address the possible concern over the ownership of the problem, moving the problem from one that the tutor sets to
their own problem.

8. Where next?
There two other areas that this material can be developed further in. The first is creativity. I do not think that many people would argue against the idea that computing has a strong creative element. The use of the embedded simulator can help with developing this, by adding the ability to create objects, different robots, etc. Confidence building is another area that whatever is done in the simulator will not affect anything outside of it, can I believe, increases thestudent’s confidence to try out different ideas.

Resources

  • Resource directly related to this work.
  • Related resource to this work using some of the same material but based around Java.
  • The MRS software itself can be found at http://msdn2.microsoft.com/enus/robotics/aa731520.aspx
  • Learning to use the Visual Programming Language (VPL) currently the best resources can be found on Microsoft’s own site (http://msdn2.microsoft.com/en-us/robotics/aa731536.aspxhttp://msdn2.microsoft.com/en-us/robotics/aa731536.aspx ) and in particular the tutorial which have been modified and included as part of the material and the on-line video tutorials (http://msdn2.microsoft.com/enus/robotics/bb383569.aspx ).
  • Fincher S and the Computing Education Research Group (2006) Studying Programming ISBN 1-4039-4887-6 Palgrave is a very good introduction to programming and problem-solving. In particular chapter 10 “Grappling with Design” is especially useful for problem-solving.
  • Lawhead et al (2003) contains useful examples for programming using these Lego robots and includes arguments for the inclusion of robotics in the teaching of programming.
  • k) Bibliography
  • Lawhead PB, Bland CG, Barnes DJ, Duncan ME, Goldweber M, Hollingsworth RG, Schep M, A Road Map for Teaching Introductory Programming Using LEGO Mindstorms Robots SIGCSE Bulletin, 35(2): 191-201 (2003)
  • Price BA, Richards M, Petre M, Hirst A and Johnson J, Developing robotics e-teaching for teamwork, Int. J. Cont. Engineering Education and Lifelong Learning, Vol. 13 Nos1/2.(2003)
  • Turner S and Hill G The Inclusion Of Robots Within The Teaching Of Problem Solving: Preliminary Results Proceedings of 7th Annual Conference of the ICS HE Academy Trinity College, Dublin, 29th - 31st August 2006 Proceedings pg 241-242 (2006)
  • Beaumont C and Fox C LEARNING PROGRAMMING: ENHANCING QUALITY THROUGH PROBLEM-BASED LEARNING Proceedings of 4th Annual Conference of the ICS HE Academy Galway 26-28 August 2003 Proceedings pg 241-242 (2003)
  • University of Minnesota Five steps in problem- solving[online] http://cda.mrs.umn.edu/~fauxr/computing/problemsolve.html  (N/A)
  • Bell D, Parr M, Java for Students, 5th Edition, Prentice Hall (2006)
  • Gates, B A Robot in Every Home, Scientific American January pp. 58-65 (2007)