]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
Odometry autocalibration
authorpetr <silhavik.p@gmail.com>
Mon, 7 May 2012 21:48:20 +0000 (23:48 +0200)
committerpetr <silhavik.p@gmail.com>
Mon, 7 May 2012 21:48:20 +0000 (23:48 +0200)
Updated saving calibration data for better reading. Left column for left odometry wheel and right for right odometry wheel.

src/robofsm/common-states.cc
src/robofsm/robot.c

index 8914ecfeaf2d2704f20438ff7216939f76da966e..7556727b65ad86d97dbb28e77643c86d7d2f23df 100644 (file)
@@ -451,7 +451,7 @@ FSM_STATE(go_back_for_cal)
                        file = fopen ("odometry_cal_data","a+");
                        sprintf(buffer, "%4.4f", -1/x1);
                        fputs (buffer,file);
-                       fputs ("\n", file);
+                       fputs (" ", file);
                        sprintf(buffer, "%4.4f", -1/y1);
                        fputs (buffer,file);
                        fputs ("\n", file);
index c4fc03463f5da4b07f3b3b1ef2aaf712dd15bad0..57e690a8b1701e9890f5addb90254d41fc566c8d 100644 (file)
@@ -300,14 +300,14 @@ void robot_calibrate_odometry()
                fprintf(stderr, "File not found. \n\n");
                return;
        }
-       char line [10];
+       char line [15];
        float a = 0;
        float b = 0;
        int num = 0;
-       while (fgets (line, 10 , file)) {
-               a += atof(line);
-               fgets (line, 10 , file);
-               b += atof(line);
+       while (fgets (line, 15 , file)) {
+               a += atof(strtok(line," "));
+               fgets (line, 15 , file);
+               b += atof(strtok(NULL," "));
                num ++;
        }
        fclose (file);