[From Bruce Abbott (2018.02.12.1105 EST)]
I’ve just posted several new Lego ev3-based demos on my YouTube site. The first shows an ev3 vehicle that has a color sensor mounted on each side above the driving wheels. Both sensors operate in “ambient light intensity” mode, returning a number proportional to the intensity of light falling on the sensor. The two driving wheels, which are driven by separate motors, steer the vehicle by slowing one or the other motor below its set speed based on the difference in sensed intensity of the light falling on the two sensors. In the first video, the vehicle moves toward a bright light located at some distance from the starting location. (Biologists refer to this type of control as a positive phototaxis.) An ultrasonic distance sensor stops both motors when the distance to a wall or other obstacle is less than 10 cm.
The second video shows the same vehicle behaving under a spot of light being projected on the floor in an otherwise darkened room. The behavior observed resembles that of a moth drawn to a light.
A phototaxis requires at least two light sensors to register the difference in light intensities on opposite sides. A simple test for the presence of a phototaxis is to cover or otherwise blind one of the two sensors; if a phototaxis is at work you will observe “circus” behavior – in the case of a positive phototaxis the critter will be moving in tight circles, turning in the direction of the operable eye as the system fruitlessly attempts to increase the signal from the blind eye. I tested this with the ev3 by unplugging one of the two sensors and observed exactly this behavior.
The third video again shows the same ev3 but now the program’s “polarity” has been reversed so that the ev3 turns away from the bright side and keeps turning until the sensors are registering equal intensities. At that point the vehicle is speeding directly away from the light source. Biologists call this a negative phototaxis; it is the behavior shown by cockroaches that scatter for the dark places when the lights are turned on.
The fourth and final new video recreates Bill Power’s “Crowd” demo in “Lorenz” mode. The same ev3 serves as a “mother duck,” while a second ev3 acts as the duckling. The mother duck is seen heading for a distant light while the duckling follows its mother at a short distance. When the mother reaches the light and stops, the duckling catches up and comes to a stop close to its mother.
The reason why the duckling follows its mother is that the ducking is equipped with an infrared sensor and the mother has an infrared beacon attached to her tail. The infrared sensor provides numbers reflecting the angular position of the beacon relative to the sensor, and the ev3’s two driving motors’ relative speeds are determined by this angle, such that the vehicle will turn in a direction that reduces the beam’s angular position to zero. The infrared sensor also provides numbers proportional to the “proximity,” or distance between the sensor and beacon; this number determines the overall speed of the two motors. As the distance decreases, the motor speeds decrease. Thus, when the duckling finally catches up to its mother, its forward speed reduces with the distance until the speed reaches zero, leaving the duckling close to mama.
You can view all these demos at https://www.youtube.com/channel/UC7jvewkUPeP777s7HQgKmXA

Mama duck and her baby.
Bruce
