![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
pepe
Robot.cpp@1:2716ea33958b, 2019-05-22 (annotated)
- Committer:
- PedroMartins96
- Date:
- Wed May 22 09:51:53 2019 +0000
- Revision:
- 1:2716ea33958b
- Parent:
- 0:a7324f51348d
- Child:
- 2:06b7789c7da0
123456479876954;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
PedroMartins96 | 0:a7324f51348d | 1 | #include "Robot.h" |
PedroMartins96 | 0:a7324f51348d | 2 | #include "mbed.h" |
PedroMartins96 | 1:2716ea33958b | 3 | #include "Matrix.h" |
PedroMartins96 | 0:a7324f51348d | 4 | |
PedroMartins96 | 0:a7324f51348d | 5 | Serial PC(SERIAL_TX, SERIAL_RX); |
PedroMartins96 | 0:a7324f51348d | 6 | I2C i2c(I2C_SDA, I2C_SCL ); |
PedroMartins96 | 0:a7324f51348d | 7 | const int addr8bit = 20 << 1; // 7bit I2C address is 20; 8bit I2C address is 40 (decimal). |
PedroMartins96 | 1:2716ea33958b | 8 | Matrix map(80,80); |
PedroMartins96 | 0:a7324f51348d | 9 | int16_t countsLeft = 0; |
PedroMartins96 | 0:a7324f51348d | 10 | int16_t countsRight = 0; |
PedroMartins96 | 1:2716ea33958b | 11 | int i, j; |
PedroMartins96 | 1:2716ea33958b | 12 | |
PedroMartins96 | 1:2716ea33958b | 13 | float De=0, Dd=0, pi=3.141529, Ldis=14.2, r=6.95/2, theta=0, teta=0, teta_=0, x=25, y=25, D=0, Wee=0, Wdd=0, v=0, w=0; |
PedroMartins96 | 1:2716ea33958b | 14 | float xc, yc; // coordenadas da célula |
PedroMartins96 | 1:2716ea33958b | 15 | float x_obj = 0, y_obj = 0; |
PedroMartins96 | 1:2716ea33958b | 16 | float xf = 200, yf = 200; // coordenadas finais |
PedroMartins96 | 1:2716ea33958b | 17 | |
PedroMartins96 | 1:2716ea33958b | 18 | float fcr = 1000; // Força Constante Repulsiva |
PedroMartins96 | 1:2716ea33958b | 19 | float fca = 14; // Força Constante Atrativa |
PedroMartins96 | 1:2716ea33958b | 20 | float fre_x = 0, fre_y = 0, fa_x = 0, fa_y = 0, Fr_x = 0, Fr_y = 0; |
PedroMartins96 | 0:a7324f51348d | 21 | |
PedroMartins96 | 0:a7324f51348d | 22 | |
PedroMartins96 | 1:2716ea33958b | 23 | float d = 0, dt = 0; |
PedroMartins96 | 1:2716ea33958b | 24 | float P = 0, I = 0; |
PedroMartins96 | 1:2716ea33958b | 25 | float phi1=0,aux=0; |
PedroMartins96 | 1:2716ea33958b | 26 | float Kv=50, Ks=20, Ki = 0.001; |
PedroMartins96 | 1:2716ea33958b | 27 | float erro = 0; |
PedroMartins96 | 1:2716ea33958b | 28 | int aux_x = 0, aux_y = 0; |
PedroMartins96 | 1:2716ea33958b | 29 | |
PedroMartins96 | 1:2716ea33958b | 30 | //PC.baud(9600); |
PedroMartins96 | 1:2716ea33958b | 31 | //////////////////////////////////////////////////// |
PedroMartins96 | 1:2716ea33958b | 32 | // Seguimento de um percurso // |
PedroMartins96 | 1:2716ea33958b | 33 | //////////////////////////////////////////////////// |
PedroMartins96 | 1:2716ea33958b | 34 | void VFF() |
PedroMartins96 | 0:a7324f51348d | 35 | { |
PedroMartins96 | 1:2716ea33958b | 36 | while((abs(x)<abs(xf)-2)||(abs(y)<abs(yf)-2)||(abs(x)>abs(xf)+2)||(abs(y)>abs(yf)+2)) { |
PedroMartins96 | 1:2716ea33958b | 37 | motion(); |
PedroMartins96 | 1:2716ea33958b | 38 | f_repulsiva(); |
PedroMartins96 | 1:2716ea33958b | 39 | f_atrativa(); |
PedroMartins96 | 1:2716ea33958b | 40 | Fr_x = fre_x + fa_x; |
PedroMartins96 | 1:2716ea33958b | 41 | Fr_y = fre_y + fa_y; |
PedroMartins96 | 1:2716ea33958b | 42 | if(Fr_x>15) Fr_x = 15; |
PedroMartins96 | 1:2716ea33958b | 43 | else if(Fr_x<-15) Fr_x = -15; |
PedroMartins96 | 0:a7324f51348d | 44 | |
PedroMartins96 | 1:2716ea33958b | 45 | if(Fr_y>15) Fr_y = 15; |
PedroMartins96 | 1:2716ea33958b | 46 | else if(Fr_y<-15) Fr_y = -15; |
PedroMartins96 | 0:a7324f51348d | 47 | |
PedroMartins96 | 1:2716ea33958b | 48 | x_obj = x + Fr_x; |
PedroMartins96 | 1:2716ea33958b | 49 | y_obj = y + Fr_y; |
PedroMartins96 | 1:2716ea33958b | 50 | |
PedroMartins96 | 1:2716ea33958b | 51 | erro = sqrt((x_obj-x)*(x_obj-x)+(y_obj-y)*(y_obj-y)) - 9; |
PedroMartins96 | 1:2716ea33958b | 52 | |
PedroMartins96 | 1:2716ea33958b | 53 | P = Kv*erro; |
PedroMartins96 | 1:2716ea33958b | 54 | I += erro; |
PedroMartins96 | 1:2716ea33958b | 55 | v = P + Ki*I; |
PedroMartins96 | 1:2716ea33958b | 56 | if(v>60) v = 60; |
PedroMartins96 | 1:2716ea33958b | 57 | else if(v < -60) v=-60; |
PedroMartins96 | 1:2716ea33958b | 58 | |
PedroMartins96 | 1:2716ea33958b | 59 | phi1=atan2((y_obj-y),(x_obj-x)); // Ângulo entre a posição final e a posição atual |
PedroMartins96 | 1:2716ea33958b | 60 | aux = phi1-teta; |
PedroMartins96 | 1:2716ea33958b | 61 | //Verifica se a diferença dos angulos pertence ao limite entre [-pi;pi] |
PedroMartins96 | 1:2716ea33958b | 62 | if(aux<-pi) { |
PedroMartins96 | 1:2716ea33958b | 63 | aux=aux+2*pi; |
PedroMartins96 | 1:2716ea33958b | 64 | } else if(aux>pi) { |
PedroMartins96 | 1:2716ea33958b | 65 | aux=aux-2*pi; |
PedroMartins96 | 0:a7324f51348d | 66 | } |
PedroMartins96 | 0:a7324f51348d | 67 | |
PedroMartins96 | 1:2716ea33958b | 68 | //Controlo proporcional |
PedroMartins96 | 1:2716ea33958b | 69 | w=Ks*(aux); |
PedroMartins96 | 1:2716ea33958b | 70 | if(w>5) w = 5; |
PedroMartins96 | 1:2716ea33958b | 71 | else if(w<-5) w = -5; |
PedroMartins96 | 1:2716ea33958b | 72 | //motion(); |
PedroMartins96 | 0:a7324f51348d | 73 | |
PedroMartins96 | 1:2716ea33958b | 74 | //PC.printf("fre_x=%f fre_y=%f fa_x=%f fa_y=%f erro=%f P=%f I=%f v=%f w=%f x=%f y=%f\n", fre_x,fre_y,fa_x,fa_y,erro,P,I,v,w,x,y); |
PedroMartins96 | 1:2716ea33958b | 75 | PC.printf("%f %f %f\n",erro, x,y); |
PedroMartins96 | 1:2716ea33958b | 76 | setSpeeds(Wee+33*abs(v)/v,Wdd+30*abs(v)/v); |
PedroMartins96 | 0:a7324f51348d | 77 | } |
PedroMartins96 | 1:2716ea33958b | 78 | setSpeeds(0,0); |
PedroMartins96 | 0:a7324f51348d | 79 | } |
PedroMartins96 | 0:a7324f51348d | 80 | |
PedroMartins96 | 0:a7324f51348d | 81 | |
PedroMartins96 | 1:2716ea33958b | 82 | //////////////////////////////////////////////////// |
PedroMartins96 | 1:2716ea33958b | 83 | // Cria Mapa // |
PedroMartins96 | 1:2716ea33958b | 84 | //////////////////////////////////////////////////// |
PedroMartins96 | 1:2716ea33958b | 85 | void mapa(int x3,int y3) |
PedroMartins96 | 0:a7324f51348d | 86 | { |
PedroMartins96 | 1:2716ea33958b | 87 | for(i=1; i<=x3; i++) { |
PedroMartins96 | 1:2716ea33958b | 88 | for(j=1; j<=y3; j++) { |
PedroMartins96 | 1:2716ea33958b | 89 | if(i==1 || i==80 || j==1 || j==80) map.add(i,j,1); |
PedroMartins96 | 1:2716ea33958b | 90 | else map.add(i,j,0); |
PedroMartins96 | 1:2716ea33958b | 91 | //PC.printf("%d ", int(map.getNumber(i,j))); |
PedroMartins96 | 1:2716ea33958b | 92 | } |
PedroMartins96 | 1:2716ea33958b | 93 | //printf("\n"); |
PedroMartins96 | 1:2716ea33958b | 94 | //PC.printf("%d ", map.getNumber(i,-5)); |
PedroMartins96 | 1:2716ea33958b | 95 | } |
PedroMartins96 | 1:2716ea33958b | 96 | PC.printf("I'm Ready\n"); |
PedroMartins96 | 1:2716ea33958b | 97 | } |
PedroMartins96 | 0:a7324f51348d | 98 | |
PedroMartins96 | 1:2716ea33958b | 99 | //////////////////////////////////////////////////// |
PedroMartins96 | 1:2716ea33958b | 100 | // Cria objeto // |
PedroMartins96 | 1:2716ea33958b | 101 | //////////////////////////////////////////////////// |
PedroMartins96 | 1:2716ea33958b | 102 | void cria_obj(int c, int l, int p[]) |
PedroMartins96 | 1:2716ea33958b | 103 | { |
PedroMartins96 | 1:2716ea33958b | 104 | int k = p[0]/5; |
PedroMartins96 | 1:2716ea33958b | 105 | int m = p[1]/5; |
PedroMartins96 | 1:2716ea33958b | 106 | c = (c/5)/2; |
PedroMartins96 | 1:2716ea33958b | 107 | l = (l/5)/2; |
PedroMartins96 | 1:2716ea33958b | 108 | for(i=k-c+1; i<=k+c; i++) |
PedroMartins96 | 1:2716ea33958b | 109 | { |
PedroMartins96 | 1:2716ea33958b | 110 | for(j=m-l+1; j<=m+l; j++) { |
PedroMartins96 | 1:2716ea33958b | 111 | if((i==(k-c+1)) || (i==(k+c)) || (j==(m-l+1)) || (j==(m+l))) map.add(i,j,1); |
PedroMartins96 | 1:2716ea33958b | 112 | else map.add(i,j, 0); |
PedroMartins96 | 0:a7324f51348d | 113 | } |
PedroMartins96 | 0:a7324f51348d | 114 | } |
PedroMartins96 | 0:a7324f51348d | 115 | } |
PedroMartins96 | 0:a7324f51348d | 116 | |
PedroMartins96 | 1:2716ea33958b | 117 | void print_map(int x3, int y3) |
PedroMartins96 | 0:a7324f51348d | 118 | { |
PedroMartins96 | 1:2716ea33958b | 119 | //map.add(8, 16, 4); |
PedroMartins96 | 1:2716ea33958b | 120 | for(i=1; i<=x3; i++) { |
PedroMartins96 | 1:2716ea33958b | 121 | for(j=1; j<=y3; j++) { |
PedroMartins96 | 1:2716ea33958b | 122 | PC.printf("%d ", int(map.getNumber(i,j))); |
PedroMartins96 | 0:a7324f51348d | 123 | } |
PedroMartins96 | 1:2716ea33958b | 124 | printf("\n"); |
PedroMartins96 | 0:a7324f51348d | 125 | } |
PedroMartins96 | 0:a7324f51348d | 126 | } |
PedroMartins96 | 0:a7324f51348d | 127 | |
PedroMartins96 | 1:2716ea33958b | 128 | //////////////////////////////////////////////////// |
PedroMartins96 | 1:2716ea33958b | 129 | // Força Repulsiva // |
PedroMartins96 | 1:2716ea33958b | 130 | //////////////////////////////////////////////////// |
PedroMartins96 | 1:2716ea33958b | 131 | void f_repulsiva() |
PedroMartins96 | 1:2716ea33958b | 132 | { |
PedroMartins96 | 1:2716ea33958b | 133 | fre_x = 0; |
PedroMartins96 | 1:2716ea33958b | 134 | fre_y = 0; |
PedroMartins96 | 1:2716ea33958b | 135 | aux_x = x/5; |
PedroMartins96 | 1:2716ea33958b | 136 | aux_y = y/5; |
PedroMartins96 | 1:2716ea33958b | 137 | for(i=aux_x-5; i<=aux_x+5; i++) { |
PedroMartins96 | 1:2716ea33958b | 138 | for(j=aux_y-5; j<=aux_y+5; j++) { |
PedroMartins96 | 1:2716ea33958b | 139 | if(i<=0 || i>80 || j<=0 || j>80 || (i == aux_x && j == aux_y)) { |
PedroMartins96 | 1:2716ea33958b | 140 | // do nothing |
PedroMartins96 | 1:2716ea33958b | 141 | } else { |
PedroMartins96 | 1:2716ea33958b | 142 | xc = (i - 1)*5 + 2.5; |
PedroMartins96 | 1:2716ea33958b | 143 | yc = (j - 1)*5 + 2.5; |
PedroMartins96 | 1:2716ea33958b | 144 | d = map.getNumber(i,j)*sqrt((x-xc)*(x-xc)+(y-yc)*(y-yc)); |
PedroMartins96 | 1:2716ea33958b | 145 | if(d < 20 ) fcr = fcr * 1.5; |
PedroMartins96 | 1:2716ea33958b | 146 | else fcr = 80; |
PedroMartins96 | 1:2716ea33958b | 147 | if(d == 0){ |
PedroMartins96 | 1:2716ea33958b | 148 | |
PedroMartins96 | 1:2716ea33958b | 149 | } |
PedroMartins96 | 1:2716ea33958b | 150 | else { |
PedroMartins96 | 1:2716ea33958b | 151 | fre_x = fre_x + ((fcr*map.getNumber(i,j)*(x-xc))/(d*d*d)); |
PedroMartins96 | 1:2716ea33958b | 152 | fre_y = fre_y + ((fcr*map.getNumber(i,j)*(y-yc))/(d*d*d)); |
PedroMartins96 | 1:2716ea33958b | 153 | } |
PedroMartins96 | 1:2716ea33958b | 154 | } |
PedroMartins96 | 1:2716ea33958b | 155 | } |
PedroMartins96 | 1:2716ea33958b | 156 | } |
PedroMartins96 | 1:2716ea33958b | 157 | } |
PedroMartins96 | 1:2716ea33958b | 158 | |
PedroMartins96 | 1:2716ea33958b | 159 | //////////////////////////////////////////////////// |
PedroMartins96 | 1:2716ea33958b | 160 | // Força Atrativa // |
PedroMartins96 | 1:2716ea33958b | 161 | //////////////////////////////////////////////////// |
PedroMartins96 | 1:2716ea33958b | 162 | void f_atrativa() |
PedroMartins96 | 1:2716ea33958b | 163 | { |
PedroMartins96 | 1:2716ea33958b | 164 | dt = sqrt((xf-x)*(xf-x)+(yf-y)*(yf-y)); |
PedroMartins96 | 1:2716ea33958b | 165 | fa_x = fca*((xf-x)/dt); |
PedroMartins96 | 1:2716ea33958b | 166 | fa_y = fca*((yf-y)/dt); |
PedroMartins96 | 1:2716ea33958b | 167 | } |
PedroMartins96 | 1:2716ea33958b | 168 | |
PedroMartins96 | 1:2716ea33958b | 169 | //////////////////////////////////////////////////// |
PedroMartins96 | 1:2716ea33958b | 170 | // Odometria // |
PedroMartins96 | 1:2716ea33958b | 171 | //////////////////////////////////////////////////// |
PedroMartins96 | 0:a7324f51348d | 172 | void motion() |
PedroMartins96 | 0:a7324f51348d | 173 | { |
PedroMartins96 | 0:a7324f51348d | 174 | getCountsAndReset(); |
PedroMartins96 | 0:a7324f51348d | 175 | De=((2*pi*r)*countsLeft)/1440; |
PedroMartins96 | 0:a7324f51348d | 176 | Dd=((2*pi*r)*countsRight)/1440; |
PedroMartins96 | 0:a7324f51348d | 177 | theta=(Dd-De)/Ldis; |
PedroMartins96 | 1:2716ea33958b | 178 | |
PedroMartins96 | 0:a7324f51348d | 179 | D=(De+Dd)/2; |
PedroMartins96 | 1:2716ea33958b | 180 | |
PedroMartins96 | 0:a7324f51348d | 181 | if(theta==0) { |
PedroMartins96 | 0:a7324f51348d | 182 | x=x+D*cos(teta); |
PedroMartins96 | 0:a7324f51348d | 183 | y=y+D*sin(teta); |
PedroMartins96 | 0:a7324f51348d | 184 | teta=teta; |
PedroMartins96 | 0:a7324f51348d | 185 | } else { |
PedroMartins96 | 0:a7324f51348d | 186 | x = x + D*((sin(theta/2)/(theta/2))*cos(teta+theta/2)); |
PedroMartins96 | 0:a7324f51348d | 187 | y = y + D*((sin(theta/2)/(theta/2))*sin(teta+theta/2)); |
PedroMartins96 | 0:a7324f51348d | 188 | teta=teta+theta; |
PedroMartins96 | 0:a7324f51348d | 189 | } |
PedroMartins96 | 1:2716ea33958b | 190 | |
PedroMartins96 | 0:a7324f51348d | 191 | //Limite entre [-2pi; 2pi] |
PedroMartins96 | 1:2716ea33958b | 192 | if (teta>=(pi)) { |
PedroMartins96 | 0:a7324f51348d | 193 | teta=teta-2*pi; |
PedroMartins96 | 0:a7324f51348d | 194 | } |
PedroMartins96 | 1:2716ea33958b | 195 | if (teta<=(-pi)) { |
PedroMartins96 | 0:a7324f51348d | 196 | teta=teta+2*pi; |
PedroMartins96 | 0:a7324f51348d | 197 | } |
PedroMartins96 | 0:a7324f51348d | 198 | |
PedroMartins96 | 0:a7324f51348d | 199 | Wee=(v-(Ldis/2)*w); |
PedroMartins96 | 0:a7324f51348d | 200 | Wdd=(v+(Ldis/2)*w); |
PedroMartins96 | 0:a7324f51348d | 201 | //PC.printf("phi1=%f D=%f x=%f y=%f teta=%f\n", w,theta,x,y,teta); |
PedroMartins96 | 0:a7324f51348d | 202 | } |
PedroMartins96 | 0:a7324f51348d | 203 | |
PedroMartins96 | 0:a7324f51348d | 204 | void setSpeeds(int16_t leftSpeed, int16_t rightSpeed) |
PedroMartins96 | 0:a7324f51348d | 205 | { |
PedroMartins96 | 0:a7324f51348d | 206 | char buffer[5]; |
PedroMartins96 | 0:a7324f51348d | 207 | |
PedroMartins96 | 0:a7324f51348d | 208 | buffer[0] = 0xA1; |
PedroMartins96 | 0:a7324f51348d | 209 | memcpy(&buffer[1], &leftSpeed, sizeof(leftSpeed)); |
PedroMartins96 | 0:a7324f51348d | 210 | memcpy(&buffer[3], &rightSpeed, sizeof(rightSpeed)); |
PedroMartins96 | 0:a7324f51348d | 211 | |
PedroMartins96 | 0:a7324f51348d | 212 | i2c.write(addr8bit, buffer, 5); // 5 bytes |
PedroMartins96 | 0:a7324f51348d | 213 | } |
PedroMartins96 | 0:a7324f51348d | 214 | |
PedroMartins96 | 0:a7324f51348d | 215 | void setLeftSpeed(int16_t speed) |
PedroMartins96 | 0:a7324f51348d | 216 | { |
PedroMartins96 | 0:a7324f51348d | 217 | char buffer[3]; |
PedroMartins96 | 0:a7324f51348d | 218 | |
PedroMartins96 | 0:a7324f51348d | 219 | buffer[0] = 0xA2; |
PedroMartins96 | 0:a7324f51348d | 220 | memcpy(&buffer[1], &speed, sizeof(speed)); |
PedroMartins96 | 0:a7324f51348d | 221 | |
PedroMartins96 | 0:a7324f51348d | 222 | i2c.write(addr8bit, buffer, 3); // 3 bytes |
PedroMartins96 | 0:a7324f51348d | 223 | } |
PedroMartins96 | 0:a7324f51348d | 224 | |
PedroMartins96 | 0:a7324f51348d | 225 | void setRightSpeed(int16_t speed) |
PedroMartins96 | 0:a7324f51348d | 226 | { |
PedroMartins96 | 0:a7324f51348d | 227 | char buffer[3]; |
PedroMartins96 | 0:a7324f51348d | 228 | |
PedroMartins96 | 0:a7324f51348d | 229 | buffer[0] = 0xA3; |
PedroMartins96 | 0:a7324f51348d | 230 | memcpy(&buffer[1], &speed, sizeof(speed)); |
PedroMartins96 | 0:a7324f51348d | 231 | |
PedroMartins96 | 0:a7324f51348d | 232 | i2c.write(addr8bit, buffer, 3); // 3 bytes |
PedroMartins96 | 0:a7324f51348d | 233 | } |
PedroMartins96 | 0:a7324f51348d | 234 | |
PedroMartins96 | 0:a7324f51348d | 235 | void getCounts() |
PedroMartins96 | 0:a7324f51348d | 236 | { |
PedroMartins96 | 0:a7324f51348d | 237 | char write_buffer[2]; |
PedroMartins96 | 0:a7324f51348d | 238 | char read_buffer[4]; |
PedroMartins96 | 0:a7324f51348d | 239 | |
PedroMartins96 | 0:a7324f51348d | 240 | write_buffer[0] = 0xA0; |
PedroMartins96 | 0:a7324f51348d | 241 | i2c.write(addr8bit, write_buffer, 1); |
PedroMartins96 | 0:a7324f51348d | 242 | wait_us(100); |
PedroMartins96 | 0:a7324f51348d | 243 | i2c.read( addr8bit, read_buffer, 4); |
PedroMartins96 | 0:a7324f51348d | 244 | countsLeft = (int16_t((read_buffer[0]<<8)|read_buffer[1])); |
PedroMartins96 | 0:a7324f51348d | 245 | countsRight = (int16_t((read_buffer[2]<<8)|read_buffer[3])); |
PedroMartins96 | 0:a7324f51348d | 246 | } |
PedroMartins96 | 0:a7324f51348d | 247 | |
PedroMartins96 | 0:a7324f51348d | 248 | void getCountsAndReset() |
PedroMartins96 | 0:a7324f51348d | 249 | { |
PedroMartins96 | 0:a7324f51348d | 250 | char write_buffer[2]; |
PedroMartins96 | 0:a7324f51348d | 251 | char read_buffer[4]; |
PedroMartins96 | 0:a7324f51348d | 252 | |
PedroMartins96 | 0:a7324f51348d | 253 | write_buffer[0] = 0xA4; |
PedroMartins96 | 0:a7324f51348d | 254 | i2c.write(addr8bit, write_buffer, 1); |
PedroMartins96 | 0:a7324f51348d | 255 | wait_us(100); |
PedroMartins96 | 0:a7324f51348d | 256 | i2c.read( addr8bit, read_buffer, 4); |
PedroMartins96 | 0:a7324f51348d | 257 | countsLeft = (int16_t((read_buffer[0]<<8)|read_buffer[1])); |
PedroMartins96 | 0:a7324f51348d | 258 | countsRight = (int16_t((read_buffer[2]<<8)|read_buffer[3])); |
PedroMartins96 | 1:2716ea33958b | 259 | } |
PedroMartins96 | 1:2716ea33958b | 260 | |
PedroMartins96 | 1:2716ea33958b | 261 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