装填機構ライブラリ
Revision 1:6cdfc10c7b1d, committed 2018-10-11
- Comitter:
- tanabe2000
- Date:
- Thu Oct 11 09:45:30 2018 +0000
- Parent:
- 0:890f901f4898
- Commit message:
- ????????????
Changed in this revision
petbottleLoading.cpp | Show annotated file Show diff for this revision Revisions of this file |
petbottleLoading.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 890f901f4898 -r 6cdfc10c7b1d petbottleLoading.cpp --- a/petbottleLoading.cpp Thu Oct 04 11:43:22 2018 +0000 +++ b/petbottleLoading.cpp Thu Oct 11 09:45:30 2018 +0000 @@ -5,7 +5,7 @@ loadingencoder(loadingencoder1_1, loadingencoder1_2 ,NC, 2048, QEI::X4_ENCODING), RS485control(PA_4), RS485(MDC_TX,MDC_RX,115200), - debug(USBTX, USBRX), +// debug(USBTX, USBRX), limitSW1_(limitswich1_1), limitSW2_(limitswich1_2), limitSW3_(limitswich1_3) @@ -45,7 +45,7 @@ limitSW2 = limitSW2_.read(); limitSW3 = limitSW3_.read(); // debug.printf("L1:<%d>, L2:<%d>, L3:<%d>\r\n", limitSW1, limitSW2, limitSW3); -debug.printf("nowPals<%d>\r\n", nowPals); +// debug.printf("nowPals<%d>\r\n", nowPals); if(loadingmode == 0) { loadingDistance = 0; @@ -54,16 +54,17 @@ } else if(loadingmode == 1) { limitSwFlag[2] = 0; limitSwFlag2[2] = 0; - loadingDistance = 954; + loadingDistance = 875; if((nowPals - pullDistanceOfset) > 700) { if(limitSW1 == 1 && limitSwFlag[0] == 0) { limitSwFlag[0] = 1; - petbottledropPwm = 1.0; + petbottledropPwm = 0.5; } if(limitSW1 == 0 && limitSwFlag[0] == 0 &&limitSwFlag2[0] == 0) { limitSwFlag[0] = 1; limitSwFlag2[0] = 1; - petbottledropPwm = 1.0; + petbottledropPwm = 0.5 + ; } if(limitSW1 ==0 && limitSwFlag[0] == 1) limitSwFlag2[0] = 1; if((limitSwFlag[0] == 1) && (limitSwFlag2[0] == 1) && (limitSW1 == 1))petbottledropPwm = 0.0; @@ -75,13 +76,13 @@ if((nowPals - pullDistanceOfset) > 700) { if(limitSW1 == 1 && limitSwFlag[0] == 0) { limitSwFlag[0] = 1; - - petbottledropPwm = 1.0; + + petbottledropPwm = 0.5; } if(limitSW1 == 0 && limitSwFlag[0] == 0 &&limitSwFlag2[0] == 0) { limitSwFlag[0] = 1; limitSwFlag2[0] = 1; - petbottledropPwm = 1.0; + petbottledropPwm = 0.5; } if(limitSW1 ==0 && limitSwFlag[0] == 1) limitSwFlag2[0] = 1; if((limitSwFlag[0] == 1) && (limitSwFlag2[0] == 1) && (limitSW1 == 1))petbottledropPwm = 0.0; @@ -94,22 +95,22 @@ petbottleInPwm = 0.0; loadingDistance = 0; petbottleInPwm = 0.0; - if((nowPals - pullDistanceOfset) < 25) { + if((nowPals - pullDistanceOfset) < 15) { if(limitSW1 == 1 && limitSwFlag[0] == 1) { limitSwFlag[0] = 0; - petbottledropPwm = 1.0; + petbottledropPwm = 0.5; } if(limitSW1 == 0 && limitSwFlag[0] == 1 &&limitSwFlag2[0] == 1) { limitSwFlag[0] = 0; limitSwFlag2[0] = 0; - petbottledropPwm = 1.0; + petbottledropPwm = 0.45; } if(limitSW1 ==0 && limitSwFlag[0] == 0) limitSwFlag2[0] = 0; if((limitSwFlag[0] == 0) && (limitSwFlag2[0] == 0) && (limitSW1 == 1))petbottledropPwm = 0.0; } } } else { - if((nowPals - pullDistanceOfset) > 700)petbottleInPwm = -1.0; + if((nowPals - pullDistanceOfset) > 700)petbottleInPwm = -0.5; } } else { petbottledropPwm = 0.0; @@ -120,9 +121,10 @@ petbottleIn->setSpeed(petbottleInPwm); } -int petbottleLoading::LoadingEncoder(){ +int petbottleLoading::LoadingEncoder() +{ return nowPals - pullDistanceOfset; - } +} int petbottleLoading::state() {
diff -r 890f901f4898 -r 6cdfc10c7b1d petbottleLoading.h --- a/petbottleLoading.h Thu Oct 04 11:43:22 2018 +0000 +++ b/petbottleLoading.h Thu Oct 11 09:45:30 2018 +0000 @@ -5,9 +5,9 @@ #include "QEI.h" #include"pin_config.h" -#define loadingKP 8.0 -#define loadingKI 0 -#define loadingKD 0.0000001 +#define loadingKP 30.0 +#define loadingKI 0.0 +#define loadingKD 0.0 #define RATE 0.01 @@ -63,7 +63,7 @@ /*受信系*/ bool receiveSuccessed; - Serial debug; +// Serial debug; Timer pt; float pdt;