Brian Shewan Wins the CC Code Challenge (Week 27)

We have a winner of last week’s CC Weekly Code Challenge, sponsored by IAR Systems! We posted a code snippet with an error and challenged the engineering community to find the mistake!

Congratulations to Brian Shewan of Nova Scotia, Canadafor winning the CC Weekly Code Challenge for Week 27! Brian will receive Circuit Cellar 2011 and 2012 Archive CD.

Brian’s correct answer was randomly selected from the pool of responses that correctly identified an error in the code. Brian answered:

Line 22: Shift register won’t shift. Change to “ShiftReg_ClkB <= {ShiftReg_ClkB[1:0], clkA_Change}”

2013_code_challenge_27_answer

You can see the complete list of weekly winners and code challenges here.

What is the CC Weekly Code Challenge?
Each week, Circuit Cellar’s technical editors purposely insert an error in a snippet of code. It could be a semantic error, a syntax error, a design error, a spelling error, or another bug the editors slip in. You are challenged to find the error.Once the submission deadline passes, Circuit Cellar will randomly select one winner from the group of respondents who submit the correct answer.

Inspired? Want to try this week’s challenge? Get started!

Submission Deadline: The deadline for each week’s challenge is Sunday, 12 PM EST. Refer to the Rules, Terms & Conditions for information about eligibility and prizes.

Kang Usman Wins the CC Code Challenge (Week 26)

We have a winner of last week’s CC Weekly Code Challenge, sponsored by IAR Systems! We posted a code snippet with an error and challenged the engineering community to find the mistake!

Congratulations to Kang Usman of Jakarta, Indonesia for winning the CC Weekly Code Challenge for Week 26! Kang will receive an IAR Kickstart: KSK-FM3-48PMC-USB.

Kang’s correct answer was randomly selected from the pool of responses that correctly identified an error in the code. Kang answered:

Line 46: need [ and ]. it should be translate([0,0,2*ThreadThick])

2013_code_challenge_26_answer

You can see the complete list of weekly winners and code challenges here.

What is the CC Weekly Code Challenge?
Each week, Circuit Cellar’s technical editors purposely insert an error in a snippet of code. It could be a semantic error, a syntax error, a design error, a spelling error, or another bug the editors slip in. You are challenged to find the error.Once the submission deadline passes, Circuit Cellar will randomly select one winner from the group of respondents who submit the correct answer.

Inspired? Want to try this week’s challenge? Get started!

Submission Deadline: The deadline for each week’s challenge is Sunday, 12 PM EST. Refer to the Rules, Terms & Conditions for information about eligibility and prizes.

Member Profile: Walter O. Krawec

Walter O. Krawec

Walter O. Krawec

LOCATION:
Upstate New York

OCCUPATION:
Research Assistant and PhD Student, Stevens Institute of Technology

MEMBER STATUS:
Walter has been reading Circuit Cellar since he got his first issue in 1999. Free copies were available at the Trinity College Fire Fighting Robot Contest, which was his first experience with robotics. Circuit Cellar was the first magazine for which he wrote an article (“An HC11 File Manager,” two-part series, issues 129 and 130, 2001).

TECH INTERESTS:
Robotics, among other things. He is particularly interested in developmental and evolutionary robotics (where the robot’s strategies, controllers, and so forth are evolved instead of programmed in directly).

RECENT TECH ACQUISITION:
Walter is enjoying his Raspberry Pi. “What a remarkable product! I think it’s great that I can take my AI software, which I’ve been writing on a PC, copy it to the Raspberry Pi, compile it with GCC, then off it goes with little or no modification!”

CURRENT PROJECTS:
Walter is designing a new programming language and interpreter (for Windows/Mac/Linux, including the Raspberry Pi) that uses a simulated quantum computer to drive a robot. “What better way to learn the basics of quantum computing than by building a robot around one?” The first version of this language is available on his website (walterkrawec.org). He has plans to release an improved version.

THOUGHTS ON EMBEDDED TECH:
Walter said he is amazed with the power of the latest embedded technology, for example the Raspberry Pi. “For less than $40 you have a perfect controller for a robot that can handle incredibly complex programs. Slap on one of those USB battery packs and you have a fully mobile robot,” he said. He used a Pololu Maestro to interface the motors and analog sensors. “It all works and it does everything I need.” However, he added, “If you want to build any of this yourself by hand it can be much harder, especially since most of the cool stuff is surface mount, making it difficult to get started.”

Guido Cargnino Wins the CC Code Challenge (Week 25)

We have a winner of last week’s CC Weekly Code Challenge, sponsored by IAR Systems! We posted a code snippet with an error and challenged the engineering community to find the mistake!

Congratulations to Guido Cargnino of Grugliasco, Turin, Italy  for winning the CC Weekly Code Challenge for Week 25! Guido will receive an Elektor 2012 & 2011 Archive DVD.

Guido’s correct answer was randomly selected from the pool of responses that correctly identified an error in the code. Guido answered:

Line #14: *p and *q must be used.

2013_code_challenge_25_answer

You can see the complete list of weekly winners and code challenges here.

What is the CC Weekly Code Challenge?
Each week, Circuit Cellar’s technical editors purposely insert an error in a snippet of code. It could be a semantic error, a syntax error, a design error, a spelling error, or another bug the editors slip in. You are challenged to find the error.Once the submission deadline passes, Circuit Cellar will randomly select one winner from the group of respondents who submit the correct answer.

Inspired? Want to try this week’s challenge? Get started!

Submission Deadline: The deadline for each week’s challenge is Sunday, 12 PM EST. Refer to the Rules, Terms & Conditions for information about eligibility and prizes.

A Love of Teaching, a Lifetime of Robotics: An Interview with John Blankenship

John Blankenship

John Blankenship

John Blankenship has spent decades teaching robotics—and written many books on the subject. His love of teaching inspired him to co-develop the RobotBASIC robot programming language. I recently caught up with John to discuss some highlights from his teaching career and what’s next for RobotBASIC—Nan Price, Associate Editor

 NAN: How did you become interested in robotics?

JOHN: As a child, I often saw robots on television but was fully aware that there were no computers capable of making such fictional creations a reality. In the 1970s, microprocessors such as Intel’s 8080 and MOS Technology’s 6502 gave me hope that real robots would eventually become part of our future.

I found I could motivate my students by linking lab projects to robotic topics. For example, instead of just graphing the output from an active filter, I had my students use op-amps to detect an ultrasonic wave so they could later build a ranging sensor. I firmly believe that if you want to motivate students, you must give them projects with a purpose.

 NAN: You spent more than 30 years teaching programming, electronics, and robotics. What did you gain from that experience?

 JOHN: I enjoyed teaching electronics, but I loved teaching programming. Nothing else even comes close to develop critical thinking skills in students. Watching those skills develop was the reason I taught.

After seeing how my hardware robotic projects motivated students, I knew I wanted something similar for my programming classes. Eventually I developed a library of C routines that simulated a simple on-screen robot. What made the simulated robot special is that it supported numerous sensors (an electronic compass, two levels of proximity sensors, a ranging sensor, line detection, beacon detection, color tracking, and more) that enabled students to solve relatively complex, real-world robotics problems without building any hardware.

This structure made programming fun because it gave programming assignments a purpose. Students no longer had to be convinced that it was important to learn the syntax for a loop or how “if” statements controlled flow to make decisions—they wanted to learn details so they could use them to solve the exciting problems being proposed for them. Which would you find more exciting: writing a program to count the number of words in a string or teaching a robot to follow a line? Better yet, imagine motivating students by having a contest to see whose robot could follow a line the fastest.

NAN: How and why did you develop the RobotBASIC programming language?

MINOLTA DIGITAL CAMERA

RobotBASIC can control real robots just as easily as the simulation.

 JOHN: When I retired from teaching I wanted a way for other teachers to utilize a simulated robot to motivate their students. I could have just published my C libraries, but that generally would have limited their use to college classes where C is usually taught. I felt strongly that much younger students needed to be introduced to programming so they could develop not just logical thought, but also an appreciation for math and engineering.

I love the C language (RobotBASIC is written in C), but in my opinion, it is far too cryptic to be used as a first language. I wanted to encase my routines in a BASIC-like language that would enable nearly anyone to program a simulated robot.

I began writing my own language and was reasonably pleased with the initial efforts. I demonstrated the program to a good friend of mine, Samuel Mishal, who is easily the greatest programmer I have ever known. After politely applauding my efforts, he showed me an interpreter he had been working on to help him with a DSP project. His language was very polished and far superior to my work. He integrated my simulator with his interpreter and we named it RobotBASIC.

Even though we planned from start to freely distribute RobotBASIC, we knew teachers could not devote time to learning a language that was just a robot simulator. We began adding new features and capabilities. The more we added, the more excited we became. We started testing the new language by developing robotic behaviors and writing simple video games. Every time we needed something special, we added it to the language.

Figure3

RobotBASIC has all the commands necessary to write simple video games.

RobotBASIC currently has nearly 900 commands and functions—far more than most languages. More importantly though, since there are built-in functions to handle many things programmers normally have to do themselves, the language is very fast for an interpreter.

We felt RobotBASIC was an ideal language for introducing high school students to programming, but we wanted more. We added hardware I/O capabilities and created a wireless protocol that enabled RobotBASIC to control real robots with the same programs that control the simulation. At that point, the language could easily handle college-level projects but we knew the BASIC stigma would be a problem. To help with this, we added the option to use a modified C-style syntax, making it easier for students to transition to C or even Java.

Figure4

This simulation shows the effects of friction on a spring’s movement.

We also decided to address some backward capability by adding legacy-style I/O commands, making it easy to teach basic programming skills to even fifth graders. This enables school systems to utilize RobotBASIC from lower grades through high school without having to teach a new environment when new capabilities are needed. And if the C-style syntax is introduced in the upper grades, students will be better prepared for college programming courses.

 NAN: What are some uses for RobotBASIC?

JOHN: Even though students’ needs were a driving force in our development process, RobotBASIC’s I/O capabilities make it a great language for hobbyists involved with robotics or other electronic-oriented projects. For example, it only takes a few lines of code to gather data from a remote temperature sensor using a wireless link and to transmit that information to another user over the Internet.

RobotBASIC also has many commands that facilitate flicker-free animation and simulation. This means teachers have the option of motivating students by teaching how to write simple video games.

As much as I love the robot simulator, I have to admit that many students get even more excited about animation than they do about robots. The point is that RobotBASIC provides many options.

Figure2

The simulated robot can be programmed to solve a maze.

 NAN: You offer several types of RobotBASIC seminars geared toward children, university students, and robot clubs. You also lead seminars introducing programming and robotics. What do you enjoy most about teaching? What do attendees gain from your seminars?

 JOHN: I love teaching and I especially love showing teachers new ways to motivate their students. I understand that every school and teacher is different and I make sure I satisfy their goals by customizing each and every presentation based on their individual needs. I am always amazed that schools can’t believe that RobotBASIC is totally free. There are no acquisition costs, no upgrade fees, and no licenses—ever! RobotBASIC is free for hobbyists too. Circuit Cellar readers can download a copy from RobotBASIC.org.

 NAN: Are you currently working on or planning any robotics-related projects?

Figure6

The speed and flight path of these darts is controlled with finger movements on a tablet’s touchscreen.

JOHN: Many RobotBASIC users have been asking for a more advanced book on animation and video games. Unfortunately, my work on our new RobotBASIC Robot Operating System (On a Chip) has been monopolizing all my time for the last couple of years. Now that it is finally finished, I have started writing again.  I think the new book will be worth the wait because it also discusses how RobotBASIC can interact with the new Windows 8 sensors (e.g., cameras, compass, accelerometer, touchscreen, etc.) The chapter I am currently working on enables darts to be thrown using finger movements on a tablet’s touchscreen.

NAN: Do you have any advice for Circuit Cellar readers who are considering building their own autonomous robots?

 JOHN: I think the biggest mistake most robot hobbyists make is they spend far too much time constructing a robot before having a detailed understanding of its sensory needs and the algorithms necessary to accomplish their goals. If they would test their ideas first with our simulator, they would have the information necessary to build a platform that can actually meet their needs. Furthermore, they could control their real robot with the very same programs they developed on the simulator.