ROME_P5
Dependencies: mbed
LIDAR.h
- Committer:
- Inaueadr
- Date:
- 2018-04-27
- Revision:
- 0:29be10cb0afc
File content as of revision 0:29be10cb0afc:
/* * LIDAR.h * Copyright (c) 2018, ZHAW * All rights reserved. */ #ifndef LIDAR_H_ #define LIDAR_H_ #include <cstdlib> #include <mbed.h> /** * This is a device driver class for the Slamtec RP LIDAR A1. */ class LIDAR { public: LIDAR(RawSerial& serial); virtual ~LIDAR(); short getDistance(short angle); short getDistanceOfBeacon(); short getAngleOfBeacon(); void lookForBeacon(); private: static const unsigned short HEADER_SIZE = 7; static const unsigned short DATA_SIZE = 5; static const char START_FLAG = 0xA5; static const char SCAN = 0x20; static const char STOP = 0x25; static const char RESET = 0x40; static const char QUALITY_THRESHOLD = 10; static const short DISTANCE_THRESHOLD = 10; static const short DEFAULT_DISTANCE = 10000; static const short MIN_DISTANCE = 500; static const short MAX_DISTANCE = 2000; static const short THRESHOLD = 500; static const short WINDOW = 75; static const short MIN_SIZE = 2; static const short MAX_SIZE = 9; RawSerial& serial; // reference to serial interface for communication char headerCounter; char dataCounter; char data[DATA_SIZE]; short distances[360]; // measured distance for every angle value, given in [mm] short distanceOfBeacon; // distance of detected beacon, given in [mm] short angleOfBeacon; // angle of detected beacon, given in [degrees] short dist_copy[360]; int dist_diff_start[10]; int dist_diff_stop[10]; int i; int n; int m; int x; int range; bool changed; short min; short max; void receive(); }; #endif /* LIDAR_H_ */