CSC 161.02 Grinnell College Fall 2018
Scribbler 2
CSC 161.02:
Imperative Problem Solving and Memory Management
Scribbler 2
Course Home References Course Details: Syllabus, Schedule, Deadlines, Topic organization MyroC Documentation Project Scope/

Note: Although this course is well-developed and tested, be prepared for adjustments in some details as the semester progresses.

Sensors for the Scribbler 2 Robot

A Scribbler 2 robot has numerous sensors for detecting the world. The MyroC library provides a full range of functions, with multiple ways to access the data. Each function allows values of the sensor to be queried several times with an average value returned.

The following figures indicate which functions reference which sensors.

Scribbler forward

Scribbler 2 with
Sensor Set Vector Function Text Functions Values Returned Typical Variability Comments
Light Sensors
(really darkness sensors)
int vals[3]
int n; /*sampleSize*/
rGetLightAll(vals, n);
int n; /*sampleSize*/
rGetLightTxt("left", n);
rGetLightTxt("middle", n);
rGetLightTxt("right", n);
bright light returns values near 0;
dark areas return large integers (about 65535)
under 5%-10% bright, direct light needed for small-value results
IR Scribbler Sensors int vals[2]
int n; /*sampleSize*/
rGetIRAll(vals, n);
int n; /*sampleSize*/
rGetIRTxt("left", n);
rGetIRTxt("right", n);
output 0 indicates no obstacle;
output 1 indicates obstacle
substantial variation likely; sample several times for average light must reflect from emitter to receiver, so obstacle must be a 4-6 inches away

Fluke forward

Scribbler 2 with fluke-forward
Sensor Set Vector Function Text Functions Values Returned Typical Variability Comments
Obstacle Sensors int vals[3]
int n; /*sampleSize*/
rGetObstacleAll(vals, n);
int n; /* sampleSize */
rGetObstacleTxt("left", n);
rGetObstacleTxt("middle", n);
rGetObstacleTxt("right", n);
values near 0 indicate no obstacle (no light reflected from emitters)
large integers (near 6,000) indicates obstacle
substantial variation possible; sensor values degrade as battery degrades value returned depends upon battery strength and output; level of emitters (set by rSetIRPower(level), where level in range 0, 255)
  • values under 1000 are likely to imply no obstacle
  • values over 5000 are likely to imply an obstacle
  • values between 1000 and 5000 may not give definitive results
Virtual Light Sensors int vals[2];
int n; /* sampleSize */
rGetBrightAll(vals, n);
int n; /* sampleSize */
rGetBrightTxt("left", n);
rGetBrightTxt("right", n);
values near 0 represent bright light; values may extend to about 65535 for very dark region variation of 5000-10000 common averaging encouraged for modest consistency
created 19 March 2012 by Henry M. Walker
revised 25 March 2012 by Henry M. Walker
revised (developmental library added) 23 January 2014 by Henry M. Walker
revised (old functions removed) 3 November 2014 by Henry M. Walker
revised as a dynamic, php page 20 January 2018 by Henry M. Walker
Valid HTML 4.01! Valid CSS!