Core sensors will only perform median filter on the last 9 values measured from the array. This means that the array always has the data collected since the last time a higher level controller read them.
Simplified the control_motion code a bit: the forward behavior now only stops when it sees an obstacle with one sensor on the front, or with both sensors on the same side (hopefully a wall). The control signals it sends to the core are now limited in magnitude, to avoid weird behaviors when the robot finds an obstacle.