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 haofan Zheng

Committer:
Bobymicjohn
Date:
Sat Apr 08 17:44:39 2017 +0000
Revision:
58:996effac29b9
Parent:
57:0d8a155d511d
Child:
72:b8f2eebc8912
Child:
74:2d45b954deb1
Added cornering speed factor.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Bobymicjohn 4:25e028102625 1 #pragma once
Bobymicjohn 8:92f6baeea027 2
Bobymicjohn 8:92f6baeea027 3 #include <mbed.h>
Bobymicjohn 8:92f6baeea027 4
hazheng 46:a5eb9bd3bb55 5 #define MotorDir uint8_t
hazheng 44:15de535c4005 6 #define MDIR_Forward 0
hazheng 44:15de535c4005 7 #define MDIR_Backward 1
Bobymicjohn 8:92f6baeea027 8
hazheng 46:a5eb9bd3bb55 9
Bobymicjohn 58:996effac29b9 10 #define MOTOR_MAX_SPEED_LIMIT 0.4f
hazheng 53:36d9335fec96 11
hazheng 57:0d8a155d511d 12 #define MOTOR_DIFF_MIN_SPEED 0.55f
hazheng 52:078b521c9edf 13
hazheng 46:a5eb9bd3bb55 14 #ifdef __cplusplus
hazheng 46:a5eb9bd3bb55 15 extern "C" {
hazheng 46:a5eb9bd3bb55 16 #endif
hazheng 46:a5eb9bd3bb55 17
hazheng 46:a5eb9bd3bb55 18 void motor_init();
hazheng 46:a5eb9bd3bb55 19
hazheng 46:a5eb9bd3bb55 20 void motor_set_left_speed(const float speed);
hazheng 46:a5eb9bd3bb55 21
hazheng 46:a5eb9bd3bb55 22 void motor_set_right_speed(const float speed);
hazheng 46:a5eb9bd3bb55 23
hazheng 46:a5eb9bd3bb55 24 inline void motor_set_speeds(const float speed_left, const float speed_right)
Bobymicjohn 11:676ea42afd56 25 {
hazheng 46:a5eb9bd3bb55 26 motor_set_left_speed(speed_left);
hazheng 46:a5eb9bd3bb55 27 motor_set_right_speed(speed_right);
Bobymicjohn 11:676ea42afd56 28 }
Bobymicjohn 4:25e028102625 29
hazheng 46:a5eb9bd3bb55 30 void motor_set_left_direction(MotorDir dir);
hazheng 46:a5eb9bd3bb55 31
hazheng 46:a5eb9bd3bb55 32 void motor_set_right_direction(MotorDir dir);
Bobymicjohn 4:25e028102625 33
hazheng 46:a5eb9bd3bb55 34 inline void motor_set_direction(MotorDir dirL, MotorDir dirR)
hazheng 46:a5eb9bd3bb55 35 {
hazheng 46:a5eb9bd3bb55 36 motor_set_left_direction(dirL);
hazheng 46:a5eb9bd3bb55 37 motor_set_right_direction(dirR);
hazheng 46:a5eb9bd3bb55 38 }
Bobymicjohn 4:25e028102625 39
hazheng 46:a5eb9bd3bb55 40 #ifdef __cplusplus
hazheng 46:a5eb9bd3bb55 41 }
hazheng 46:a5eb9bd3bb55 42 #endif