Bearing Sensor The Bearing Sensor is really more of a Bearing Calculator. Components like the Waypoint and Loot Sensors can tell you where a target is. Given that target, the Bearing Sensor allows your rover to maintain a heading toward your goal by telling you whether you're aiming right at it or off to one side. The two inputs you need are the RefBearing, which is the direction you are trying to go, and the FuzzyAngle, which governs the precision of the sensor.

If, somehow, you know where you want to go in advance, you can also feed that value to the BearingSensor by setting it manually.

ICE Thanks to KentQ at CogniToy for dishing out the code for the Bearing Sensor. Let's break it down...
sub sense()
    ' Update TrueBearing
    p as Position
    p = system.getObjectAbsolutePosition()
    TrueBearing = p.getOrientationAngle()
Every 0.24 seconds, sense() gets called, and the rover's orientation in the global reference frame is calculated as a degree value.
    if(TrueBearing < -180) then
      TrueBearing = TrueBearing + 360
    elseif(TrueBearing > 180) then
      TrueBearing = TrueBearing - 360
    end if
TrueBearing gets massaged to insure that it is in the range -180 to 180 degrees. Remember that 0 degrees is forward, +90 is left, and -90 is right.
    DeltaBearing = TrueBearing - AbsoluteRefBearing
    if(DeltaBearing < -180) then
      DeltaBearing = DeltaBearing + 360
    elseif(DeltaBearing > 180) then 
      DeltaBearing = DeltaBearing - 360
    end if
DeltaBearing is calculated as the difference between TrueBearing and AbsoluteRefBearing, which seems to be calculated somewhere else. I have to assume that it is the translation of RefBearing (the desired angle in the vehicle's reference frame) to the absolute reference frame. Then DeltaBearing is also massaged to be between -180 and 180 degrees.
    if(DeltaBearing <> LastFrameDeltaBearing) then    
      call Change.trigger()
      LastFrameDeltaBearing = DeltaBearing
    end if
If DeltaBearing is not the same as last time, then trigger a change event.
    whatEvent as integer
    nextEvent as Event
    if(abs(DeltaBearing) < FuzzyAngle) then
      whatEvent = 0
      nextEvent = OnRef
    elseif
      deltaBearing < 0 then
      whatEvent = -1
      nextEvent = RightOfRef
    else
      whatEvent = 1
      nextEvent = LeftOfRef
    end if
Now check and see if DeltaBearing is bigger than our FuzzyAngle. If it is, then figure out what kind of event to throw.
    ' Only fire nextEvent if it's actually different from last time.
    if whatEvent <> lastEvent then
       lastEvent = whatEvent
       call nextEvent.trigger()
    end if
end sub

And the comment says it all. If it isn't news, we don't wanna know.

Properties The Bearing Sensor has four properties, two of which you will want to keep track of. The other two seem to be for internal use only.

RefBearing The desired bearing. This is relative to the vehicle, not a world angle. You can wire a sensor to feed the destination into this property.
FuzzyAngle Controls how sensitive your BearingSensor is. A smaller FuzzyAngle means that Change events will fire off more often.
DeltaBearing This is the difference between the TrueBearing and the ReferenceBearing. Calculated in the global reference frame, not the vehicle's.
TrueBearing The actual bearing or direction of your vehicle in the global reference frame.

Events

The bearing sensor can trigger four events:

Change Each scan, DeltaBearing is compared to the value that it had the last scan. If they are different, Change is triggered. Looks like you can get Change triggered without one of the other events being triggered. A change in angle is sufficient, regardless of FuzzyAngle.
LeftOfRef Triggered once when the rover's bearing is left of the reference bearing by the value of FuzzyAngle.
OnRef Triggers once when you get with +/- FuzzyAngle of your reference bearing.
RightOfRef Triggered once when the rover's bearing is right of the reference bearing by the value of FuzzyAngle.

This page includes information taken from the Cognitoy forums, by various authors.

MindRover TM , MindRover: The Europa Project TM , and Cognitoy TM are trademarks of CogniToy, LLC, 1999.