David's line following code from the LVBots competition, 2015.
Dependencies: GeneralDebouncer Pacer PololuEncoder mbed
Fork of DeadReckoning by
reckoner.h
00001 #pragma once 00002 00003 class Reckoner 00004 { 00005 public: 00006 00007 Reckoner(); 00008 00009 // Together, cos and sin form a vector with a magnitude close to 2^30 that indicates 00010 // the current position of the robot. 00011 // cos corresponds to the x component of the orientation vector. 00012 // sin corresponds to the y component of the orientation vector. 00013 int32_t cosv, sinv; 00014 00015 // Together, x and y are a vector that points from the starting point to the 00016 // robot's current position. 00017 // The untis are Df / (1<<14), where Df is the distance the robot moves forward 00018 // or backwards due to a single encoder tick. 00019 int32_t x, y; 00020 00021 void reset(); 00022 00023 void handleTickLeftForward(); 00024 void handleTickLeftBackward(); 00025 void handleTickRightForward(); 00026 void handleTickRightBackward(); 00027 void handleForward(); 00028 void handleBackward(); 00029 void handleRight(); 00030 void handleLeft(); 00031 void handleTurnRadians(int32_t radians); 00032 void setTurnAngle(int32_t angle); 00033 };
Generated on Sun Jul 17 2022 15:55:09 by 1.7.2