Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
materiels:capteurs:distance:lidar [2019/05/26 12:33] – modification externe 127.0.0.1 | materiels:capteurs:distance:lidar [2022/07/07 09:52] (Version actuelle) – phil | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | [[materiels: | ||
+ | ===== Capteurs - Distance - Lidar ===== | ||
+ | |||
+ | [Mise à jour le 18/6/2021] | ||
+ | |||
+ | |||
+ | ==== Généralités ==== | ||
+ | {{ : | ||
+ | La télédétection par laser ou lidar, acronyme de l' | ||
+ | |||
+ | À la différence du radar qui emploie des ondes radio ou du sonar qui utilise des ondes acoustiques, | ||
+ | |||
+ | Le principe de la télémétrie (détermination de la distance d’un objet), qui concerne une grande partie des applications du lidar, requiert généralement l’utilisation d’un laser impulsionnel. La distance est donnée par la mesure du délai entre l’émission d’une impulsion et la détection d’une impulsion réfléchie, | ||
+ | |||
+ | {{ : | ||
+ | ==== Module Lidar TF Mini ==== | ||
+ | * // **Source** // : < | ||
+ | |||
+ | <callout type=" | ||
+ | |||
+ | * // **Distributeur** // : < | ||
+ | |||
+ | * // | ||
+ | * Alimentation: | ||
+ | * Consommation: | ||
+ | * Plage de mesure: de 0,3 à 12 m | ||
+ | * Précision: | ||
+ | * 1% en dessous de 6 m | ||
+ | * 2 % entre 6 et 12 m | ||
+ | * Résolution: | ||
+ | * Longueur d' | ||
+ | * Pic de puissance: 800 mA | ||
+ | * Fréquence de mesure: 100 Hz | ||
+ | * Interface: UART TTL 3,3 Vcc | ||
+ | * Débits: 115200 bauds | ||
+ | |||
+ | {{ : | ||
+ | * // | ||
+ | * Benewake : < | ||
+ | * Elecrow : < | ||
+ | |||
+ | * // | ||
+ | * //Connexion à un shield// < | ||
+ | * // Un premier exemple pour tester le capteur // | ||
+ | |||
+ | {{ : | ||
+ | <file cpp lidarTFMini.cpp> | ||
+ | /* this program is the interpretation routine of standard output protocol | ||
+ | of TFmini product on Arduino. For details, refer to Product Specifications. | ||
+ | For Arduino boards with only one serial port like UNO board, the function | ||
+ | of software visual serial port is to be used. */ | ||
+ | |||
+ | // Connections | ||
+ | #define RX 5 // O3 Shield Tinkerkit | ||
+ | #define TX 6 // O4 Shield Tinkerkit | ||
+ | #include < | ||
+ | |||
+ | //define software serial port name as Serial1 and | ||
+ | //define pin5 as RX | ||
+ | //and pin6 as TX | ||
+ | SoftwareSerial Serial1(RX, TX); | ||
+ | |||
+ | /* For Arduinoboards with multiple serial ports like DUEboard, interpret above two pieces of code and | ||
+ | directly use Serial1 serial port */ | ||
+ | |||
+ | int dist; // | ||
+ | int strength; //signal strength of LiDAR | ||
+ | int check; | ||
+ | int i; | ||
+ | int uart[9]; | ||
+ | const int HEADER = 0x59; //frame header of data package | ||
+ | |||
+ | void setup() | ||
+ | { | ||
+ | Serial.begin(9600); | ||
+ | Serial1.begin(115200); | ||
+ | } | ||
+ | |||
+ | void loop() | ||
+ | { | ||
+ | if (Serial1.available()) //check if serial port has data input | ||
+ | { | ||
+ | if (Serial1.read() == HEADER) //assess data package frame header 0x59 | ||
+ | { | ||
+ | uart[0] = HEADER; | ||
+ | if (Serial1.read() == HEADER) //assess data package frame header 0x59 | ||
+ | { | ||
+ | uart[1] = HEADER; | ||
+ | for (i = 2; i < 9; i++) //save data in array | ||
+ | { | ||
+ | uart[i] = Serial1.read(); | ||
+ | } | ||
+ | check = uart[0] + uart[1] + uart[2] + uart[3] + uart[4] + uart[5] + uart[6] + uart[7]; | ||
+ | if (uart[8] == (check & 0xff)) //verify the received data as per protocol | ||
+ | { | ||
+ | dist = uart[2] + uart[3] * 256; // | ||
+ | strength = uart[4] + uart[5] * 256; //calculate signal strength value | ||
+ | Serial.print(" | ||
+ | Serial.print(dist); | ||
+ | Serial.print(' | ||
+ | Serial.print(" | ||
+ | Serial.print(strength); | ||
+ | Serial.print(' | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | {{ : | ||
+ | <callout type=" | ||
+ | |||
+ | |||
+ | ---- |