1 robots: the friendly motivating machine r. mark meyer canisius college computer science department...

24
1 Robots: The Friendly Motivating Machine R. Mark Meyer Canisius College Computer Science Department Buffalo, NY

Post on 20-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

1

Robots: The Friendly Motivating Machine

R. Mark Meyer

Canisius College

Computer Science Department

Buffalo, NY

2

Outline

1. Robots in the college curriculum

2. Learning goals

3. Our robots

4. Courses

5. Languages

6. Assignments

7. Experiences and conclusions

3

Robotics in the college curriculum

• 2006 We were awarded an in-house 3-year grant to introduce robotics into the curriculum.

• It is called the Peter Canisius Distinguished Teaching Professorship– Deb Burhans (CS and Bioinformatics)

– Mark Meyer (CS)

– David Sheets (Physics and Pre-engineering)

• Courses– Computer Science introductory and senior AI

– HONORS program science elective

– First Year Seminar (writing course)

– Engineering 111

4

Goals

• Recruit new CS majors• Retain current CS majors• Make the general studies courses more accessible and fun• Provide new science elective for HONORS curriculum• Motivate freshmen to learn how to write better• Improve early programming skills for CS majors• Introduce AI concepts to juniors/senior CS majors• Learning Goals: the students will know...

1. how to describe and define a robot

2. how to interface robot sensors & motors using Java

3. how to better program traditional loops, decisions, subprograms

4. how to describe some AI challenges and techniques

5

Robots used at Canisius

• Lego Mindstorms RCX (approximately 30)

• Lego Mindstorms NXT (approximately 60)

• Sony AIBO (6) [The cute white “dogs”, no longer made]

• Create from IRobot (1) [A vacuum-less Roomba]

• ER-1 (2) [Evolution robotics, requires a laptop]

• Funded by the in-house grant plus a $70,000 NASA grant

6

Our penbots (RCX)

RCX penbot

LEGO Mindstorms RCX introduced in 1998, sold over one million

7

Our penbots (NXT)

NXT roverbot

LEGO Mindstorms NXT introduced in 2006; much different from RCX; reliability issues (failure rate is about 50%)

8

Courses

• CSC 110 – A “CS 0” course

• CSC 109 – Another “CS 0” course that is solely robotics

• EGR 111 – Introduction to engineering (pre-engineers)

• CSC 111 – Our Java-based “CS 1” 1/3 of the labs are robots

• CSC 360 – Intelligent Systems: AI, robotics, knowledge bases

• CSC 391/491 – Seminar, 1 credit hour special projects

• FYS 101 – First year seminar focused on writing skills

9

Languages

• NXT-G -- graphical programming language

• Lejos and Lejos NXJ – Java plus robot libraries

• Robolang – front end for Lejos used in Robotran

• NQC and Brixcc – tiny C variants for engineering

• Python – used with Create and talking to openCV (vision system)

10

NXT-G

Graphical language

Used in FYS 101

Not free

Intuitive and easy to learn

Has some problems • IDE weaknesses• inherent problems with non-textual language, e.g. interruptions

11

Robotran

Translator program

Robolang – a simple Pythonish language

Translator to true Lejos

Used as standalone Java app

Compiles and downloads

12

Robolang Details

• Streamlined syntax for assignments and control structures, especially button handler methods

• Uses Java expression syntax and transparently inserts into the final Lejos code

• Simplified robot commands:– go forward 10 seconds

• Motor.A.start();• Motor.B.start();• try { Thread.sleep(10000); } catch (Exception e) {}

• Simplified function (method) syntax

13

Simple Light Follower program

program follow1

constant BLACK = 42

loop

var lightvalue = S3

display lightvalue

if lightvalue < BLACK then

stop

else

go forward

end

end

14

Light Hunterprogram follow4global constant BLACK = 42global var turnedLeft = 1loop var lightvalue = S3 display lightvalue if lightvalue < BLACK then do findLight else go forward endend

define huntLeft() returns number turn left sharp 25 degrees var lightvalue = S3 if lightvalue > BLACK then return 1 else turn right sharp 25 degrees return 0 endend

define huntRight() returns number turn right sharp 25 degrees var lightvalue = S3 if lightvalue > BLACK then return 1 else turn left sharp 25 degrees return 0 endend

define findLight var result if turnedLeft = 1 then result = huntLeft() if result = 1 then return end result = huntRight() if result = 1 then turnedLeft = 0 return end end if turnedLeft = 0 then if huntRight() = 1 then return end if huntLeft() = 1 then turnedLeft = 1 return end endend

15

Our simulator

• Simulate the penbot, only one at a time, geared towards real assignments

• Don’t get overly caught up with 3d graphics• Provide functionality with both Robolang and Lejos• Use the lejos compiled code that makes calls to the firmware ROM• Create our own ROM object with same API and let the compiled code,

running in tinyVM, call it• Then our ROM object sends updates to a graphics simulation object• Kudos to students!

– David Puehn did initial design and coding of the simulator– Kevin Mastropaolo took over 2 years ago and did phenomenal debugging

and extending

Screenshot of Simulator

17

Assignments

• Early courses (majors and non-majors)– CSC 109 Build robots for competition using Robolang– CSC 110 Write programs to draw things using Robolang– EGR 111 Write programs using bricxcc– FYS 101 Write programs using NXT-G to learn programming

• CS 1 (usually majors)– Use lejos for wide variety of tasks (listed later)

• Junior/Senior courses (majors)– CSC 360 Robot competition, wumpus world, track following– Seminar Variety of tasks: Sony AIBO, ER-1, etc.

Create robots (Roombas without the vacuum)

18

Activities & Assignments (CSC 111)

1. Robot acts like a sentry (back and forth)

2. Robot avoids obstacles by randomly turning after bumps

3. Robot randomly moves around (Brownian motion)

4. Robot responds to input through the buttons

5. Robot plays music

6. Robot senses light values and displays numbers on LCD

7. Robot goes forward only when flashlight is turned on

8. Robot turns to find light if low light level is sensed

9. Robot uses more elaborate schemes to find light source

10. Robot remembers direction of last successful turn to find light

11. Robot is taught a path which it can then replay (uses arrays)

12. Robot receives input from bumps and button presses, including binary or unary numbers

13. Robot draws a letter based on input number

19

Activities and Assignments (upper level)

These are used in the robot competition, which can be entered by

anyone in any class, from beginning to junior/senior level.

1. Robot follows a line on the floor, part of drag race competition

2. Robot tries to stay within a sumo ring while pushing another robot outside the ring

3. Robot navigates a maze (needs to remember path & obstacles)

20

Strategies for worthwhile assignments

(This applies only to CSC 111 assignments.)• Don’t try to accomplish too much in one program! … keep the

time-frame in mind and how much out-of-lab time they can have.• Reinforce structured programming (use given methods and

construct new ones; emphasize problem decomposition).• Require use of appropriate data structures (usu. Arrays).• Get them thinking about AI issues, especially flexible problem-

solving strategies and multiple alternatives.• Progress from simple to several more complex versions of same

problem, e.g. the light follower.• Use the button press model to reinforce listeners and handlers

which are used in other aspects of Java (like GUIs).

21

Experiences and conclusions• Surveys show a strong positive attitude on part of students• The comments are lavish with praise, but a few thought the RCX

robots were too primitive• FYS 101 students learned to program NXT’s using NXT-G in an

amazingly short timeframe (2 weeks)• CS 1 students said the robots motivate them to stay in CS• More CS 0 students are going on to CS 1 for the fun of it,

especially the CSC 109 students• No significant change in CS 1 final grades or other indicators of

acquisition of programming skills

• Students in 110 and 109 liked Robolang better than Lejos when they got into 111

• In our robot competition, groups used brixcc, Lejos and Robolang and did comparably using any language

22

Our experiences and conclusions (2)• We need a lot of help in the labs (so we hire student helpers)• Grading must be different because we can’t download and test

every single program• Robot labs take a lot more time for students to complete; can’t

do as much “pure CS”• We need to staff after-hours lab time• Students respond much more positively when each has their

own robot to program; group exercises in 110 (made necessary by large number of students) were less gratifying

• So far, no theft and almost no breakage!• NXT failure rate is alarmingly high, about 50%

23

Current and future work

• Finish debugging the Robotran simulator and port to NXT

• Use NXT’s lejos NXJ in CSC 111 next spring

• Develop a platform for CREATEs that uses Python and OpenCV

• Continue refining first year seminar using lessons learned

• Investigate other, more reliable robots for Engineering

24

Our Contact Information

• cs.canisius.edu/~robotics– SOFTWARE tab on left: Several versions of robotran

– COURSES tab: the CSC 111 assignments and Robolang programs

• Canisius Magazine Fall 2006– http://www.canisius.edu/alumni/magazine/sum06/

• email addresses:– [email protected]

[email protected]

[email protected]