- 3D Simulation Environment for Mobile Robots -
   
   
Light Sensory
(How to use the light sensory classes: RCLightSensoryHandler, RCLightEmitter and RCLightDetector)

Basics

The classes able to simulate a system of light emitters (e.g. LEDs) and detectors (e.g. photo diodes). Currently reflections are not handled but this is planned to be added in very few weeks.
Each simulation using components of the type RCLightEmitter or RCLightDetector need at least one component of type RCLightSensoryHandler which will handle the calculation of the measured values. If you want to simulate sets of emitters and detectors that are not correlating (due to different wave length or modulation) you can simply create more handlers - one for each set.
The classes RCLightEmitter and RCLightDetector are designed to be directed, meaning that they have the greatest intensity/sensitivity along their alignment (the negative z-axis).
For the robot system I intend to simulate I need to measure with one detector from several emitters individually. In practice this is realized by turning only one emitter on at a time for different periods to identify them. However, this requires evaluation of the measured values with high frequency and, thus, is quite unsuitable for the simulation. So I added the ability to set the state of the emitters for different codings (however they would be realized in practice) and also get the measured values from the detectors for different codings.
If you specified a valid skin for VisRaySkin of the handler a line from the detectors will be drawn to every emitter from which the detect light with an intensity greater VisRayTreshold. The more transparent the line is drawn the lower is the detected intensity.

Mathematical Model

The formular for the value Id measured by a detector is the sum of the Idi over all emitters (registered at the same light sensory handler):
Idi = Iei / d2 · cei · cd
where
To minimize the evaluation costs of this forular also with a large number of emitters and detectors the calculation is done from left to right and after the devision is aborted as soon as the current value is already below the IgnoreTreshold of the handler assuming that the characteristics are 1 at most so the value can't grow any more. If the resulting value is also greater the IgnoreTreshold a ray-geometry between the emitter and detector is checked against the environment to test the visibility and only if there is no obstacle detected the value is added to actually detected value.