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 46:6806ea59ffed, committed 2017-03-27
- Comitter:
- lh14g13
- Date:
- Mon Mar 27 17:53:17 2017 +0000
- Parent:
- 45:3435bdd2d487
- Child:
- 47:6a58dcef714f
- Commit message:
- added limiter top speed as precaution for sensors;
Changed in this revision
--- a/main.cpp Thu Mar 23 09:36:39 2017 +0000
+++ b/main.cpp Mon Mar 27 17:53:17 2017 +0000
@@ -80,10 +80,10 @@
accc = checkAcc();
}
- if(accc < 0.18f) {
+ if(accc < 0.2f) {
handleStartStop();
} else {
- sendString("up %f", accc);
+ //sendString("up %f", accc);
}
@@ -165,17 +165,17 @@
break;
case 1:
initPID(&servo_pid, 2.2f, 0.6f, 0.f);
- speed = 120;
+ speed = 80;
ed_tune = 1.0f;
break;
case 2:
initPID(&servo_pid, 2.2f, 0.6f, 0.f);
- speed = 130;
+ speed = 100;
ed_tune = 1.0f;
break;
case 3:
initPID(&servo_pid, 2.2f, 0.6f, 0.f);
- speed = 140;
+ speed = 120;
ed_tune = 1.0f;
break;
}
@@ -201,8 +201,8 @@
void initVariables() {
// Initialise three PID controllers for the servo and each wheel.
initPID(&servo_pid, 0.f, 0.f, 0.f);
- initPID(&left_motor_pid, 0.007f, 0.f, 0.f);
- initPID(&right_motor_pid, 0.007f, 0.f, 0.f);
+ initPID(&left_motor_pid, 0.01f, 0.f, 0.f);
+ initPID(&right_motor_pid, 0.01f, 0.f, 0.f);
right_motor_pid.desired_value=0;
left_motor_pid.desired_value=0;
@@ -438,6 +438,9 @@
if(left_motor_pid.output > 1.0f) {
left_motor_pid.output = 1.0f;
}
+ if(left_motor_pid.output > 0.75f) {
+ left_motor_pid.output = 0.75f;
+ }
if(left_motor_pid.output < 0.0f) {
left_motor_pid.output = 0.0f;
}
@@ -445,6 +448,10 @@
if(right_motor_pid.output > 1.0f) {
right_motor_pid.output = 1.0f;
}
+
+ if(right_motor_pid.output > 0.75f) {
+ right_motor_pid.output = 0.75f;
+ }
if(right_motor_pid.output < 0.0f) {
right_motor_pid.output = 0.0f;
}
--- a/main.h Thu Mar 23 09:36:39 2017 +0000 +++ b/main.h Mon Mar 27 17:53:17 2017 +0000 @@ -5,6 +5,7 @@ #define RIGHT_MOTOR_COMPENSATION_RATIO 1.1586276 #define USE_COMMS 1 + #define CLOSE_CAMERA TFC_LineScanImage0 #define LOOKAHEAD_CAMERA TFC_LineScanImage1
--- a/motor2.lib Thu Mar 23 09:36:39 2017 +0000 +++ b/motor2.lib Mon Mar 27 17:53:17 2017 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/teams/GDP-4/code/motor2/#772ff68123cc +http://developer.mbed.org/teams/GDP-4/code/motor2/#80c4ce51cbe4
