How I reduce vibration when tracking

Hi,
so Pfod modification with MaxSpeedperiPwm is working fine. For me max value is 180, higher values will make tracking unstable (vibrating).
But still small problem with perimetr timeout error. Not sure if it's problem with perimeterMagMaxValue which is 2000 or where ? Looks like that mower is still tracking little bit outside of perimeter.

Alex

edit:
looks like that timeout error problem started with change :

//parameter the PID
perimeterPID.y_min = -motorSpeedMaxPwm ;
perimeterPID.y_max = motorSpeedMaxPwm ;
perimeterPID.max_output = motorSpeedMaxPwm ;

motorSpeedMaxPwm to MaxSpeedperiPwm
 
@Reiner
Hi
I'am going to see your answer concerning the speed of the ADCMAN on your board .
So 10ms is very fast (did you try less?)
This board is really very fast and i think you need to change a lot of think in Azurit to make it work correctly with the 3 Core.
Congratulation.
 
@Alda.

Code:
looks like that timeout error problem started with change :

//parameter the PID
perimeterPID.y_min = -motorSpeedMaxPwm ;
perimeterPID.y_max = motorSpeedMaxPwm ;
perimeterPID.max_output = motorSpeedMaxPwm ;

motorSpeedMaxPwm to MaxSpeedperiPwm


I don't think the change is the problem.In reality the tracking is so smooth that the mag value is low for a very long time .

If you think that your mower track a lot Outside you can change this by this way.
in

Code:
if (perimeterInside) {
    perimeterPID.w = -0.5;
  }
  else {
    perimeterPID.w = 0.5;
  }


the -0.5 value can be -0.7 and the 0.5 change by 0.4
the -1 and 1 value work well also.
or increase the timedOutIfBelowSmag in Pfod perimeter Setting.

Hope it's solve the problem.
 
So I did next tests and better tracking position I have with this setup :

if (perimeterInside) {
perimeterPID.w = -0.6;
}
else {
perimeterPID.w = 0.4;
}

I also used again :
//parameter the PID
perimeterPID.y_min = -motorSpeedMaxPwm ;
perimeterPID.y_max = motorSpeedMaxPwm ;
perimeterPID.max_output = motorSpeedMaxPwm ;

and now tracking is without errors.

One important thing :
When I'm in pfod/setting/perimeter and looking on the perimeter values during mower's tracking, tracking is very unstable and jerked.

Alex
 
@Alda
One important thing :
When I'm in pfod/setting/perimeter and looking on the perimeter values during mower's tracking, tracking is very unstable and jerked
Yes it's normal and it's why i tell you in pfod Post:
Be carreful that with Mega i think i need to stop the tracking before change the value
because i constate exactly the same think with the DUE version but it's not a problem.
It's cool if the tracking work well with the Mega.
.
 
Bernard schrieb:
@Alda

It's cool if the tracking work well with the Mega.
.

Yes, tracking is very stable and no vibration with Mega, but still problem with perimeter timeout. It looks like that mower is sometimes tracking near to wire from outside (result is perimeter timeout error) and sometimes near from inside (no problems). Tomorrow more tests. I will try connect via cable to the mower to see a perimeter values.

Alex
 
Zuletzt bearbeitet von einem Moderator:
If the problem occur only in long straight line maybe you can try to change the pid to force gently the mower to make an in out each 10 secondes.
I record a lot of value and sometimes the mower stay inside during maximum 8 or 9 seconde but i don t test on straight line more than 5 meters.
What is exactly the error you receive ?

If you connect the mower with cable please set the speed to 115200baud to avoid problem while tracking B)
 
Ok, I will do.
Only on point which I'm thinking about :

if (perimeterInside) {
perimeterPID.w = -0.5;
}
else {
perimeterPID.w = 0.5;
}

When I'm inside (-value) I want go to -0,5 and when I'm outside (+value) I want go to 0,5 = stay outside ?
Why not go to -value = go inside and no perimeter timeout ?

Alex

edit:
why I'm asking is to swap -0.5 and +0.5 = requirement to mower (PID) go over wire
 
HI
why I'm asking is to swap -0.5 and +0.5 = requirement to mower (PID) go over wire
To be sure the mower stay on wire we need to reset the perimeterLastTransitionTime,
It's made by 2 way:

1 --> make an in out it's why the -0.5 +0.5 and in the code you can find this in section void Robot::readSensors()


Code:
if ((perimeterUse) && (millis() >= nextTimePerimeter)) {
    //bb
    nextTimePerimeter = millis() +  10; // 50
    perimeterMag = readSensor(SEN_PERIM_LEFT);
    //float leftMag = Perimeter.getMagnitude(IDX_LEFT);
    if ((Perimeter.isInside(0) != perimeterInside)) {
      perimeterCounter++;
      perimeterLastTransitionTime = millis();
      perimeterInside = Perimeter.isInside(0);


or
2 --> in the tracking If the perimeterMag is very low so i put a (perimeterMagMaxValue / 4) as min value,maybe you can also try /3 to avoid tracking error.


Code:
if (abs(perimeterMag ) < perimeterMagMaxValue / 4) { //300 can be replace by timedOutIfBelowSmag to be tested
    perimeterLastTransitionTime = millis(); //initialise perimeterLastTransitionTime if perfect sthraith line
  }


If you want your mower track always Inside you can try to replace the
if (perimeterInside) {
perimeterPID.w = -0.5;
}
else {
perimeterPID.w = 0.5;
}
by simply perimeterPID.w = -0.5 and use perimeterMagMaxValue / 3 , but i'am not sure the mower never lost the wire :woohoo:
 
ok, next test results, only changing
if (perimeterInside) {
perimeterPID.w = -0.5;
}
else {
perimeterPID.w = 0.5;

rest remain default

first results with -0.5 / +0.5 :

Code:
perimeter
t    20 l3190 v2 OFF  sig min  -24 max   26 avg    1 mag  -269 qty 196  in  1  cnt    2  on 1
t    21 l3179 v2 OFF  sig min  -24 max   26 avg    1 mag  -323 qty 195  in  1  cnt    2  on 1
t    22 l3395 v2 OFF  sig min  -24 max   26 avg    1 mag  -267 qty 194  in  1  cnt    2  on 1
t    23 l3432 v2 OFF  sig min  -24 max   26 avg    1 mag  -282 qty 195  in  1  cnt    2  on 1
t    24 l3415 v2 OFF  sig min  -24 max   26 avg    1 mag  -264 qty 195  in  1  cnt    2  on 1
t    25 l3404 v2 OFF  sig min  -24 max   26 avg    1 mag  -291 qty 195  in  1  cnt    2  on 1
t    26 l3416 v2 OFF  sig min  -24 max   26 avg    1 mag  -281 qty 193  in  1  cnt    2  on 1
t    27 l3399 v2 OFF  sig min  -24 max   26 avg    1 mag  -309 qty 195  in  1  cnt    2  on 1
t    28 l3409 v2 OFF  sig min  -24 max   26 avg    1 mag  -319 qty 193  in  1  cnt    2  on 1
t    29 l3398 v2 OFF  sig min  -24 max   26 avg    1 mag  -284 qty 194  in  1  cnt    2  on 1
t    30 l3409 v2 OFF  sig min  -24 max   26 avg    1 mag  -284 qty 191  in  1  cnt    2  on 1
pfod cmd=.
t    31 l3397 v2 OFF  sig min  -24 max   26 avg    1 mag  -269 qty 189  in  1  cnt    2  on 1
t    32 l3027 v2 OFF  sig min  -24 max   26 avg    1 mag  -265 qty 185  in  1  cnt    2  on 1
pfod cmd=r
t    33 l3438 v2 OFF  sig min  -24 max   26 avg    1 mag  -266 qty 194  in  1  cnt    2  on 1
t    34 l2974 v2 OFF  sig min  -24 max   26 avg    1 mag  -323 qty 191  in  1  cnt    2  on 1
pfod cmd=rh
t     0 l3426 v2 PFND sig min  -24 max   26 avg    1 mag  -277 qty 193  in  1  cnt    2  on 1
t     0 l3426 v2 PFND sig min  -24 max   26 avg    1 mag  -295 qty 190  in  1  cnt    2  on 1
t     1 l2708 v2 PFND sig min  -24 max   26 avg    1 mag  -277 qty 156  in  1  cnt    2  on 1
t     2 l3071 v2 PFND sig min  -24 max   26 avg    1 mag  -373 qty 185  in  1  cnt    2  on 1
t     3 l2962 v2 PFND sig min  -33 max   35 avg    1 mag  -365 qty 209  in  1  cnt    2  on 1
t     4 l2906 v2 PFND sig min  -33 max   35 avg    1 mag  -431 qty 182  in  1  cnt    2  on 1
pfod cmd=r
t     5 l2978 v2 PFND sig min  -33 max   35 avg    1 mag  -393 qty 188  in  1  cnt    2  on 1
t     6 l2561 v2 PFND sig min  -33 max   35 avg    1 mag  -436 qty 189  in  1  cnt    2  on 1
t     7 l2932 v2 PFND sig min  -33 max   35 avg    1 mag  -532 qty 196  in  1  cnt    2  on 1
t     8 l2947 v2 PFND sig min  -61 max   57 avg    0 mag  -642 qty 192  in  1  cnt    2  on 1
t     9 l2986 v2 PFND sig min  -61 max   57 avg    0 mag  -765 qty 192  in  1  cnt    2  on 1
pfod cmd=r
t    11 l2944 v2 PFND sig min  -61 max   57 avg    0 mag -1176 qty 192  in  1  cnt    2  on 1
t    12 l2580 v2 PFND sig min  -61 max   57 avg    0 mag -1481 qty 192  in  1  cnt    2  on 1
t    13 l2947 v2 PFND sig min  -61 max   57 avg    0 mag  1328 qty 197  in  0  cnt    3  on 1
t    14 l2660 v2 PFND sig min  -95 max   97 avg    1 mag  1623 qty 200  in  0  cnt    3  on 1
t    15 l2274 v2 PFND sig min  -95 max   97 avg    1 mag  1364 qty 199  in  0  cnt    3  on 1
pfod cmd=r
t     0 l2182 v2 PTRK sig min  -95 max   97 avg    1 mag  -602 qty 191  in  1  cnt    4  on 1
t     0 l2182 v2 PTRK sig min  -95 max   97 avg    1 mag -1118 qty 191  in  1  cnt    4  on 1
t     1 l1983 v2 PTRK sig min  -95 max   97 avg    1 mag -1116 qty 184  in  1  cnt    4  on 1
t     2 l3244 v2 PTRK sig min  -95 max   97 avg    1 mag  1147 qty 183  in  0  cnt    5  on 1
t     3 l3177 v2 PTRK sig min  -50 max   52 avg    0 mag   607 qty 207  in  0  cnt    5  on 1
t     4 l3153 v2 PTRK sig min  -50 max   52 avg    0 mag   191 qty 191  in  0  cnt    5  on 1
pfod cmd=r
t     5 l3187 v2 PTRK sig min  -50 max   52 avg    0 mag   210 qty 203  in  0  cnt    5  on 1
t     6 l2882 v2 PTRK sig min  -50 max   52 avg    0 mag   131 qty 132  in  0  cnt    5  on 1
t     7 l3192 v2 PTRK sig min  -50 max   52 avg    0 mag   189 qty 122  in  0  cnt    5  on 1
t     8 l3254 v2 PTRK sig min  -40 max   54 avg    1 mag   343 qty 161  in  0  cnt    5  on 1
t     9 l3312 v2 PTRK sig min  -40 max   54 avg    1 mag   258 qty 226  in  0  cnt    5  on 1
pfod cmd=r
t    10 l3345 v2 PTRK sig min  -40 max   54 avg    1 mag   354 qty 190  in  0  cnt    5  on 0
RTC date received: Tue 20.06.2017
t    11 l2886 v2 PTRK sig min  -40 max   54 avg    1 mag  -100 qty 135  in  1  cnt    6  on 1
t    12 l3251 v2 PTRK sig min  -40 max   54 avg    1 mag  -415 qty 174  in  1  cnt    8  on 1
t    13 l3177 v2 PTRK sig min  -40 max   54 avg    1 mag    59 qty 120  in  1  cnt    8  on 1
t    14 l3244 v2 PTRK sig min  -21 max   22 avg    1 mag  -102 qty 152  in  1  cnt    8  on 1
t    15 l3157 v2 PTRK sig min  -21 max   22 avg    1 mag  -341 qty 167  in  1  cnt    8  on 1
pfod cmd=r
t    16 l3151 v2 PTRK sig min  -21 max   22 avg    1 mag  -252 qty 181  in  1  cnt    8  on 1
t    17 l2726 v2 PTRK sig min  -21 max   22 avg    1 mag  -243 qty 199  in  1  cnt    8  on 1
t    18 l3139 v2 PTRK sig min  -21 max   22 avg    1 mag  -218 qty 162  in  1  cnt   10  on 1
t    19 l3148 v2 PTRK sig min  -26 max   25 avg    0 mag  -375 qty 192  in  1  cnt   10  on 1
t    20 l3136 v2 PTRK sig min  -26 max   25 avg    0 mag   239 qty 219  in  0  cnt   11  on 1
pfod cmd=r
t    21 l3125 v2 PTRK sig min  -26 max   25 avg    0 mag    46 qty 121  in  0  cnt   11  on 1
t    22 l2767 v2 PTRK sig min  -26 max   25 avg    0 mag   149 qty 131  in  0  cnt   11  on 1
t    23 l3249 v2 PTRK sig min  -26 max   25 avg    0 mag   188 qty 172  in  0  cnt   11  on 1
t    24 l3249 v2 PTRK sig min  -21 max   25 avg    1 mag   301 qty 209  in  0  cnt   11  on 1
t    25 l3138 v2 PTRK sig min  -21 max   25 avg    1 mag   188 qty 163  in  0  cnt   11  on 1
pfod cmd=r
t    26 l3165 v2 PTRK sig min  -21 max   25 avg    1 mag   186 qty 180  in  0  cnt   11  on 1
t    27 l2721 v2 PTRK sig min  -21 max   25 avg    1 mag   123 qty 129  in  0  cnt   11  on 1
t    28 l3103 v2 PTRK sig min  -21 max   25 avg    1 mag   201 qty 261  in  0  cnt   11  on 0
t    29 l3090 v2 PTRK sig min  -20 max   22 avg    1 mag   197 qty 147  in  0  cnt   13  on 1
t    30 l3125 v2 PTRK sig min  -20 max   22 avg    1 mag    55 qty 161  in  0  cnt   13  on 1
pfod cmd=r
t    31 l3194 v2 PTRK sig min  -20 max   22 avg    1 mag    66 qty 108  in  1  cnt   14  on 1
t    32 l2836 v2 PTRK sig min  -20 max   22 avg    1 mag  -400 qty 200  in  1  cnt   14  on 1
t    33 l3299 v2 PTRK sig min  -20 max   22 avg    1 mag   183 qty 166  in  0  cnt   15  on 1
t    34 l3301 v2 PTRK sig min  -32 max   44 avg    1 mag   151 qty 133  in  0  cnt   15  on 1
t    35 l3237 v2 PTRK sig min  -32 max   44 avg    1 mag   118 qty 107  in  0  cnt   15  on 1
pfod cmd=r
t    36 l3254 v2 PTRK sig min  -32 max   44 avg    1 mag   433 qty 195  in  0  cnt   15  on 1
t    37 l2736 v2 PTRK sig min  -32 max   44 avg    1 mag   332 qty 169  in  0  cnt   15  on 1
t    38 l3126 v2 PTRK sig min  -32 max   44 avg    1 mag   297 qty 140  in  0  cnt   15  on 1
t    39 l3122 v2 PTRK sig min  -29 max   42 avg    1 mag    96 qty 115  in  0  cnt   15  on 1
t    40 l3159 v2 PTRK sig min  -29 max   42 avg    1 mag   220 qty 200  in  0  cnt   15  on 1
pfod cmd=r
t    41 l3092 v2 PTRK sig min  -29 max   42 avg    1 mag   189 qty 143  in  0  cnt   15  on 0
t    42 l2992 v2 PTRK sig min  -29 max   42 avg    1 mag   248 qty 221  in  0  cnt   15  on 0
t    43 l3159 v2 PTRK sig min  -29 max   42 avg    1 mag   360 qty 223  in  0  cnt   15  on 0
t    44 l3226 v2 PTRK sig min  -22 max   20 avg    1 mag   134 qty 174  in  0  cnt   15  on 0
t    45 l3241 v2 PTRK sig min  -22 max   20 avg    1 mag   230 qty 171  in  0  cnt   15  on 0
t    46 l3313 v2 PTRK sig min  -22 max   20 avg    1 mag   362 qty 184  in  0  cnt   15  on 0
pfod cmd=r
t    47 l3305 v2 PTRK sig min  -22 max   20 avg    1 mag   105 qty 140  in  0  cnt   15  on 0
t    48 l2950 v2 PTRK sig min  -22 max   20 avg    1 mag   145 qty 151  in  0  cnt   15  on 0
t    49 l3295 v2 PTRK sig min  -29 max   30 avg    1 mag   185 qty 194  in  0  cnt   15  on 0
t    50 l3245 v2 PTRK sig min  -29 max   30 avg    1 mag   177 qty 124  in  0  cnt   15  on 0
t    51 l3241 v2 PTRK sig min  -29 max   30 avg    1 mag   194 qty 173  in  0  cnt   15  on 0
pfod cmd=r
t    52 l3171 v2 PTRK sig min  -29 max   30 avg    1 mag   145 qty 190  in  0  cnt   15  on 0
t    53 l2746 v2 PTRK sig min  -29 max   30 avg    1 mag   296 qty 201  in  0  cnt   15  on 0
t    54 l3182 v2 PTRK sig min  -12 max   19 avg    1 mag    44 qty 110  in  0  cnt   15  on 0
t    55 l3118 v2 PTRK sig min  -12 max   19 avg    1 mag   244 qty 167  in  0  cnt   15  on 0
t    56 l3172 v2 PTRK sig min  -12 max   19 avg    1 mag   154 qty 128  in  0  cnt   15  on 0
pfod cmd=r
t    57 l3153 v2 PTRK sig min  -12 max   19 avg    1 mag    69 qty 168  in  0  cnt   15  on 0
t    58 l2791 v2 PTRK sig min  -12 max   19 avg    1 mag   342 qty 179  in  0  cnt   15  on 0
t    59 l3182 v2 PTRK sig min  -40 max   42 avg    1 mag   461 qty 185  in  0  cnt   15  on 0
t    60 l3262 v2 PTRK sig min  -40 max   42 avg    1 mag   450 qty 217  in  0  cnt   15  on 0
t    61 l3326 v2 PTRK sig min  -40 max   42 avg    1 mag   463 qty 191  in  0  cnt   15  on 0
pfod cmd=r
t    62 l3159 v2 PTRK sig min  -40 max   42 avg    1 mag  -118 qty 129  in  1  cnt   16  on 1
pfod cmd=ro
loadSaveRobotStats: write
loadSaveRobotStats addrstop=822
t     0 l2721 v2 OFF  sig min  -40 max   42 avg    1 mag  -464 qty 184  in  1  cnt   16  on 1
t     0 l2721 v2 OFF  sig min  -40 max   42 avg    1 mag -1222 qty 194  in  1  cnt   16  on 1
t     1 l2457 v2 OFF  sig min  -40 max   42 avg    1 mag -1048 qty 195  in  1  cnt   16  on 1
t     2 l3508 v2 OFF  sig min  -90 max   86 avg    0 mag -1148 qty 196  in  1  cnt   16  on 1
t     3 l3432 v2 OFF  sig min  -90 max   86 avg    0 mag -1200 qty 197  in  1  cnt   16  on 1
t     4 l3394 v2 OFF  sig min  -90 max   86 avg    0 mag -1156 qty 198  in  1  cnt   16  on 1
pfod cmd=r
t     5 l3445 v2 OFF  sig min  -90 max   86 avg    0 mag -1045 qty 197  in  1  cnt   16  on 1
t     6 l2942 v2 OFF  sig min  -90 max   86 avg    0 mag -1084 qty 195  in  1  cnt   16  on 1


NEXT -1 / +0.2 :

Code:
perimeter
t     4 l3297 v2 OFF  sig min    0 max    0 avg    0 mag  -552 qty 203  in  1  cnt    2  on 1
t     5 l3332 v2 OFF  sig min    0 max    0 avg    0 mag  -594 qty 191  in  1  cnt    2  on 1
t     6 l3554 v2 OFF  sig min    0 max    0 avg    0 mag  -564 qty 192  in  1  cnt    2  on 1
t     7 l3543 v2 OFF  sig min  -44 max   47 avg    1 mag  -485 qty 193  in  1  cnt    2  on 1
pfod cmd=.
t     8 l3560 v2 OFF  sig min  -44 max   47 avg    1 mag  -494 qty 192  in  1  cnt    2  on 1
t     9 l3197 v2 OFF  sig min  -44 max   47 avg    1 mag  -589 qty 192  in  1  cnt    2  on 1
t    10 l3532 v2 OFF  sig min  -44 max   47 avg    1 mag  -517 qty 192  in  1  cnt    2  on 1
t    11 l3528 v2 OFF  sig min  -44 max   47 avg    1 mag  -541 qty 193  in  1  cnt    2  on 1
t    12 l3524 v2 OFF  sig min  -44 max   47 avg    1 mag  -489 qty 195  in  1  cnt    2  on 1
t    13 l3519 v2 OFF  sig min  -44 max   47 avg    1 mag  -510 qty 193  in  1  cnt    2  on 1
t    14 l3470 v2 OFF  sig min  -44 max   47 avg    1 mag  -590 qty 194  in  1  cnt    2  on 1
t    15 l3451 v2 OFF  sig min  -44 max   47 avg    1 mag  -580 qty 193  in  1  cnt    2  on 1
t    16 l3446 v2 OFF  sig min  -44 max   47 avg    1 mag  -573 qty 191  in  1  cnt    2  on 1
t    17 l3463 v2 OFF  sig min  -39 max   45 avg    1 mag  -548 qty 191  in  1  cnt    2  on 1
t    18 l3468 v2 OFF  sig min  -39 max   45 avg    1 mag  -571 qty 190  in  1  cnt    2  on 1
t    19 l3450 v2 OFF  sig min  -39 max   45 avg    1 mag  -580 qty 193  in  1  cnt    2  on 1
t    20 l3448 v2 OFF  sig min  -39 max   45 avg    1 mag  -593 qty 193  in  1  cnt    2  on 1
t    21 l3455 v2 OFF  sig min  -39 max   45 avg    1 mag  -562 qty 190  in  1  cnt    2  on 1
t    22 l3480 v2 OFF  sig min  -44 max   47 avg    1 mag  -593 qty 191  in  1  cnt    2  on 1
t    23 l3444 v2 OFF  sig min  -44 max   47 avg    1 mag  -528 qty 171  in  1  cnt    2  on 1
pfod cmd=r
t    24 l3440 v2 OFF  sig min  -44 max   47 avg    1 mag  -550 qty 192  in  1  cnt    2  on 1
t    25 l3054 v2 OFF  sig min  -44 max   47 avg    1 mag  -590 qty 197  in  1  cnt    2  on 1
t    26 l3532 v2 OFF  sig min  -44 max   47 avg    1 mag  -584 qty 192  in  1  cnt    2  on 1
pfod cmd=rh
t     0 l3516 v2 PFND sig min  -45 max   47 avg    1 mag  -488 qty 191  in  1  cnt    2  on 1
t     0 l3516 v2 PFND sig min  -45 max   47 avg    1 mag  -569 qty 191  in  1  cnt    2  on 1
t     1 l3219 v2 PFND sig min  -45 max   47 avg    1 mag  -571 qty 189  in  1  cnt    2  on 1
t     2 l3173 v2 PFND sig min  -45 max   47 avg    1 mag  -578 qty 168  in  1  cnt    2  on 1
t     3 l3196 v2 PFND sig min  -45 max   47 avg    1 mag  -642 qty 169  in  1  cnt    2  on 1
t     4 l2998 v2 PFND sig min  -45 max   47 avg    1 mag  -750 qty 179  in  1  cnt    2  on 1
t     5 l2952 v2 PFND sig min  -74 max   76 avg    1 mag -1076 qty 201  in  1  cnt    2  on 1
pfod cmd=r
t     6 l2959 v2 PFND sig min  -74 max   76 avg    1 mag -1193 qty 197  in  1  cnt    2  on 1
t     7 l2528 v2 PFND sig min  -74 max   76 avg    1 mag  -491 qty 167  in  1  cnt    2  on 1
t     8 l2837 v2 PFND sig min  -74 max   76 avg    1 mag  1379 qty 181  in  0  cnt    3  on 1
t     9 l2304 v2 PFND sig min  -74 max   76 avg    1 mag  1511 qty 194  in  0  cnt    3  on 1
t    10 l2208 v2 PFND sig min  -77 max   85 avg    1 mag  -291 qty 192  in  0  cnt    3  on 1
t     0 l2234 v2 PTRK sig min  -77 max   85 avg    1 mag  -624 qty 186  in  1  cnt    4  on 1
pfod cmd=r
t     0 l2234 v2 PTRK sig min  -77 max   85 avg    1 mag -1142 qty 194  in  1  cnt    4  on 1
t     1 l2652 v2 PTRK sig min  -77 max   85 avg    1 mag   736 qty 179  in  0  cnt    5  on 1
t     2 l3164 v2 PTRK sig min  -77 max   85 avg    1 mag   252 qty 185  in  0  cnt    5  on 1
t     3 l3150 v2 PTRK sig min  -77 max   85 avg    1 mag   190 qty 215  in  0  cnt    5  on 1
t     4 l3193 v2 PTRK sig min  -33 max   34 avg    0 mag   -57 qty 116  in  0  cnt    5  on 1
pfod cmd=r
t     5 l3214 v2 PTRK sig min  -33 max   34 avg    0 mag    63 qty 153  in  0  cnt    5  on 1
t     6 l2747 v2 PTRK sig min  -33 max   34 avg    0 mag    63 qty 136  in  0  cnt    5  on 1
t     7 l3321 v2 PTRK sig min  -33 max   34 avg    0 mag   128 qty 136  in  0  cnt    7  on 1
t     8 l3212 v2 PTRK sig min  -33 max   34 avg    0 mag   284 qty 183  in  0  cnt    7  on 1
t     9 l3334 v2 PTRK sig min  -22 max   24 avg    1 mag   114 qty 123  in  0  cnt    7  on 1
pfod cmd=r
t    10 l3291 v2 PTRK sig min  -22 max   24 avg    1 mag   -51 qty 102  in  0  cnt    7  on 1
t    11 l2854 v2 PTRK sig min  -22 max   24 avg    1 mag  -402 qty 170  in  1  cnt    8  on 1
t    12 l3225 v2 PTRK sig min  -22 max   24 avg    1 mag  -520 qty 196  in  1  cnt    8  on 1
t    13 l3264 v2 PTRK sig min  -22 max   24 avg    1 mag  -391 qty 187  in  1  cnt    8  on 1
t    14 l3103 v2 PTRK sig min  -21 max   26 avg    1 mag  -203 qty 161  in  1  cnt    8  on 1
pfod cmd=r
t    15 l3186 v2 PTRK sig min  -21 max   26 avg    1 mag  -743 qty 203  in  1  cnt    8  on 1
t    16 l2718 v2 PTRK sig min  -21 max   26 avg    1 mag  -557 qty 190  in  1  cnt    8  on 1
t    17 l3114 v2 PTRK sig min  -21 max   26 avg    1 mag  -424 qty 151  in  1  cnt    8  on 1
t    18 l3143 v2 PTRK sig min  -21 max   26 avg    1 mag  -455 qty 178  in  1  cnt    8  on 1
t    19 l3131 v2 PTRK sig min  -21 max   26 avg    1 mag  -449 qty 212  in  1  cnt    8  on 1
pfod cmd=r
t    20 l3117 v2 PTRK sig min  -49 max   54 avg    0 mag  -369 qty 182  in  1  cnt    8  on 1
t    21 l2679 v2 PTRK sig min  -49 max   54 avg    0 mag  -555 qty 199  in  1  cnt    8  on 1
t    22 l3168 v2 PTRK sig min  -49 max   54 avg    0 mag  -409 qty 177  in  1  cnt   10  on 1
RTC date received: Tue 20.06.2017
t    23 l3177 v2 PTRK sig min  -49 max   54 avg    0 mag  -152 qty 129  in  1  cnt   10  on 1
t    24 l3189 v2 PTRK sig min  -49 max   54 avg    0 mag  -307 qty 168  in  1  cnt   10  on 1
pfod cmd=r
t    26 l3218 v2 PTRK sig min  -37 max   43 avg    1 mag  -463 qty 235  in  1  cnt   10  on 1
t    27 l3005 v2 PTRK sig min  -37 max   43 avg    1 mag  -543 qty 235  in  1  cnt   10  on 1
t    28 l3251 v2 PTRK sig min  -37 max   43 avg    1 mag  -422 qty 173  in  1  cnt   10  on 1
t    29 l3186 v2 PTRK sig min  -37 max   43 avg    1 mag  -341 qty 161  in  1  cnt   10  on 1
t    30 l3156 v2 PTRK sig min  -37 max   43 avg    1 mag  -185 qty 168  in  1  cnt   10  on 1
t    31 l3139 v2 PTRK sig min  -46 max   53 avg    1 mag  -514 qty 182  in  1  cnt   10  on 1
pfod cmd=r
t    32 l3127 v2 PTRK sig min  -46 max   53 avg    1 mag  -374 qty 149  in  1  cnt   10  on 1
t    33 l2736 v2 PTRK sig min  -46 max   53 avg    1 mag  -554 qty 175  in  1  cnt   10  on 1
t    34 l3162 v2 PTRK sig min  -46 max   53 avg    1 mag  -620 qty 213  in  1  cnt   10  on 1
t    35 l3226 v2 PTRK sig min  -46 max   53 avg    1 mag  -546 qty 195  in  1  cnt   10  on 1
t    36 l3134 v2 PTRK sig min  -51 max   49 avg    1 mag  -433 qty 189  in  1  cnt   10  on 1
pfod cmd=r
t    37 l3216 v2 PTRK sig min  -51 max   49 avg    1 mag  -194 qty 138  in  1  cnt   10  on 1
t    38 l2692 v2 PTRK sig min  -51 max   49 avg    1 mag  -280 qty 186  in  1  cnt   10  on 1
t    39 l3110 v2 PTRK sig min  -51 max   49 avg    1 mag  -454 qty 236  in  1  cnt   10  on 1
t    40 l3177 v2 PTRK sig min  -51 max   49 avg    1 mag  -561 qty 203  in  1  cnt   10  on 1
t    41 l3133 v2 PTRK sig min  -37 max   43 avg    1 mag  -306 qty 237  in  1  cnt   10  on 1
pfod cmd=r
t    42 l3123 v2 PTRK sig min  -37 max   43 avg    1 mag  -473 qty 190  in  1  cnt   10  on 1
t    43 l2713 v2 PTRK sig min  -37 max   43 avg    1 mag  -419 qty 162  in  1  cnt   10  on 1
t    44 l3178 v2 PTRK sig min  -37 max   43 avg    1 mag  -397 qty 171  in  1  cnt   10  on 1
t    45 l3180 v2 PTRK sig min  -37 max   43 avg    1 mag  -441 qty 176  in  1  cnt   10  on 1
t    46 l3264 v2 PTRK sig min  -37 max   48 avg    1 mag  -287 qty 161  in  1  cnt   10  on 1
pfod cmd=r
t    47 l3256 v2 PTRK sig min  -37 max   48 avg    1 mag  -355 qty 159  in  1  cnt   10  on 1
t    48 l2841 v2 PTRK sig min  -37 max   48 avg    1 mag  -328 qty 175  in  1  cnt   10  on 1
t    49 l3329 v2 PTRK sig min  -37 max   48 avg    1 mag  -519 qty 182  in  1  cnt   10  on 1
t    50 l3286 v2 PTRK sig min  -37 max   48 avg    1 mag  -373 qty 188  in  1  cnt   10  on 1
t    51 l3274 v2 PTRK sig min  -31 max   41 avg    1 mag  -451 qty 158  in  1  cnt   10  on 1
pfod cmd=r
t    52 l3237 v2 PTRK sig min  -31 max   41 avg    1 mag  -695 qty 203  in  1  cnt   10  on 1
t    53 l2813 v2 PTRK sig min  -31 max   41 avg    1 mag  -459 qty 230  in  1  cnt   10  on 1
t    54 l3212 v2 PTRK sig min  -31 max   41 avg    1 mag  -323 qty 186  in  1  cnt   10  on 1
t    55 l3246 v2 PTRK sig min  -31 max   41 avg    1 mag  -475 qty 187  in  1  cnt   10  on 1
t    56 l3192 v2 PTRK sig min  -30 max   34 avg    1 mag  -380 qty 191  in  1  cnt   10  on 1
pfod cmd=r
t    57 l3151 v2 PTRK sig min  -30 max   34 avg    1 mag  -384 qty 169  in  1  cnt   10  on 1
t    58 l2706 v2 PTRK sig min  -30 max   34 avg    1 mag  -495 qty 179  in  1  cnt   10  on 1
t    59 l3118 v2 PTRK sig min  -30 max   34 avg    1 mag  -324 qty 177  in  1  cnt   10  on 1
pfod cmd=ro
loadSaveRobotStats: write
loadSaveRobotStats addrstop=822
t     0 l3168 v2 OFF  sig min  -30 max   34 avg    1 mag  -522 qty 187  in  1  cnt   10  on 1
t     0 l3168 v2 OFF  sig min  -30 max   34 avg    1 mag  -343 qty 185  in  1  cnt   10  on 1
t     1 l2611 v2 OFF  sig min  -30 max   34 avg    1 mag  -283 qty 189  in  1  cnt   10  on 1
t     2 l3619 v2 OFF  sig min  -23 max   26 avg    1 mag  -300 qty 192  in  1  cnt   10  on 1


LAST -0.7 / +0.3 :

Code:
perimeter
t     3 l3354 v2 OFF  sig min    0 max    0 avg    0 mag  -764 qty 194  in  1  cnt    2  on 1
t     4 l3262 v2 OFF  sig min    0 max    0 avg    0 mag  -743 qty 193  in  1  cnt    2  on 1
t     5 l3531 v2 OFF  sig min    0 max    0 avg    0 mag  -739 qty 194  in  1  cnt    2  on 1
t     6 l3539 v2 OFF  sig min    0 max    0 avg    0 mag  -632 qty 194  in  1  cnt    2  on 1
t     7 l3520 v2 OFF  sig min  -55 max   60 avg    1 mag  -742 qty 194  in  1  cnt    2  on 1
t     8 l3525 v2 OFF  sig min  -55 max   60 avg    1 mag  -635 qty 194  in  1  cnt    2  on 1
t     9 l3520 v2 OFF  sig min  -55 max   60 avg    1 mag  -678 qty 187  in  1  cnt    2  on 1
t    10 l3532 v2 OFF  sig min  -55 max   60 avg    1 mag  -763 qty 194  in  1  cnt    2  on 1
t    11 l3512 v2 OFF  sig min  -55 max   60 avg    1 mag  -759 qty 206  in  1  cnt    2  on 1
t    12 l3529 v2 OFF  sig min  -57 max   60 avg    1 mag  -755 qty 194  in  1  cnt    2  on 1
t    13 l3509 v2 OFF  sig min  -57 max   60 avg    1 mag  -695 qty 193  in  1  cnt    2  on 1
t    14 l3531 v2 OFF  sig min  -57 max   60 avg    1 mag  -632 qty 196  in  1  cnt    2  on 1
pfod cmd=.
t    15 l3518 v2 OFF  sig min  -57 max   60 avg    1 mag  -765 qty 193  in  1  cnt    2  on 1
t    16 l3215 v2 OFF  sig min  -57 max   60 avg    1 mag  -632 qty 193  in  1  cnt    2  on 1
t    17 l3473 v2 OFF  sig min  -55 max   55 avg    1 mag  -744 qty 193  in  1  cnt    2  on 1
pfod cmd=r
t    18 l3490 v2 OFF  sig min  -55 max   55 avg    1 mag  -626 qty 193  in  1  cnt    2  on 1
t    19 l3087 v2 OFF  sig min  -55 max   55 avg    1 mag  -715 qty 194  in  1  cnt    2  on 1
t    20 l3563 v2 OFF  sig min  -55 max   55 avg    1 mag  -747 qty 195  in  1  cnt    2  on 1
pfod cmd=rh
t     0 l3499 v2 PFND sig min  -55 max   55 avg    1 mag  -753 qty 194  in  1  cnt    2  on 1
t     0 l3499 v2 PFND sig min  -55 max   55 avg    1 mag  -749 qty 194  in  1  cnt    2  on 1
t     1 l3354 v2 PFND sig min  -57 max   58 avg    1 mag  -650 qty 192  in  1  cnt    2  on 1
t     2 l3160 v2 PFND sig min  -57 max   58 avg    1 mag  -740 qty 182  in  1  cnt    2  on 1
t     3 l3190 v2 PFND sig min  -57 max   58 avg    1 mag  -894 qty 175  in  1  cnt    2  on 1
t     4 l3037 v2 PFND sig min  -57 max   58 avg    1 mag -1071 qty 177  in  1  cnt    2  on 1
t     5 l3026 v2 PFND sig min  -57 max   58 avg    1 mag -1218 qty 189  in  1  cnt    2  on 1
pfod cmd=r
t     6 l2977 v2 PFND sig min  -96 max   99 avg    0 mag -1500 qty 194  in  1  cnt    2  on 1
t     7 l2551 v2 PFND sig min  -96 max   99 avg    0 mag  1259 qty 181  in  0  cnt    3  on 1
t     8 l2595 v2 PFND sig min  -96 max   99 avg    0 mag  1404 qty 204  in  0  cnt    3  on 1
t     0 l2215 v2 PTRK sig min  -96 max   99 avg    0 mag  -482 qty 177  in  1  cnt    4  on 1
t     0 l2215 v2 PTRK sig min  -96 max   99 avg    0 mag  -950 qty 180  in  1  cnt    4  on 1
t     1 l2316 v2 PTRK sig min  -96 max   99 avg    0 mag  -765 qty 197  in  1  cnt    4  on 1
pfod cmd=r
t     2 l3265 v2 PTRK sig min  -90 max   87 avg    1 mag   442 qty 174  in  0  cnt    5  on 1
t     3 l2689 v2 PTRK sig min  -90 max   87 avg    1 mag    95 qty 158  in  1  cnt    8  on 1
t     4 l3139 v2 PTRK sig min  -90 max   87 avg    1 mag  -254 qty 176  in  1  cnt    8  on 1
t     5 l3199 v2 PTRK sig min  -90 max   87 avg    1 mag  -173 qty 190  in  1  cnt    8  on 1
t     6 l3211 v2 PTRK sig min  -90 max   87 avg    1 mag  -184 qty 170  in  1  cnt    8  on 1
pfod cmd=r
t     7 l3214 v2 PTRK sig min  -29 max   32 avg    1 mag  -134 qty 165  in  1  cnt    8  on 1
t     8 l2735 v2 PTRK sig min  -29 max   32 avg    1 mag  -174 qty 183  in  1  cnt    8  on 1
t     9 l3203 v2 PTRK sig min  -29 max   32 avg    1 mag  -245 qty 159  in  1  cnt    8  on 1
t    10 l3239 v2 PTRK sig min  -29 max   32 avg    1 mag  -320 qty 191  in  1  cnt    8  on 1
t    11 l3288 v2 PTRK sig min  -29 max   32 avg    1 mag   135 qty 148  in  0  cnt    9  on 1
pfod cmd=r
t    12 l3320 v2 PTRK sig min  -21 max   28 avg    1 mag    77 qty 128  in  0  cnt    9  on 1
t    13 l2831 v2 PTRK sig min  -21 max   28 avg    1 mag  -448 qty 197  in  1  cnt   12  on 1
t    14 l3228 v2 PTRK sig min  -21 max   28 avg    1 mag  -464 qty 183  in  1  cnt   12  on 1
t    15 l3229 v2 PTRK sig min  -21 max   28 avg    1 mag  -436 qty 198  in  1  cnt   12  on 1
t    16 l3250 v2 PTRK sig min  -21 max   28 avg    1 mag  -228 qty 228  in  1  cnt   12  on 1
pfod cmd=r
t    17 l3160 v2 PTRK sig min  -21 max   28 avg    1 mag  -107 qty 117  in  1  cnt   14  on 1
t    18 l2715 v2 PTRK sig min  -22 max   24 avg    1 mag  -319 qty 179  in  1  cnt   14  on 1
t    19 l3115 v2 PTRK sig min  -22 max   24 avg    1 mag  -308 qty 210  in  1  cnt   14  on 1
t    20 l3108 v2 PTRK sig min  -22 max   24 avg    1 mag  -245 qty 192  in  1  cnt   14  on 1
t    21 l3125 v2 PTRK sig min  -22 max   24 avg    1 mag  -227 qty 180  in  1  cnt   14  on 1
pfod cmd=r
t    22 l3118 v2 PTRK sig min  -22 max   24 avg    1 mag  -342 qty 164  in  1  cnt   16  on 1
t    23 l2717 v2 PTRK sig min  -29 max   30 avg    1 mag  -111 qty 148  in  1  cnt   16  on 1
t    24 l3145 v2 PTRK sig min  -29 max   30 avg    1 mag  -584 qty 213  in  1  cnt   16  on 1
t    25 l3206 v2 PTRK sig min  -29 max   30 avg    1 mag  -327 qty 171  in  1  cnt   16  on 1
t    26 l3159 v2 PTRK sig min  -29 max   30 avg    1 mag  -548 qty 192  in  1  cnt   16  on 1
pfod cmd=r
t    27 l3130 v2 PTRK sig min  -29 max   30 avg    1 mag  -213 qty 143  in  1  cnt   16  on 1
t    28 l3028 v2 PTRK sig min  -31 max   33 avg    1 mag  -177 qty 140  in  1  cnt   16  on 1
t    29 l3156 v2 PTRK sig min  -31 max   33 avg    1 mag  -319 qty 201  in  1  cnt   16  on 1
t    30 l3126 v2 PTRK sig min  -31 max   33 avg    1 mag  -657 qty 192  in  1  cnt   16  on 1
RTC date received: Tue 20.06.2017
t    31 l3127 v2 PTRK sig min  -31 max   33 avg    1 mag  -300 qty 197  in  1  cnt   18  on 1
t    32 l3152 v2 PTRK sig min  -31 max   33 avg    1 mag  -146 qty 146  in  1  cnt   18  on 1
pfod cmd=r
t    33 l3182 v2 PTRK sig min  -26 max   27 avg    1 mag  -174 qty 139  in  1  cnt   18  on 1
t    34 l2775 v2 PTRK sig min  -26 max   27 avg    1 mag    50 qty 113  in  0  cnt   21  on 1
t    35 l3172 v2 PTRK sig min  -26 max   27 avg    1 mag   242 qty 242  in  0  cnt   21  on 1
t    36 l3195 v2 PTRK sig min  -26 max   27 avg    1 mag   -42 qty 113  in  0  cnt   21  on 1
t    37 l3103 v2 PTRK sig min  -26 max   27 avg    1 mag   151 qty 157  in  0  cnt   21  on 1
pfod cmd=r
t    38 l3109 v2 PTRK sig min  -28 max   34 avg    1 mag   135 qty 210  in  0  cnt   21  on 1
t    39 l2792 v2 PTRK sig min  -28 max   34 avg    1 mag    74 qty 160  in  0  cnt   21  on 1
t    40 l3115 v2 PTRK sig min  -28 max   34 avg    1 mag   160 qty 192  in  0  cnt   21  on 1
t    41 l3207 v2 PTRK sig min  -28 max   34 avg    1 mag   115 qty 123  in  0  cnt   21  on 1
t    42 l3035 v2 PTRK sig min  -28 max   34 avg    1 mag   198 qty 154  in  0  cnt   21  on 0
pfod cmd=r
t    43 l3164 v2 PTRK sig min  -26 max   25 avg    1 mag  -127 qty 153  in  0  cnt   21  on 0
t    44 l2706 v2 PTRK sig min  -26 max   25 avg    1 mag  -333 qty 201  in  1  cnt   22  on 1
t    45 l3203 v2 PTRK sig min  -26 max   25 avg    1 mag  -281 qty 175  in  1  cnt   22  on 1
t    46 l3228 v2 PTRK sig min  -26 max   25 avg    1 mag  -272 qty 195  in  1  cnt   22  on 1
t    47 l3275 v2 PTRK sig min  -26 max   25 avg    1 mag  -431 qty 215  in  1  cnt   22  on 1
pfod cmd=r
t    48 l3248 v2 PTRK sig min  -37 max   47 avg    1 mag  -341 qty 230  in  1  cnt   22  on 1
t    49 l2833 v2 PTRK sig min  -37 max   47 avg    1 mag  -310 qty 183  in  1  cnt   22  on 1
t    50 l3274 v2 PTRK sig min  -37 max   47 avg    1 mag  -218 qty 134  in  1  cnt   22  on 1
t    51 l3219 v2 PTRK sig min  -37 max   47 avg    1 mag   -95 qty 121  in  1  cnt   22  on 1
t    52 l3131 v2 PTRK sig min  -37 max   47 avg    1 mag  -250 qty 208  in  1  cnt   22  on 1
pfod cmd=r
t    53 l3158 v2 PTRK sig min  -36 max   30 avg    1 mag  -317 qty 174  in  1  cnt   22  on 1
t    54 l2780 v2 PTRK sig min  -36 max   30 avg    1 mag  -233 qty 180  in  1  cnt   22  on 1
t    55 l3219 v2 PTRK sig min  -36 max   30 avg    1 mag  -355 qty 202  in  1  cnt   22  on 1
t    56 l3202 v2 PTRK sig min  -36 max   30 avg    1 mag  -237 qty 211  in  1  cnt   22  on 1
t    57 l3131 v2 PTRK sig min  -36 max   30 avg    1 mag  -278 qty 157  in  1  cnt   22  on 1
pfod cmd=r
t    58 l3156 v2 PTRK sig min  -39 max   37 avg    1 mag  -519 qty 189  in  1  cnt   22  on 1
t    59 l2714 v2 PTRK sig min  -39 max   37 avg    1 mag  -164 qty 172  in  1  cnt   22  on 1
t    60 l3084 v2 PTRK sig min  -39 max   37 avg    1 mag  -289 qty 177  in  1  cnt   22  on 1
pfod cmd=ro
loadSaveRobotStats: write
loadSaveRobotStats addrstop=822
t     0 l3161 v2 OFF  sig min  -39 max   37 avg    1 mag    80 qty 181  in  1  cnt   22  on 1
t     0 l3161 v2 OFF  sig min  -39 max   37 avg    1 mag  -244 qty 169  in  1  cnt   22  on 1


I did a test at the same part of perimeter wire. Unfortunately no perimeter error during tests.

Alex
 
Hi Alex.
The main is that the tracking work smoothly and whithout error.:)
I constate that your mag max value is arround 1500, If you don't use the part of Holoratte code to read it in PFND please set this value in mower.cpp to avoid error tracking .
By.
 
Hi,
Yes I will do, I can also see a influence of setup values for PID. With -0.5 / 0.5 I'm nearly still outside and with -1 / +0.2 nearly still inside.

Alex
 
I tried implement automatic perimeterMagMaxValue reading :
into read sensors I implemented :
if (stateCurr == STATE_PERI_FIND)perimeterMagMedian.add(abs(perimeterMag));
so code is :

Code:
if ((perimeterUse) && (millis() >= nextTimePerimeter)){    
    //nextTimePerimeter = millis() +  50; // 50    nahrazeno následujícími dvěma řádky
      if (stateCurr == STATE_PERI_TRACK) nextTimePerimeter = millis() + 30;
      else nextTimePerimeter = millis() + 50;
        
      perimeterMag = readSensor(SEN_PERIM_LEFT);

      if (stateCurr == STATE_PERI_FIND)perimeterMagMedian.add(abs(perimeterMag));
    
    if ((perimeter.isInside(0) != perimeterInside)){      
      perimeterCounter++;
      perimeterLastTransitionTime = millis();
      perimeterInside = perimeter.isInside(0);


and into setnextstate :


Code:
if (stateNew == STATE_PERI_TRACK){        
    //motorMowEnable = false;     // FIXME: should be an option?

    perimeterMagMaxValue = perimeterMagMedian.getHighest();
    
    setActuator(ACT_CHGRELAY, 0);
    perimeterPID.reset();
    //beep(6);
  }


problem is that I get a error: perimeterMagMedian was not declared in this scope. So I forgot add definition, but which one and where ?

Alex

EDIT:
Sorry I found what's missing : I made RunningMedian.cpp, RunningMedian.h and into robot.h I added : #include "RunningMedian.h" and RunningMedian perimeterMagMedian = RunningMedian(300);



Now debug is ok. Is that right ?

Alex
 
Hi Alex,

In robot.cpp setup() ,I also added something. Not sure if it is needed:

Code:
perimeterMag = 1;
  perimeterMagMedian.add(perimeterMag);
  perimeterInside = true;
  perimeterCounter = 0;  
  perimeterLastTransitionTime = 0;
  perimeterTriggerTime = 0;


Gruess

Chris
 
Teaser: Perimeter tracking not on the wire but inside.
https://www.youtube.com/watch?v=dX386XaY9jw&feature=youtu.be
this was a succesfull partial tracking at 81% of perimetermagMax.
it is highly experimental at the moment but I think it can be done. However it will still need some code to recognize the second possible setpoint close to the wire where it catches the normal tracking again...
this is the relevant part of the code (not complete but for reference) in motor.h:

Code:
void Robot::motorControlPerimeter(){    
  if (millis() < nextTimeMotorPerimeterControl) return;
    nextTimeMotorPerimeterControl = millis() + 30;
  if (trackInsidePerimeterOnly){
    if (perimeterInside){
      perimeterPID.x = (double(perimeterMagMedianInside.getMedian())/double(perimeterMagMax)); 
      perimeterPID.w = -trackMagSetpoint;
      lastPerimeterTrackInside = 1;
      perimeterPID.y_min = -MaxSpeedperiPwm;
      perimeterPID.y_max = MaxSpeedperiPwm;    
      perimeterPID.max_output = MaxSpeedperiPwm;
      perimeterPID.compute();
      setMotorPWM( max(0, min(MaxSpeedperiPwm, MaxSpeedperiPwm/periTrackDivider + 4*perimeterPID.y)), 
                 max(0, min(MaxSpeedperiPwm, MaxSpeedperiPwm/periTrackDivider - 4*perimeterPID.y)), false);
    }
    else{      //!perimeterInside tracking same as line following
      perimeterPID.x = 5*(double(perimeterMagMedianInside.getMedian())/double(perimeterMagMax));
      perimeterPID.w = 1;
      if (lastPerimeterTrackInside) perimeterPID.reset();
      lastPerimeterTrackInside = 0;
      perimeterPID.y_min = -MaxSpeedperiPwm;
      perimeterPID.y_max = MaxSpeedperiPwm;		
      perimeterPID.max_output = MaxSpeedperiPwm;
      perimeterPID.compute();    
      setMotorPWM( max(0, min(MaxSpeedperiPwm, MaxSpeedperiPwm/periTrackDivider - perimeterPID.y)), 
                 max(0, min(MaxSpeedperiPwm, MaxSpeedperiPwm/periTrackDivider + perimeterPID.y)), false);  
    }    
  /*Console.print(perimeterPID.x);
  Console.print("t");          
  Console.println(perimeterPID.y);  */
  }
  else{ //!trackInsidePerimeterOnly normal Line following


Chris
 
Hi Holoratte.
Cool that it's work i think i try with the Due to see if we can track at a longuer distance.

In the perimeter tracking i am going to see that i tell you to read the perimeter each 15ms but it's better to verify the good value for the Mega board.
The perimetermag value is refresh in the readsensors() and the tracking need to read this value as fast as possible for a correct PID compute.


To find the optimal value you need to make a debug record with the console while mower is in tracking mode.

first set the console speed to 115200

next add the 5 debug lines at the beginning of the motorControlPerimeter()

Code:
// PID controller: track perimeter
void Robot::motorControlPerimeter() {
  Console.print(millis());
  Console.print(" perimeterMagMaxValue ");
  Console.print(perimeterMagMaxValue);
  Console.print(" perimeterMag ");
  Console.println(perimeterMag);

  if (millis() < nextTimeMotorPerimeterControl) return;
  nextTimeMotorPerimeterControl = millis() + 15; //bb read the perimeter each 50 ms


then in the void Robot::readSensors() {
set the if (stateCurr == STATE_PERI_TRACK) nextTimePerimeter = millis() + 10; to 10ms
to read as faster as possible



Code:
if ((perimeterUse) && (millis() >= nextTimePerimeter)){    
    //bb
    if (stateCurr == STATE_PERI_TRACK) nextTimePerimeter = millis() +  15;   
    else nextTimePerimeter = millis() +  50;   // 50
    perimeterMag = readSensor(SEN_PERIM_LEFT);
    if (stateCurr == STATE_PERI_FIND)perimeterMagMedian.add(abs(perimeterMag));
    if ((perimeter.isInside(0) != perimeterInside)){


And now lets the mower track in a straight line.


The result in the console normaly get the same perimeterMag value for 3 or 5 lines of each near 10ms so 30 or 50 ms.
Remove the duplicate value after the first one and the millis difference can tell you the perfect value you need to use in the 2 function.

Here result for the DUE with Azurit 1.08 and original ADCMAN without the repeat value

27302 perimeterMagMaxValue 2183 perimeterMag -41
27319 perimeterMagMaxValue 2183 perimeterMag 24
27336 perimeterMagMaxValue 2183 perimeterMag 41
27353 perimeterMagMaxValue 2183 perimeterMag 51
27371 perimeterMagMaxValue 2183 perimeterMag 55
27404 perimeterMagMaxValue 2183 perimeterMag 23
27421 perimeterMagMaxValue 2183 perimeterMag -41
27438 perimeterMagMaxValue 2183 perimeterMag -105
27456 perimeterMagMaxValue 2183 perimeterMag -139
27475 perimeterMagMaxValue 2183 perimeterMag -135

Standard ADCMAN average 17 or 18 ms to refresh the Mag
So change the 15ms to 20ms for DUE to be sure the pid do not receive the same value 2 times



Here the result for the DUE with sunray ADCMAN..

10355 perimeterMagMaxValue 2000 perimeterMag 179
10368 perimeterMagMaxValue 2000 perimeterMag 222
10381 perimeterMagMaxValue 2000 perimeterMag 175
10406 perimeterMagMaxValue 2000 perimeterMag 196
10419 perimeterMagMaxValue 2000 perimeterMag 168
10432 perimeterMagMaxValue 2000 perimeterMag 192
10458 perimeterMagMaxValue 2000 perimeterMag 232
10471 perimeterMagMaxValue 2000 perimeterMag 264
10484 perimeterMagMaxValue 2000 perimeterMag 260

Sunray ADCMAN average 13 or 14 ms to refresh the Mag
As i use this ADCMAN it's why i put 15 ms in my code .

If someone have a mega and find the correct value we can make the diffence between these 2 boards with #ifdef __AVR__

Faster we read the Mag and better is the tracking.
 
Hello Dersebel

unfortunately not from my side. I was busy with other projects and my job.
Feel free to check out the code in my SheepSheep branch (not PCB 1.3 ready) and play with it.
Since a lot of outside testing is required, this will probably have to wait until next spring .

Best regards

Chris
 
Oben