]> git.droids-corp.org - aversive.git/commitdiff
back to old plate
authorzer0 <zer0@carbon.local>
Wed, 5 May 2010 18:54:41 +0000 (20:54 +0200)
committerzer0 <zer0@carbon.local>
Wed, 5 May 2010 18:54:41 +0000 (20:54 +0200)
projects/microb2010/cobboard/shovel.c
projects/microb2010/mainboard/commands_traj.c
projects/microb2010/mainboard/i2c_protocol.c
projects/microb2010/mainboard/robotsim.c
projects/microb2010/mainboard/strat.c

index bd0c7c957c5ee3b55b2e6f406e7b2510d267a1ed..b2a8cc0501a66f7adad1b015851385700510c217 100644 (file)
@@ -44,7 +44,7 @@
 #include "shovel.h"
 
 #define SHOVEL_DOWN 100
-#define SHOVEL_MID  5250
+#define SHOVEL_MID  4500
 #define SHOVEL_UP   11000
 
 /* init spickle position at beginning */
index 92ab9a009270a058a9c135e37bdb9aa5d4cd7ffe..1898bd8f69ce65e22a1f8f9d2506eb8248beb0d9 100644 (file)
@@ -833,7 +833,7 @@ static void auto_position(void)
                        COLOR_A(-90));
        strat_hardstop();
 
-       trajectory_d_rel(&mainboard.traj, -70);
+       trajectory_d_rel(&mainboard.traj, -180);
        err = wait_traj_end(END_INTR|END_TRAJ);
        if (err == END_INTR)
                goto intr;
@@ -853,13 +853,13 @@ static void auto_position(void)
                        180);
        strat_hardstop();
 
-       trajectory_d_rel(&mainboard.traj, -80);
+       trajectory_d_rel(&mainboard.traj, -170);
        err = wait_traj_end(END_INTR|END_TRAJ);
        if (err == END_INTR)
                goto intr;
        time_wait_ms(250);
 
-       trajectory_a_rel(&mainboard.traj, COLOR_A(-135));
+       trajectory_a_rel(&mainboard.traj, COLOR_A(-110));
        err = wait_traj_end(END_INTR|END_TRAJ);
        if (err == END_INTR)
                goto intr;
index 3354e394a003aaeffa56600488535065317e0ea6..7a2c3780f43a196947f1e3d197d5b5580f2d5b3e 100644 (file)
@@ -403,8 +403,7 @@ int8_t i2c_led_control(uint8_t addr, uint8_t led, uint8_t state)
 int8_t i2c_cobboard_set_mode(uint8_t mode)
 {
 #ifdef HOST_VERSION
-       cobboard.mode = mode;
-       return 0;
+       return robotsim_i2c_cobboard_set_mode(mode);
 #else
        struct i2c_cmd_cobboard_set_mode buf;
        buf.hdr.cmd = I2C_CMD_COBBOARD_SET_MODE;
@@ -415,15 +414,11 @@ int8_t i2c_cobboard_set_mode(uint8_t mode)
 
 static int8_t i2c_cobboard_set_spickle(uint8_t side, uint8_t flags)
 {
-#ifdef HOST_VERSION
-       return robotsim_i2c_cobboard_set_spickles(side, flags);
-#else
        if (side == I2C_LEFT_SIDE)
                cobboard.lspickle = flags;
        else
                cobboard.rspickle = flags;
        return 0;
-#endif
 }
 
 int8_t i2c_cobboard_pack(uint8_t side)
index 7c5283576c21d25343d53360e5fde1ed7867b150..2d0d7bebbba15245ef27f626c76ca308418bd545 100644 (file)
@@ -111,25 +111,16 @@ robotsim_i2c_ballboard_set_mode(struct i2c_cmd_ballboard_set_mode *cmd)
 }
 
 int8_t
-robotsim_i2c_cobboard_set_spickles(uint8_t side, uint8_t flags)
+robotsim_i2c_cobboard_set_mode(uint8_t mode)
 {
        char buf[BUFSIZ];
        int len;
 
-       if (side == I2C_LEFT_SIDE) {
-               if (cobboard.lspickle == flags)
-                       return 0;
-               else
-                       cobboard.lspickle = flags;
-       }
-       if (side == I2C_RIGHT_SIDE) {
-               if (cobboard.rspickle == flags)
-                       return 0;
-               else
-                       cobboard.rspickle = flags;
-       }
+       if (cobboard.mode == mode)
+               return 0;
 
-       len = snprintf(buf, sizeof(buf), "cobboard=%d,%d\n", side, flags);
+       cobboard.mode = mode;
+       len = snprintf(buf, sizeof(buf), "cobboard=%d\n", mode);
        hostsim_lock();
        write(fdw, buf, len);
        hostsim_unlock();
@@ -227,8 +218,8 @@ void robotsim_update(void)
                ((local_r_pwm * 1000 * FILTER2)/1000);
 
        /* basic collision detection */
-       a2 = atan2(ROBOT_WIDTH/2, ROBOT_HALF_LENGTH_FRONT);
-       d = norm(ROBOT_WIDTH/2, ROBOT_HALF_LENGTH_FRONT);
+       a2 = atan2(ROBOT_WIDTH/2, ROBOT_HALF_LENGTH_REAR);
+       d = norm(ROBOT_WIDTH/2, ROBOT_HALF_LENGTH_REAR);
 
        xfl = x + cos(a+a2) * d;
        yfl = y + sin(a+a2) * d;
index db2221faec66889775952e9e2072f2c364798ccb..ad37ec44a3d86076fd2729ee39561c0123684f17 100644 (file)
@@ -350,9 +350,10 @@ static uint8_t strat_beginning(void)
        uint8_t err;
 
        strat_set_acc(ACC_DIST, ACC_ANGLE);
-       strat_set_speed(400, 150); /* OK */
+       strat_set_speed(600, 60); /* OK */
+       //strat_set_speed(250, 28); /* OK */
 
-       trajectory_d_a_rel(&mainboard.traj, 800, COLOR_A(45));
+       trajectory_d_a_rel(&mainboard.traj, 1000, COLOR_A(20));
        err = WAIT_COND_OR_TRAJ_END(trajectory_angle_finished(&mainboard.traj),
                                    TRAJ_FLAGS_STD);