Implementation of the fuzzy control algorithm for obstacle avoidance. This algorithm is for a two-wheel differential drive robot. It uses distance information from 3 analogue IR range sensors and controls DC motors using ESCON servo controllers. This C++ library is written for mbed LPC1768. For any questions and/or reporting bugs contact author: vans.edw@gmail.com

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sensor.h Source File

sensor.h

00001 #ifndef SENSOR_H
00002 #define SENSOR_H
00003 
00004 #include "mbed.h"
00005 
00006 class Sensor
00007 {
00008     public:
00009    
00010         Sensor(PinName pin);
00011         float getDist();
00012         
00013         static const int N;
00014         static const float range;
00015         static float voltage[13];
00016         static float meters[13];
00017 
00018 
00019     private:
00020 
00021         
00022         AnalogIn dist;
00023         float distance;
00024         float LinearInterpolate(float volts);
00025 };
00026 
00027 #endif // SENSOR_H