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
Diff: main.cpp
- Revision:
- 56:7d3395ae022d
- Parent:
- 55:d4db9eef4a9d
- Child:
- 57:0d8a155d511d
--- a/main.cpp Thu Apr 06 21:43:15 2017 +0000 +++ b/main.cpp Thu Apr 06 22:19:59 2017 +0000 @@ -3,6 +3,10 @@ #include <math.h> #define PI 3.14159265f +#define SW_DEBUG +#include "SWCommon.h" +#include "GlobalVariable.h" + #include "Motor.h" #include "Servo.h" #include "WheelEncoder.h" @@ -13,11 +17,15 @@ #include "ArduUTFT.h" #include "PinAssignment.h" -#include "GlobalVariable.h" SPI g_spi_port(PIN_SPI_MOSI, PIN_SPI_MISO, PIN_SPI_SCK); SW::Core g_core; +#ifdef SW_DEBUG +#include <rtos.h> +Mutex g_sw_spi_lock; +#endif + int main(void) { Timer timer; @@ -125,6 +133,8 @@ motor_set_right_speed(speedRatio * ((MOTOR_DIFF_MIN_SPEED) + ((1.0f - MOTOR_DIFF_MIN_SPEED) * ((SERVO_MAX_ANGLE - abs(totalAngleDegrees)) / SERVO_MAX_ANGLE)))); motor_set_left_speed(speedRatio * 1.0f); } + + LOGI("FPS: %f", 1 / deltaTime); /* //////// Steer Vehicle / Adjust Speed for Differential ////////// servo_set_angle((angleDegrees * -0.3f) + (offsetPercent * SERVO_MAX_ANGLE * 0.3f));