Archive for December 2nd, 2009
Albert W. Schueller works for the Department of Mathematics at Whitman College in Walla Walla, Washington. In his impressive 78-page text, “Programming with Robots” he uses ROBOTC with the LEGO Mindstorms NXT to teach programming. Here’s an except from the introduction of “Programming with Robots”:
Why learn the basics of programming using robots instead of more traditional method? For the last 50 years mainstream computer science has centered on the manipulation of abstract digital information. Programming for devices that interact with the physical world has always been an area of specialization for individuals that have already run the gauntlet of abstract information-based computer science.
In recent years, we have seen a proliferation of processing devices that collect and manage information from their real-time environments via some physical interface component-among them, anti-lock brakes, Mars rovers, tele-surgery, articial limbs, and even iPods. As these devices become ubiquitous, a liberally educated person should have some familiarity with the ways in which such devices work-their capabilities and limitations.”
“Programming with Robots” is broken down into 10 sections:
- Hardware and Software
- The Display
- Sensors and Functions
- Loops and Arrays
- Motors and Motion
- Tasks and Sounds
- Inter-Robot Communication
Each section contains background information, thorough explanations, sample code, and practice exercises, making it a comprehensive and valuable tool for educators. The full text is available here: http://carrot.whitman.edu/Robots/notes.pdf
- Mindstorms NXT controller
- Two prototype integrating gyros from HiTechnic. These are not the rate gyros already available. Rate gyros output degrees/sec, which requires a pretty gnarly math process to measure and integrate the results over time to get absolute degrees. The prototype iGyros from HiTechnic do that in hardware, and output absolute degrees, which is very easy for the NXT to deal with with.
- A 3-axis accelerometer to calibrate the gyros using a modified Kalman filter. Basically gyros are right in the short term (seconds) but wrong in the long term (minutes; they drift over time). Meanwhile accelerometers are wrong in short term (they’re noisy) but right in the long term (they don’t drift). So we averge the accelerometer readings over time to correct drift in the gyros.A prototype servo multiplexer from HiTechnic. This is similar to the servo driver accessory that they’re selling as part of the FTC competition kit, but is designed for RC use. It takes I2C output from the NXT and converts it into PWM for the servos. It also has a channel 6 input from the RC receiver that switches it from RC to NXT control (this is our hardware failsafe switch).
- A GPS sensor/datalogger (iBlue 747) that communicates with the NXT via bluetooth.
Video of the UAV in action:
“Play around with Lego Mindstorms NXT enough and at some point you’ll inevitably get frustrated with NXT-G, its graphical programming language of “blocks” that you drag around and connect with “wires”. It’s great for teaching kids the basics, but once they embark on anything remotely ambitious they’re bound to run into trouble. Whether it’s the crazy sprawl of blocks over the work area (even a simple loop can require screens of slow horizontal scrolling), the lack of floating point math or, perhaps worst of all, the total absence of debugging tools, sooner or later you’re going to start longing for a proper programming language that uses, you know, text and stuff.
“if…then…else”, “while”, even “for…next” – you won’t know how much you actually like those constructs until you don’t have them. For anyone who’s ever programmed, there’s nothing better for understanding programming logic than properly tabbed and commented code, all in a column of text as God intended. And for your kids, there’s no time like the present to introduce real programming, using coding conventions that will be as relevant in the decades to come as they were in decades past.
The good news is that there are lots of replacement text-based languages for Mindstorms NXT, from Java to Lua (or, if you want to stick with visual programming, you can also use LabView, the professional-grade language that NXT-G is based on).
Even better news: I’m here to tell you that one stands out from all the rest.
It’s RobotC and it’s simply fantastic. If you’re not a C programmer, don’t worry–aside from a few grammatical conventions, it could be BASIC. But where it really stands out is in the programming environment. RobotC’s integrated development environment (IDE) includes real-time syntax checking, compiling and contextual help and auto-complete of functions and variables. It has an awesome debugger, allowing you to step through your program, set break points and watch variables, or just watch the code executing on the NXT brick. And its collection of instructional and sample programs is unmatched in the Mindstorms world.”
Continue reading the rest of the article here.