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 34:3de7a19ccea3, committed 2017-01-12
- Comitter:
- oj3g13
- Date:
- Thu Jan 12 12:51:24 2017 +0000
- Parent:
- 32:6829684f8c4d
- Child:
- 35:e23354abf352
- Commit message:
- Reduced Image width by 2 pixels per side for reliable detection of lack of edges for reliable crossroads
Changed in this revision
--- a/main.cpp Wed Jan 11 19:59:03 2017 +0000
+++ b/main.cpp Thu Jan 12 12:51:24 2017 +0000
@@ -97,7 +97,7 @@
void initVariables() {
// Initialise three PID controllers for the servo and each wheel.
- initPID(&servo_pid, 2.2f, 0.6f, 0.f);
+ initPID(&servo_pid, 0.f, 0.f, 0.f);
initPID(&left_motor_pid, 0.01f, 0.f, 0.f);
initPID(&right_motor_pid, 0.01f, 0.f, 0.f);
@@ -152,7 +152,7 @@
rightSeen = false;
//Starting in the middle index, step left, inspecting the the edge of the track
- for(i = 63; i > 0; i--) {
+ for(i = 63; i > 2; i--) {
curr_left = (uint8_t)(cam_data[i] >> 4) & 0xFF;
diff = prev - curr_left;
//Check incorporates a combination of looking at the difference in intensities
@@ -167,7 +167,7 @@
prev = -1;
//As before, start in the middle but this time step rightwards in the image
- for(i = 64; i < 128; i++) {
+ for(i = 64; i < 126; i++) {
curr_right = (uint8_t)(cam_data[i] >> 4) & 0xFF;
int diff = prev - curr_right;
if(abs(diff) >= CAM_DIFF && curr_right <= CAM_THRESHOLD && prev != -1) {
@@ -183,6 +183,7 @@
sendString("lost edges");
ALIGN_SERVO; //Straighten wheels so we go straight through the crossroads
servo_pid.integral = 0;
+ l=0;r=128;
}
//Calculate how left/right from the centre line we are
--- a/mbed_angular_speed.lib Wed Jan 11 19:59:03 2017 +0000 +++ b/mbed_angular_speed.lib Thu Jan 12 12:51:24 2017 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/teams/GDP-4/code/mbed_angular_speed/#560642830386 +http://developer.mbed.org/teams/GDP-4/code/mbed_angular_speed/#99fd038b5e4e
--- a/motor2.lib Wed Jan 11 19:59:03 2017 +0000 +++ b/motor2.lib Thu Jan 12 12:51:24 2017 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/teams/GDP-4/code/motor2/#d3efef939c18 +http://developer.mbed.org/teams/GDP-4/code/motor2/#3d6bb5f736a5
