Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
LIDAR.h
00001 /* 00002 * LIDAR.h 00003 * Copyright (c) 2018, ZHAW 00004 * All rights reserved. 00005 */ 00006 00007 #ifndef LIDAR_H_ 00008 #define LIDAR_H_ 00009 00010 #include <cstdlib> 00011 #include <mbed.h> 00012 00013 /** 00014 * This is a device driver class for the Slamtec RP LIDAR A1. 00015 */ 00016 class LIDAR { 00017 00018 public: 00019 00020 LIDAR(RawSerial& serial); 00021 virtual ~LIDAR(); 00022 short getDistance(short angle); 00023 short getDistanceOfBeacon(); 00024 short getAngleOfBeacon(); 00025 void lookForBeacon(); 00026 00027 private: 00028 00029 static const unsigned short HEADER_SIZE = 7; 00030 static const unsigned short DATA_SIZE = 5; 00031 00032 static const char START_FLAG = 0xA5; 00033 static const char SCAN = 0x20; 00034 static const char STOP = 0x25; 00035 static const char RESET = 0x40; 00036 00037 static const char QUALITY_THRESHOLD = 10; 00038 static const short DISTANCE_THRESHOLD = 10; 00039 static const short DEFAULT_DISTANCE = 10000; 00040 static const short MIN_DISTANCE = 500; 00041 static const short MAX_DISTANCE = 2000; 00042 static const short THRESHOLD = 500; 00043 static const short WINDOW = 75; 00044 static const short MIN_SIZE = 2; 00045 static const short MAX_SIZE = 9; 00046 00047 RawSerial& serial; // reference to serial interface for communication 00048 char headerCounter; 00049 char dataCounter; 00050 char data[DATA_SIZE]; 00051 short distances[360]; // measured distance for every angle value, given in [mm] 00052 short distanceOfBeacon; // distance of detected beacon, given in [mm] 00053 short angleOfBeacon; // angle of detected beacon, given in [degrees] 00054 short dist_copy[360]; 00055 int dist_diff_start[10]; 00056 int dist_diff_stop[10]; 00057 int i; 00058 int n; 00059 int m; 00060 int x; 00061 int range; 00062 bool changed; 00063 short min; 00064 short max; 00065 00066 00067 void receive(); 00068 }; 00069 00070 #endif /* LIDAR_H_ */ 00071
Generated on Thu Jul 14 2022 09:02:36 by
