240 likes | 394 Views
Robots: The Friendly Motivating Machine. R. Mark Meyer Canisius College Computer Science Department Buffalo, NY. Outline. Robots in the college curriculum Learning goals Our robots Courses Languages Assignments Experiences and conclusions. Robotics in the college curriculum.
E N D
Robots: The Friendly Motivating Machine R. Mark Meyer Canisius College Computer Science Department Buffalo, NY
Outline • Robots in the college curriculum • Learning goals • Our robots • Courses • Languages • Assignments • Experiences and conclusions
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
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... • how to describe and define a robot • how to interface robot sensors & motors using Java • how to better program traditional loops, decisions, subprograms • how to describe some AI challenges and techniques
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
Our penbots (RCX) RCX penbot LEGO Mindstorms RCX introduced in 1998, sold over one million
Our penbots (NXT) NXT roverbot LEGO Mindstorms NXT introduced in 2006; much different from RCX; reliability issues (failure rate is about 50%)
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
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)
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
Robotran • Translator program • Robolang – a simple Pythonish language • Translator to true Lejos • Used as standalone Java app • Compiles and downloads
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
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
Light Hunter 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 end end 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 end end 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 end end program follow4 global constant BLACK = 42 global var turnedLeft = 1 loop var lightvalue = S3 display lightvalue if lightvalue < BLACK then do findLight else go forward end end
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
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)
Activities & Assignments (CSC 111) • Robot acts like a sentry (back and forth) • Robot avoids obstacles by randomly turning after bumps • Robot randomly moves around (Brownian motion) • Robot responds to input through the buttons • Robot plays music • Robot senses light values and displays numbers on LCD • Robot goes forward only when flashlight is turned on • Robot turns to find light if low light level is sensed • Robot uses more elaborate schemes to find light source • Robot remembers direction of last successful turn to find light • Robot is taught a path which it can then replay (uses arrays) • Robot receives input from bumps and button presses, including binary or unary numbers • Robot draws a letter based on input number
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. • Robot follows a line on the floor, part of drag race competition • Robot tries to stay within a sumo ring while pushing another robot outside the ring • Robot navigates a maze (needs to remember path & obstacles)
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).
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
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%
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
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: • meyer@canisius.edu • burhans@canisius.edu • sheets@canisius.edu