Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FRDM-TFC mbed CBuffer XBEE mbed_angular_speed motor2 MMA8451Q
Fork of KL25Z_Camera_Test by
Revision 14:13085e161dd1, committed 2016-11-30
- Comitter:
- FatCookies
- Date:
- Wed Nov 30 14:54:19 2016 +0000
- Parent:
- 13:4e77264f254a
- Child:
- 15:ccde02f96449
- Commit message:
- integrated electronic diff
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| motor2.lib | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Nov 29 13:11:20 2016 +0000
+++ b/main.cpp Wed Nov 30 14:54:19 2016 +0000
@@ -13,12 +13,13 @@
#include "TFC.h"
#include "XBEE.h"
#include "angular_speed.h"
+#include "main.h"
#include "motor.h"
-#include "main.h"
#define BAUD_RATE 57600
#define CAM_THRESHOLD 109
#define CAM_DIFF 10
+#define WHEEL_RADIUS 0.025f
#define RIGHT_MOTOR_COMPENSATION_RATIO 1.1586276
@@ -192,11 +193,17 @@
}
}
+ if(turning) {
+ dutyCycleCorner(0.3,servo_pid.output);
+ //sensorCorner(left_motor_pid.desired_value, right_motor_pid.desired_value , servo_pid.output, 50);
+ }
+
if(abs(servo_pid.measured_value) > 0.11f){
if(!turning) {
sendString("start turning");
TFC_SetMotorPWM(0.2,0.2);
+
turning = 1;
} else {
@@ -238,13 +245,14 @@
unsigned char bytes[4];
} thing;
+
pc.putc('B');
- thing.a = wL;
+ thing.a = wL * WHEEL_RADIUS;
pc.putc(thing.bytes[0]);
pc.putc(thing.bytes[1]);
pc.putc(thing.bytes[2]);
pc.putc(thing.bytes[3]);
- thing.a = wR;
+ thing.a = wR * WHEEL_RADIUS;
pc.putc(thing.bytes[0]);
pc.putc(thing.bytes[1]);
pc.putc(thing.bytes[2]);
@@ -403,10 +411,6 @@
//If we've done 5 laps, stop the car
if(startstop >= 1) {
TFC_SetMotorPWM(0.f,0.f);
- wait(0.08);
- TFC_SetMotorPWM(-0.6f,-0.6f);
- wait(0.3);
- TFC_SetMotorPWM(0.f,0.f);
TFC_HBRIDGE_DISABLE;
startstop = 0;
}
--- a/motor2.lib Tue Nov 29 13:11:20 2016 +0000 +++ b/motor2.lib Wed Nov 30 14:54:19 2016 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/teams/GDP-4/code/motor2/#28216063e33e +http://developer.mbed.org/teams/GDP-4/code/motor2/#85cf7b6b0422
