This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
et:examples:sensor:lidar [2013/06/21 09:20] – heikopikner | et:examples:sensor:lidar [2020/07/20 09:00] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | < | ||
====== Lidar ====== | ====== Lidar ====== | ||
Line 6: | Line 7: | ||
===== Teooria ===== | ===== Teooria ===== | ||
- | [{{ : | + | [{{ : |
- | LIDAR (Light Detection | + | LIDAR (LIght Detection |
- | Lidar consists of a transmitter which illuminates a target with a laser beam, and a receiver capable of detecting the component of light which is essentially coaxial with the transmitted beam. Receiver sensors calculate a distance, based on the time needed for the light to reach the target and return. A mechanical mechanism with a mirror sweeps the light beam to cover the required scene in a plane or even in three dimensions, using a rotating nodding mirror. | + | Lidar koosneb laserist, mis saadab kiire objektini ja vastuvõtjast. Vastuvõtja on võimeline mõõtma valguse tagasipeegeldunud komponenti objektilt, mis on samasihiline saadetud laserkiirega. Selle järgi arvutatakse kaugus. Mõõtmisi tehakse paljudes punktides. Laserkiire juhtimine toimub mehhaaniliselt liigutatava peegli abil. Tasapinnalist skaneerimist võimaldavad lidarid on odavamad. Nende puhul katab kiir tasapinna, näiteks 180 kraadi ulatuses. |
- | One way to measure the time of flight for the light beam is to use a pulsed laser and then measure the elapsed time directly. Electronics capable of resolving picoseconds are required in such devices and they are therefore very expensive. Another method is to measure the phase shift of the reflected light. | + | [{{ : |
+ | |||
+ | Valguse tagasipeegeldunud komponendi mõõtmiseks on kaks erinevat viisi. Esimesel juhul saadetakse välja infrapuna laseri impulss ja oodatakse, kuni see tagasi peegeldub. Tagasipeegeldumise aja järgi saab arvutada antud suunas oleva objekti kauguse. Kuna mõõtmine toimub pikosekundites, | ||
- | [{{ | + | [{{:et: |
- | Collimated infrared laser is used to the phase-shift measurement. For surfaces, having a roughness greater than the wavelength of the incident light, diffuse reflection will occur. The component of the infrared light will return almost parallel to the transmitted beam for objects. | + | Teine odavam võimalus on kasutada moduleeritud infrapuna laserkiirt ja mõõta saadetava ja objektilt tagasipeegelduva valguse faasinihet. Faasinihke suurus on sõltuv objekti kaugusest. |
- | + | ||
- | + | ||
- | [{{: | + | |
- | + | ||
- | + | ||
- | The sensor measures the phase shift between the transmitted and reflected signals. The picture shows how this technique can be used to measure distance. The wavelength of the modulating signal obeys the equation: | + | |
c = f ∙ τ | c = f ∙ τ | ||
- | where c is the speed of light and f the modulating frequency and τ the known modulating wavelength. | + | kus c on valguse kiirus, |
- | The total distance | + | Summaarne kaugus |
D' = B + 2A = B + (θ * τ) / 2π | D' = B + 2A = B + (θ * τ) / 2π | ||
- | where A is the measured distance. | + | kus A on mõõdetav kaugus ja B on faasinihkesensori vahemaa kiirtelahutajast. Soovitud kaugus |
D = τ * θ / 4π | D = τ * θ / 4π | ||
- | where θ is the electronically measured phase difference between the transmitted and reflected light beams. | + | kus θ on elektrooniliselt mõõdetav faasi erinevus kiiratud ja tagasipeegeldunud valguskiire vahel. |
- | + | ||
- | It can be shown that the range is inversely proportional to the square of the received signal amplitude, directly affecting the sensor’s accuracy. | + | |
===== Praktika ===== | ===== Praktika ===== | ||
- | [{{ : | + | [{{ : |
+ | Robootikas ja tööstuses on SICK laserkaugusmõõdikud laialdaselt kasutustusel. SICK LMS 200 on lihtsalt ühendatav RS-232 või RS-422 liidese abil, võimaldades skaneerida 180 kraadist ala 80 meetri kauguselt. Lidari tööpõhimõte seisneb saadetud valgusimpulsi tagasipeegeldumiseks kulunud aja mõõtmises. Paremal oleval pildil on ühe skaneerimise tulemused kujutatud kaardina. | ||
- | In autonomous robotics as well as industrial robotics SICK laser rangers are very widely used. The SICK LMS 200 can easily be interfaced through RS-232 or RS-422, providing distance measurements over a 180 degree area up to 80 meters away. This lidar is based on a time-of-flight measurement principle. The example output of one scan measurement result is shown in the picture on the right. | + | [{{ : |
- | [{{ : | + | SICK lidari töökorda seadmiseks tuleb ühendada toite ja andmeside kaablid. Lidari tagaosas ülemise nurga lähedal on kaks pistikut, mis sarnanevad arvuti jadaliidese pordi omaga. Emane pistik on mõeldud toite ja isane andmeside jaoks. Toite ja jadaliidese kaabel tuleb ühendada vastavalt pildile. Lidari saab ühendada kodulabori kommunikatsioonimooduliga RS-232 pistiku abil. Toide 24 V dc tuleb võtta eraldi toiteallikast, |
- | To make the SICK operational, | + | SICK võtab vastu käsklusi bittide striimina jadaliidese vahendusel. Andmete edastamisel saadab andur tagasi bittide jada sõltuvalt mõõtetulemusest antud nurgas. |
- | The SICK receives commands as streams of bytes through the serial port. When transmitting data, it sends back streams of bytes corresponding to distance measurements at a given angle. | + | Andmete saamiseks andurilt tuleb kõigepealt saata stardistring, |
- | To grab data from the SICK, you must first send a start string to tell the sensor to start sending data. This string is: | + | Kuueteistkümmnendkujul: |
- | + | ||
- | Hexadecimal Form: | + | |
- | Decimal Form: 2 0 2 0 32 36 52 8 | + | Kümnendkujul: 2 0 2 0 32 36 52 8 |
- | If the start string is successfully sent, Lidar will begin streaming data over RS232. Incoming data from a scan is sent sequentially as the sensor scans through 180°. For example if the sensor is set to scan 180° with resolution of 0.5° the first data point which was sent will correspond to 0°, the next will correspond to 0.5°, the following to 1°, and so on. This means there is total of 361 data points. Each distance measurement is sent in the form of two bytes. The least signifficant byte is sent first followed by the most signifficant byte. Operating in metric | + | Kui stardistring on edukalt saadetud, alustab lidar andmete striimimist üle jadaliidese. Andmed skaneerimise tulemusest saadetakse järjestikku iga kraadi kohta. Näiteks kui lidar on seadistatud skaneerima |
- | Finally to stop the sensor from sending data a stop string must be sent. This string is: | + | Andmete saatmise lõpetamiseks tuleb saata stopp käsk. See käsk on järgnev: |
- | Hexadecimal Form: | + | Kuueteistkümmnendkujul: |
- | Decimal Form: 2 0 2 0 32 37 53 8 | + | Kümnendkujul: 2 0 2 0 32 37 53 8 |
- | Following example shows how to initiate Lidar and get the count of package. | + | Järgmine näide tutvustab, kuidas seadistada lidar ja lugeda saabunud pakettide arvu, kasutades kodulaborit. |
<code c> | <code c> | ||
Line 131: | Line 124: | ||
new_value2 = pin_get_debounced_value(button2); | new_value2 = pin_get_debounced_value(button2); | ||
- | // Nupp S1 on alla vajutatud. | + | // Nupp S1 on alla vajutatud |
if((!new_value1) && (old_value1)) | if((!new_value1) && (old_value1)) | ||
{ | { | ||
- | //Saada lidarile "02 00 02 00 20 24 34 08", et alustada skanneerimist. | + | //Saada lidarile "02 00 02 00 20 24 34 08", et alustada skanneerimist |
usart_send_char(port, | usart_send_char(port, | ||
usart_send_char(port, | usart_send_char(port, | ||
Line 145: | Line 138: | ||
} | } | ||
- | // Nupp S2 on alla vajutatud. | + | // Nupp S2 on alla vajutatud |
if((!new_value2) && (old_value2)) | if((!new_value2) && (old_value2)) | ||
{ | { | ||
//Saada lidarile "0x 02 00 02 00 20 25 35 08", et lõpetada | //Saada lidarile "0x 02 00 02 00 20 25 35 08", et lõpetada | ||
- | // | + | // |
usart_send_char(port, | usart_send_char(port, | ||
usart_send_char(port, | usart_send_char(port, | ||
Line 160: | Line 153: | ||
} | } | ||
- | // Mäleta nupu viimast olekut. | + | // Mäleta nupu viimast olekut |
old_value1 = new_value1; | old_value1 = new_value1; | ||
old_value2 = new_value2; | old_value2 = new_value2; | ||
Line 167: | Line 160: | ||
if (usart_try_read_char(port, | if (usart_try_read_char(port, | ||
{ | { | ||
- | // Paketi päise "0x 02 81 D6 02 B0 69 41" otsimine | + | // Paketi päise "0x 02 81 D6 02 B0 69 41" otsimine |
- | // ja selle järgi pakettide loendamine | + | |
if(c == 0x02) i++; | if(c == 0x02) i++; | ||
if(c == 0x81) i++; | if(c == 0x81) i++; | ||
Line 177: | Line 169: | ||
if(c == 0x41) i++; | if(c == 0x41) i++; | ||
- | // Päise | + | // Päise |
if(i >= 7) | if(i >= 7) | ||
{ | { | ||
Line 183: | Line 175: | ||
count++; | count++; | ||
- | //Kuvatakse pakettide arv LCD ekraanil. | + | //LCD ekraanil |
lcd_gfx_goto_char_xy(0, | lcd_gfx_goto_char_xy(0, | ||