
Page 53
4
Not Quite C
In this chapter:
•
A Quick Start
•
RCX Software Architecture
•
NQC Overview
•
Trusty Revisited
•
Online Resources
Once you've written a few programs in RCX Code, it feels a little constrictive. For one thing, there aren't any variables. It would be nice if your robot could remember things, like how many
obstacles it's encountered or what the temperature was three minutes ago. In RCX Code, the only thing remotely resembling a variable is the counter. Back in Chapter 3,
Trusty, a Line Follower,
I
used the counter to remember which way to turn. The counter was always a 0 or a 1, indicating whether the robot should turn left or right. But it's tough going, and if you try anything more
complicated, the counter is not going to get the job done.
The lack of variables is only one of the limitations of RCX Code. Two other important limitations are:
• Although you can define subroutines (called "My Commands"), you can't call one subroutine from another. Likewise, a subroutine can't call itself.
• You can't control the RCX's display very well. It would be really nice, for debugging purposes, to be able to show values on the display.
The LEGO Group aimed the Robotics Invention System at people who had never programmed before. For this group, RCX Code is a gentle way to get started with programming mobile robots.
But RIS is exceedingly popular with programmers and other technically savvy people, who are frustrated by the limitations of RCX Code. If you're reading this chapter, this probably includes you.
Since RIS was released in the Fall of 1998, the MINDSTORMS community has produced an amazing stream of clever, innovative software designed to overcome the limitations of RCX Code.
Most of this software is available, free of charge, on the Internet. In this chapter, I'll describe one of the most popular packages: Not Quite C (NQC). NQC allows you to write programs for your
RCX with a text-based language. I'll describe the syntax and commands of this language, with copious
Содержание MINDSTORMS Robots
Страница 22: ...Page 18 The back tread wheels are anchored to the shafts with the 16t gears ...
Страница 23: ...Page 19 Page 20 Next start building support for the drive motors ...
Страница 25: ...Page 22 Attach the motor wires to output A and output C Next build the platform for the front bumpers ...
Страница 26: ...Page 23 The touch sensors are attached only by the shaft that runs through them ...
Страница 41: ...Page 41 ...
Страница 43: ...Next build the support for the light sensor ...
Страница 80: ...Page 85 Make sure the bump on the long pin is up against the 4u beam ...
Страница 82: ......
Страница 84: ...Page 89 ...
Страница 85: ...Step 14 is similar to Step 11 take a deep breath and go slowly ...
Страница 86: ...Page 90 Grabber Arm In Step 17 the half bushings go between the center block and the cams pear shaped pieces ...
Страница 87: ...Page 91 ...
Страница 88: ...Page 92 Make sure that the two sides are at the same angle They should mirror each other ...
Страница 89: ...Page 93 Page 94 ...
Страница 90: ...Structural Support Page 95 ...
Страница 91: ...Idler Wheel Page 96 ...
Страница 92: ...Page 97 Drive Motor ...
Страница 93: ...While you re putting the motor in hold on to the worm gear so it doesn t slip off Page 98 ...
Страница 94: ...Grabber Arm Motor ...
Страница 95: ...Page 99 ...
Страница 96: ...Page 100 RCX Attach the RCX on both sides as shown Page 101 ...
Страница 158: ......
Страница 159: ...Page 175 The 16t gears are nestled inside the tread wheels ...
Страница 160: ...Page 176 ...
Страница 161: ...Page 177 Attach the motors to output A and output C as shown Page 178 ...
Страница 162: ...The light sensor which is mounted on the bumper is attached to input 2 The touch sensor goes on input 1 Page 179 ...