SmartWheels self-driving race car. Designed for NXP Cup. Uses FRDM-KL25Z, area-scan camera, and simple image processing to detect and navigate any NXP spec track.
Dependencies: TSI USBDevice mbed-dev
Fork of SmartWheels by
RemovedSources/WheelEncoder.cpp.txt
- Committer:
- hazheng
- Date:
- 2017-04-20
- Revision:
- 100:ffbeefc9e218
- Parent:
- 87:15fcf7891bf9
File content as of revision 100:ffbeefc9e218:
#if 0 #include "WheelEncoder.h" #include "Core.h" #include "SWUSBServer.h" #include "PinAssignment.h" #include "SWUSBServer.h" #include "mbed.h" WheelEncoder::WheelEncoder(SW::Core& core) : m_core(core), m_intRL(InterruptIn(PIN_WE_RL)), m_intRR(InterruptIn(PIN_WE_RR)), m_rrDuration(1.0f), m_rlDuration(1.0f) { m_rrightTimer.start(); m_rleftTimer.start(); m_intRL.rise(callback(this, &WheelEncoder::pulseInRLeft)); m_intRR.rise(callback(this, &WheelEncoder::pulseInRRight)); } void WheelEncoder::Update(float deltaTime) { //int rrHz = 1 / m_rrDuration; //int rlHz = 1 / m_rlDuration; ///char buf[5]; //sprintf(buf, "RR: %d", rrHz); ///m_core.GetUSBServer().PushUnreliableMsg('D', buf); //sprintf(buf, "RL: %d", rlHz); //m_core.GetUSBServer().PushUnreliableMsg('D', buf); } void WheelEncoder::pulseInRRight() { m_rrDuration = m_rrightTimer.read(); m_rrightTimer.stop(); m_rrightTimer.reset(); m_rrightTimer.start(); } void WheelEncoder::pulseInRLeft() { m_rlDuration = m_rleftTimer.read(); m_rleftTimer.stop(); m_rleftTimer.reset(); m_rleftTimer.start(); } #endif //if 0