From 721d9ca6e3b985d1e4b20070a48ac80878f6c419 Mon Sep 17 00:00:00 2001 From: Andy Lindsay Date: Wed, 11 Oct 2017 10:29:11 -0700 Subject: [PATCH] Add a clear calibration settings option and update calibration messages --- .../ActivitiyBot Clear Calibration Settings.c | 16 ++ ...tivitiyBot Clear Calibration Settings.side | 9 ++ ...er Zero Speed Cutoff Pulse Durations (1).c | 147 ++++++++++++++---- .../ActivitiyBot Clear Calibration Settings.c | 16 ++ ...tivitiyBot Clear Calibration Settings.side | 9 ++ ...ActivitiyBot Display Calibration Results.c | 17 ++ ...ivitiyBot Display Calibration Results.side | 9 ++ .../ActivitiyBot Display Calibration.c | 16 ++ .../ActivitiyBot Display Calibration.side | 9 ++ .../ActivityBot360/ActivityBot Calibrate.c | 23 +++ .../ActivityBot360/ActivityBot Calibrate.side | 9 ++ .../libabcalibrate360/abcalibrate360.c | 16 +- .../libabcalibrate360/abcalibrate360.h | 4 +- .../libabcalibrate360/cmm/libabcalibrate360.a | Bin 10276 -> 10394 bytes version.txt | 2 +- 15 files changed, 268 insertions(+), 34 deletions(-) create mode 100644 360 Dev/ActivityBot360/ActivityBot360 Modified/ActivitiyBot Clear Calibration Settings.c create mode 100644 360 Dev/ActivityBot360/ActivityBot360 Modified/ActivitiyBot Clear Calibration Settings.side create mode 100644 Learn/Examples/Robots/ActivityBot360/ActivitiyBot Clear Calibration Settings.c create mode 100644 Learn/Examples/Robots/ActivityBot360/ActivitiyBot Clear Calibration Settings.side create mode 100644 Learn/Examples/Robots/ActivityBot360/ActivitiyBot Display Calibration Results.c create mode 100644 Learn/Examples/Robots/ActivityBot360/ActivitiyBot Display Calibration Results.side create mode 100644 Learn/Examples/Robots/ActivityBot360/ActivitiyBot Display Calibration.c create mode 100644 Learn/Examples/Robots/ActivityBot360/ActivitiyBot Display Calibration.side create mode 100644 Learn/Examples/Robots/ActivityBot360/ActivityBot Calibrate.c create mode 100644 Learn/Examples/Robots/ActivityBot360/ActivityBot Calibrate.side diff --git a/360 Dev/ActivityBot360/ActivityBot360 Modified/ActivitiyBot Clear Calibration Settings.c b/360 Dev/ActivityBot360/ActivityBot360 Modified/ActivitiyBot Clear Calibration Settings.c new file mode 100644 index 00000000..635176e4 --- /dev/null +++ b/360 Dev/ActivityBot360/ActivityBot360 Modified/ActivitiyBot Clear Calibration Settings.c @@ -0,0 +1,16 @@ +/* + ActivityBot Display Calibration Results.c + + Clear calibration data. ActivityBot360 will use default values + and may not perform as well. +*/ + +#include "simpletools.h" +#include "servo360.h" +#include "abcalibrate360.h" + +int main() +{ + cal_clear(); +} + diff --git a/360 Dev/ActivityBot360/ActivityBot360 Modified/ActivitiyBot Clear Calibration Settings.side b/360 Dev/ActivityBot360/ActivityBot360 Modified/ActivitiyBot Clear Calibration Settings.side new file mode 100644 index 00000000..320ffbe2 --- /dev/null +++ b/360 Dev/ActivityBot360/ActivityBot360 Modified/ActivitiyBot Clear Calibration Settings.side @@ -0,0 +1,9 @@ +ActivitiyBot Clear Calibration Settings.c +>compiler=C +>memtype=cmm main ram compact +>optimize=-Os +>-m32bit-doubles +>-fno-exceptions +>defs::-std=c99 +>-lm +>BOARD::ACTIVITYBOARD diff --git a/360 Dev/Servo360/Servo360 Modified/Find upper and lower Zero Speed Cutoff Pulse Durations (1).c b/360 Dev/Servo360/Servo360 Modified/Find upper and lower Zero Speed Cutoff Pulse Durations (1).c index c1b61956..037ca308 100644 --- a/360 Dev/Servo360/Servo360 Modified/Find upper and lower Zero Speed Cutoff Pulse Durations (1).c +++ b/360 Dev/Servo360/Servo360 Modified/Find upper and lower Zero Speed Cutoff Pulse Durations (1).c @@ -13,20 +13,18 @@ int main() servo360_connect(12, 14); servo360_feedback(12, 0); - int n, y1, y2, x1, x2; - int mVccw, mVcw, bVccw, bVcw; - int increases = 0, decreases = 0; - int angle = servo360_getAngle(12); - int anglep = angle; - int diffCount = 0; + int n, x, angle, angleP; + int mVccwL, mVcwL, bVccwL, bVcwL; + int mVccwR, mVcwR, bVccwR, bVcwR; + int increases = 0, decreases = 0, diffCount = 0; servo360_set(12, 1500+240); pause(2000); - x1 = servo360_getAngle12Bit(12); - print("x1 = %d\r", x1); + x = servo360_getAngle12Bit(12); + print("x = %d\r", x); pause(1000); - x1 = servo360_getAngle12Bit(12) - x1; - print("x1 = %d\r", x1); + x = servo360_getAngle12Bit(12) - x; + print("x = %d\r", x); //x1 &= 0xFFF; //print("x1 = %d\r", x1); @@ -35,26 +33,27 @@ int main() pause(2000); angle = servo360_getAngle(12); - anglep = angle; + angleP = angle; for(n = 0; n < 60; n++) { servo360_set(12, 1500 + n); angle = servo360_getAngle(12); print("angle = %d\r", angle); - if(angle != anglep) increases++; + if(angle != angleP) increases++; if(increases > 3) break; pause(20); + angleP = angle; } - bVccw = (n - 4) * 10 * 2 / 3; - print("bVccw = %d\r", bVccw); + bVccwL = (n - 4) * 10 * 2 / 3; + print("bVccwL = %d\r", bVccwL); servo360_set(12, 1500); - mVccw = 1000 * (2200 - 266) / x1; + mVccwL = 1000 * (2200 - bVccwL) / x; - print("mVccw = %d\r", mVccw); + print("mVccwL = %d\r", mVccwL); // Left servo clockwise @@ -62,11 +61,11 @@ int main() servo360_set(12, 1500-240); pause(2000); - x1 = servo360_getAngle12Bit(12); - print("x1 = %d\r", x1); + x = servo360_getAngle12Bit(12); + print("x = %d\r", x); pause(1000); - x1 = abs(servo360_getAngle12Bit(12) - x1); - print("x1 = %d\r", x1); + x = abs(servo360_getAngle12Bit(12) - x); + print("x = %d\r", x); //x1 &= 0xFFF; //print("x1 = %d\r", x1); @@ -75,28 +74,122 @@ int main() pause(2000); angle = servo360_getAngle(12); - anglep = angle; + angleP = angle; for(n = 0; n > -60; n--) { servo360_set(12, 1500 + n); angle = servo360_getAngle(12); print("angle = %d\r", angle); - if(angle != anglep) decreases++; + if(angle != angleP) decreases++; if(decreases > 3) break; pause(20); + angleP = angle; } - bVcw = abs((n + 4) * 10 * 2 / 3); - print("bVcw = %d\r", bVcw); + bVcwL = abs((n + 4) * 10 * 2 / 3); + print("bVcwL = %d\r", bVcwL); servo360_set(12, 1500); - mVcw = 1000 * (2200 - 266) / x1; + mVcwL = 1000 * (2200 - bVcwL) / x; - print("mVccw = %d\r", mVcw); + print("mVccwL = %d\r", mVcwL); - while(1); + + // Right servo counterclockwise + + servo360_connect(13, 15); + servo360_feedback(13, 0); + + servo360_set(13, 1500+240); + pause(2000); + x = servo360_getAngle12Bit(13); + print("x = %d\r", x); + pause(1000); + x = servo360_getAngle12Bit(13) - x; + print("x = %d\r", x); + //x1 &= 0xFFF; + //print("x1 = %d\r", x1); + + servo360_set(13, 1500); + + pause(2000); + + angle = servo360_getAngle(13); + angleP = angle; + increases = 0; + + for(n = 0; n < 60; n++) + { + servo360_set(13, 1500 + n); + angle = servo360_getAngle(13); + print("angle = %d\r", angle); + if(angle != angleP) increases++; + if(increases > 3) break; + pause(20); + angleP = angle; + } + + bVccwR = (n - 4) * 10 * 2 / 3; + print("bVccwR = %d\r", bVccwR); + + servo360_set(13, 1500); + + mVccwR = 1000 * (2200 - bVccwR) / x; + + print("mVccwR = %d\r", mVccwR); + + + // Right servo clockwise + + + servo360_set(13, 1500-240); + pause(2000); + x = servo360_getAngle12Bit(13); + print("x = %d\r", x); + pause(1000); + x = abs(servo360_getAngle12Bit(13) - x); + print("x1 = %d\r", x); + //x1 &= 0xFFF; + //print("x1 = %d\r", x1); + + servo360_set(13, 1500); + + pause(2000); + + angle = servo360_getAngle(13); + angleP = angle; + decreases = 0; + + for(n = 0; n > -60; n--) + { + servo360_set(13, 1500 + n); + angle = servo360_getAngle(13); + print("angle = %d\r", angle); + if(angle != angleP) decreases++; + if(decreases > 3) break; + pause(20); + angleP = angle; + } + + bVcwR = abs((n + 4) * 10 * 2 / 3); + print("bVcwR = %d\r", bVcwR); + + servo360_set(13, 1500); + + mVcwR = 1000 * (2200 - bVcwR) / x; + + print("mVcwR = %d\r", mVcwR); + print("\r=== Summary ===\r", mVcwR); + print("mVccw = %d\r", mVccwL); + print("bVccwL = %d\r", bVccwL); + print("mVcwL = %d\r", mVcwL); + print("bVcwL = %d\r", bVcwL); + print("mVccwR = %d\r", mVccwR); + print("bVccwR = %d\r", bVccwR); + print("mVcwR = %d\r", mVcwR); + print("bVcwR = %d\r", bVcwR); } \ No newline at end of file diff --git a/Learn/Examples/Robots/ActivityBot360/ActivitiyBot Clear Calibration Settings.c b/Learn/Examples/Robots/ActivityBot360/ActivitiyBot Clear Calibration Settings.c new file mode 100644 index 00000000..635176e4 --- /dev/null +++ b/Learn/Examples/Robots/ActivityBot360/ActivitiyBot Clear Calibration Settings.c @@ -0,0 +1,16 @@ +/* + ActivityBot Display Calibration Results.c + + Clear calibration data. ActivityBot360 will use default values + and may not perform as well. +*/ + +#include "simpletools.h" +#include "servo360.h" +#include "abcalibrate360.h" + +int main() +{ + cal_clear(); +} + diff --git a/Learn/Examples/Robots/ActivityBot360/ActivitiyBot Clear Calibration Settings.side b/Learn/Examples/Robots/ActivityBot360/ActivitiyBot Clear Calibration Settings.side new file mode 100644 index 00000000..320ffbe2 --- /dev/null +++ b/Learn/Examples/Robots/ActivityBot360/ActivitiyBot Clear Calibration Settings.side @@ -0,0 +1,9 @@ +ActivitiyBot Clear Calibration Settings.c +>compiler=C +>memtype=cmm main ram compact +>optimize=-Os +>-m32bit-doubles +>-fno-exceptions +>defs::-std=c99 +>-lm +>BOARD::ACTIVITYBOARD diff --git a/Learn/Examples/Robots/ActivityBot360/ActivitiyBot Display Calibration Results.c b/Learn/Examples/Robots/ActivityBot360/ActivitiyBot Display Calibration Results.c new file mode 100644 index 00000000..c4f544a0 --- /dev/null +++ b/Learn/Examples/Robots/ActivityBot360/ActivitiyBot Display Calibration Results.c @@ -0,0 +1,17 @@ +/* + ActivityBot Display Calibration Results.c + + Display interpolation table values from calibration + + http://learn.parallax.com/activitybot/calibrate-your-activitybot +*/ + +#include "simpletools.h" +#include "servo360.h" +#include "abcalibrate360.h" + +int main() +{ + cal_displayResults(); +} + diff --git a/Learn/Examples/Robots/ActivityBot360/ActivitiyBot Display Calibration Results.side b/Learn/Examples/Robots/ActivityBot360/ActivitiyBot Display Calibration Results.side new file mode 100644 index 00000000..03a412f8 --- /dev/null +++ b/Learn/Examples/Robots/ActivityBot360/ActivitiyBot Display Calibration Results.side @@ -0,0 +1,9 @@ +ActivitiyBot Display Calibration Results.c +>compiler=C +>memtype=cmm main ram compact +>optimize=-Os +>-m32bit-doubles +>-fno-exceptions +>defs::-std=c99 +>-lm +>BOARD::ACTIVITYBOARD diff --git a/Learn/Examples/Robots/ActivityBot360/ActivitiyBot Display Calibration.c b/Learn/Examples/Robots/ActivityBot360/ActivitiyBot Display Calibration.c new file mode 100644 index 00000000..e5dbc914 --- /dev/null +++ b/Learn/Examples/Robots/ActivityBot360/ActivitiyBot Display Calibration.c @@ -0,0 +1,16 @@ +/* + ActivityBot Display Calibration.c + + Display interpolation table values from calibration + + http://learn.parallax.com/activitybot/calibrate-your-activitybot +*/ + +#include "simpletools.h" +#include "servo360.h" +#include "abcalibrate360.h" + +int main() +{ + cal_displayData(); +} \ No newline at end of file diff --git a/Learn/Examples/Robots/ActivityBot360/ActivitiyBot Display Calibration.side b/Learn/Examples/Robots/ActivityBot360/ActivitiyBot Display Calibration.side new file mode 100644 index 00000000..5ce91277 --- /dev/null +++ b/Learn/Examples/Robots/ActivityBot360/ActivitiyBot Display Calibration.side @@ -0,0 +1,9 @@ +ActivitiyBot Display Calibration.c +>compiler=C +>memtype=cmm main ram compact +>optimize=-Os +>-m32bit-doubles +>-fno-exceptions +>defs::-std=c99 +>-lm +>BOARD::ACTIVITYBOARD diff --git a/Learn/Examples/Robots/ActivityBot360/ActivityBot Calibrate.c b/Learn/Examples/Robots/ActivityBot360/ActivityBot Calibrate.c new file mode 100644 index 00000000..91be1042 --- /dev/null +++ b/Learn/Examples/Robots/ActivityBot360/ActivityBot Calibrate.c @@ -0,0 +1,23 @@ +/* + ActivityBot Calibrate.c + + Calibrate the ActivityBot's servos and encoders + + http://learn.parallax.com/activitybot/calibrate-your-activitybot +*/ + +#include "simpletools.h" +#include "servo360.h" +#include "abcalibrate360.h" + +int main() +{ + cal_servoPins(12, 13); + cal_encoderPins(14, 15); + + high(26); + high(27); + cal_activityBot(); + low(26); + low(27); +} diff --git a/Learn/Examples/Robots/ActivityBot360/ActivityBot Calibrate.side b/Learn/Examples/Robots/ActivityBot360/ActivityBot Calibrate.side new file mode 100644 index 00000000..ec706b87 --- /dev/null +++ b/Learn/Examples/Robots/ActivityBot360/ActivityBot Calibrate.side @@ -0,0 +1,9 @@ +ActivityBot Calibrate.c +>compiler=C +>memtype=cmm main ram compact +>optimize=-Os +>-m32bit-doubles +>-fno-exceptions +>defs::-std=c99 +>-lm +>BOARD::ACTIVITYBOARD diff --git a/Learn/Simple Libraries/Robotics/ActivityBot360/libabcalibrate360/abcalibrate360.c b/Learn/Simple Libraries/Robotics/ActivityBot360/libabcalibrate360/abcalibrate360.c index e2287f89..b321c531 100644 --- a/Learn/Simple Libraries/Robotics/ActivityBot360/libabcalibrate360/abcalibrate360.c +++ b/Learn/Simple Libraries/Robotics/ActivityBot360/libabcalibrate360/abcalibrate360.c @@ -358,8 +358,8 @@ void cal_displayData(void) } else { - print("There was a problem with the calibration.\r"); - print("Try cal_displayResults() instead.\r"); + print("Calibration data either not found or has errors.\r"); + print("Try cal_displayResults() for more info.\r"); print("\rRaw data from EEPROM:\r\r"); for(int a = _AB360_EE_Start_; a < _AB360_EE_End_; a++) { @@ -410,14 +410,14 @@ void cal_displayResults(void) { print("Calibration started but did not complete.\r"); print("Verify the servo and encoder connections\r"); - print("against the ones in the diagram and try\r"); + print("against the ones in the diagrams and try\r"); print("again. Follow the instructions carefully.\r"); //return -1; } else if(!strcmp(str, "ActivityBot")) { print("There is a non-servo360 ActivityBot calibration.\r"); - print("in the EEPROM. Maek sure to follow the instructions\r"); + print("in the EEPROM. Make sure to follow the instructions\r"); print("for calibrating the ActivityBot360.\r"); //return -1; } @@ -479,6 +479,14 @@ void cal_displayResults(void) */ } + +void cal_clear(void) +{ + for(int addr = _AB360_EE_Start_; addr <_AB360_EE_End_; addr++) + { + ee_putByte(0xFF, addr); + } +} diff --git a/Learn/Simple Libraries/Robotics/ActivityBot360/libabcalibrate360/abcalibrate360.h b/Learn/Simple Libraries/Robotics/ActivityBot360/libabcalibrate360/abcalibrate360.h index e17eb8c4..fe5897a3 100644 --- a/Learn/Simple Libraries/Robotics/ActivityBot360/libabcalibrate360/abcalibrate360.h +++ b/Learn/Simple Libraries/Robotics/ActivityBot360/libabcalibrate360/abcalibrate360.h @@ -146,8 +146,8 @@ void cal_encoderPins(int encPinLeft, int encPinRight); void cal_displayData(void); void cal_displayResults(void); -int cal_getEepromPins(); - +int cal_getEepromPins(void); +void cal_clear(void); #if defined(__cplusplus) } diff --git a/Learn/Simple Libraries/Robotics/ActivityBot360/libabcalibrate360/cmm/libabcalibrate360.a b/Learn/Simple Libraries/Robotics/ActivityBot360/libabcalibrate360/cmm/libabcalibrate360.a index 0b249c2c25056fa0aa1d18611c1e27f8a31db0c9..e742d9678c220c38f50c2a1e156fee07b9324720 100644 GIT binary patch delta 733 zcmZ|NL2DC16ae5iNmpZNbQ7_bDs?1c?7?O?))+xC=s`gQ6%Puf$=IFR#qDmG-H0oK z3hGJ3buL9jddNX~5>^EL4LvlTR1|s;1TR*E28y6BDbhLA2RqF7m^beYZ0r293r}{R zIdbUe;c|&mgLXq*DK*C`y)32mGyrS{Ap8IKMRhwSq9rX_E$!W? zg=rY&av56~#+V_`kwOCW_y+l&8cZH{-*skII_crLKco64fZ_MeU)l+X>*?RgiBrt6 zuL>5}o=YtjFv{&pb+Gnd!&odC=6mE37!w(u3bs3zeWZk{U+(Q}F)qi5sx_8-JF z`g%nGSaz8Jj4Pf%-&Aa&Z_A%Mig)fS*;|->t@ti_N%2E;zqa1x5xS!IDcVvzi*6`> zfo>^o5h%fDB{7c&`jpqbLLXE725rUdfwN@K#{|HK)Y>e1mB3f@zt92VU4x$z1Iiy( Z(`3sFFkf{Iw delta 597 zcmZwCzb^w}7zgm@ZJp96T2d8;C+TpNRI7egBw~;lh#(y#5_;UFy*MRzCsGR%X$%eO zHHd-bCX?h6i$8$Dz{bXEVK5pzx_Adq@;-S#-@MQJ<~^TvW{x|@2M5wa=`>;w{+8Gg zQ+@r_6fx@ufLZ_+`EONJ-3!TNjz84 zYN|s3G&auwrUWmN^MX~f!R2sr#}?9UN*%$w