Example

<< Click to Display Table of Contents >>

Navigation:  Devices > Robotino > Function blocks > Collision detection > Distance sensors >

Example

Previous pageReturn to chapter overviewNext page

The data sheet of the distance sensor (its a Sharp GP2D120) shows the mapping between distance to an object in cm and the sensor's analog output signal in Volt.

 

gp2d120

With this mapping it is easy to configure a transfer function so that the analog voltage is mapped to distance to object in cm. Please notice that this mapping is the inverse of the mapping shown above. This means that we have to skip distances smaller 4cm. Distance smaller 4cm can not be distinguished from distances larger 4cm, because the analog voltage output of the sensor is the same.

 

Furthermore the analog digital converter measures voltages up to 2,55V only.

 

The mapping from analog voltage to distance is also influenced by the material of the detected object. Overall it is best practice to measure the mapping by yourself.

 

robotino_distance_example

 

The values of the transfer function are given below. You can Copy&Paste these values into your own transfer function.

 

0.3        40

0.39        35

0.41        30

0.5        25

0.75        18

0.8        16

0.95        14

1.05        12

1.3        10

1.4        9

1.55        8

1.8        7

2        6

2.35        5

2.55        4