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: MODSERIAL PiSlingers m3pi mbed
IRBehaviorController.h
00001 #ifndef __IRBEHAVIORCONTROLLER_H__ 00002 #define __IRBEHAVIORCONTROLLER_H__ 00003 00004 #include "mbed.h" 00005 #include "IRObjDetector.h" 00006 #include "PID.h" 00007 00008 class IRBehaviorController 00009 { 00010 public: 00011 IRBehaviorController(PID *pid) : pid(pid) 00012 { 00013 debug = NULL; 00014 activationThreshold = 0.0f; 00015 brightness = 0.0f; 00016 output = 0.0f; 00017 }; 00018 00019 IRBehaviorController(PID * pid, Serial * debug) : debug(debug), ird(debug), pid(pid) 00020 //IRBehaviorController(PID * pid, Serial * debug) : debug(debug), pid(pid) 00021 { 00022 activationThreshold = 0.0f; 00023 brightness = 0.0f; 00024 output = 0.0f; 00025 }; 00026 00027 void setAvoidanceBehavior(float threshold); 00028 void setSeekingBehavior(float threshold); 00029 00030 void setActiveThreshold(float threshold); // Brightness level at which behavior is active. 00031 00032 void runAvoidance(void); // Execute avoidance behavior 00033 void runSeeking(void); // Execute seeking behavior 00034 00035 float getPower(void); // Returns the power value needed to execute the behavior. 00036 float getBrightness(void); 00037 float getCenteroid(void); 00038 00039 void dumpDebug(Serial *debug); 00040 00041 private: 00042 00043 void scanIR(void); 00044 00045 Serial *debug; 00046 00047 IRObjDetector ird; 00048 PID *pid; 00049 00050 float activationThreshold; // Brightness threshold at which behavior is active. 00051 float brightness; 00052 float centeroid; 00053 00054 float output; 00055 }; 00056 #endif
Generated on Tue Jul 12 2022 16:13:52 by
1.7.2