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:
- 64:43ab429a37e0
- Parent:
- 63:d9a81b3d69f5
- Child:
- 65:295c222fdf88
--- a/main.cpp Sun Apr 09 22:08:34 2017 +0000 +++ b/main.cpp Mon Apr 10 16:44:31 2017 +0000 @@ -52,10 +52,10 @@ ardu_cam_init(); - uint8_t IMUInitResult = imu_manager_init(); - LOGI("IMU Init: %#x", IMUInitResult); - imu_manager_calibrate(); - imu_manager_begin_tick(); + //uint8_t IMUInitResult = imu_manager_init(); + //LOGI("IMU Init: %#x", IMUInitResult); + //imu_manager_calibrate(); + //imu_manager_begin_tick(); //wait(0.5); //timer.reset(); @@ -84,6 +84,16 @@ //ardu_cam_display_img_utft(); image_processing(); + uint8_t shouldTerminate = ardu_cam_get_is_encounter_terminate(); + + if(shouldTerminate) + { + ardu_utft_print("Finished!!!", 230, 100); + motor_set_right_speed(0.0f); + motor_set_left_speed(0.0f); + return 0; + } + const volatile uint8_t * centerLine = ardu_cam_get_center_array(); /////////////Calculate the curvature: @@ -148,18 +158,19 @@ //imu_manager_init(); //imu_manager_update(); + //float imuTemp = imu_manager_get_temp(); //const volatile struct imu_vec3* AccelV = imu_manager_get_accl(); - //LOGI("A: %5.3f, %5.3f, %5.3f ", AccelV->x, AccelV->y, AccelV->z); + //LOGI("A: %5.3f, %5.3f, %5.3f.T%5.2f ", AccelV->x, AccelV->y, AccelV->z, imuTemp); //const volatile struct imu_vec3* VelocityV = imu_manager_get_velocity(); - //LOGI("V: %5.3f, %5.3f, %5.3f ", VelocityV->x, VelocityV->y, VelocityV->z); + //LOGI("V: %5.3f, %5.3f, %5.3f.T%5.2f ", VelocityV->x, VelocityV->y, VelocityV->z, imuTemp); - const volatile struct imu_vec3* PositionV = imu_manager_get_position(); + //const volatile struct imu_vec3* PositionV = imu_manager_get_position(); - LOGI("P: %5.3f, %5.3f, %5.3f ", PositionV->x, PositionV->y, PositionV->z); + //LOGI("P: %5.3f, %5.3f, %5.3f ", PositionV->x, PositionV->y, PositionV->z); counter.Update();