void setup() {
// put your setup code here, to run once:
pinMode(A0,INPUT);
Serial.begin(115200);
}
float float_map(float x, float in_min, float in_max, float out_min, float out_max) {
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
void loop() {
// put your main code here, to run repeatedly:
float theoretical_thetaT = float_map(analogRead(A0),0,1023,-M_PI,M_PI);
float xT = 0, yT = 100;
float x_mod = xT*sin(theoretical_thetaT) - yT*cos(theoretical_thetaT); //modifie l'orientation du vecteur déplacement si le robot n'est pas aligné au plan
float y_mod = xT*cos(theoretical_thetaT) + yT*sin(theoretical_thetaT);
Serial.print(theoretical_thetaT);Serial.print("\t");
Serial.print(xT);Serial.print("\t");Serial.print(yT);Serial.print("\t");
Serial.print(x_mod);Serial.print("\t");Serial.print(y_mod);Serial.println();
}