From dab083b5d263fdf9675362bfe5a85f993a43a6c6 Mon Sep 17 00:00:00 2001 From: zer0 Date: Wed, 5 May 2010 20:54:41 +0200 Subject: [PATCH] back to old plate --- projects/microb2010/cobboard/shovel.c | 2 +- projects/microb2010/mainboard/commands_traj.c | 6 ++--- projects/microb2010/mainboard/i2c_protocol.c | 7 +----- projects/microb2010/mainboard/robotsim.c | 23 ++++++------------- projects/microb2010/mainboard/strat.c | 5 ++-- 5 files changed, 15 insertions(+), 28 deletions(-) diff --git a/projects/microb2010/cobboard/shovel.c b/projects/microb2010/cobboard/shovel.c index bd0c7c9..b2a8cc0 100644 --- a/projects/microb2010/cobboard/shovel.c +++ b/projects/microb2010/cobboard/shovel.c @@ -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 */ diff --git a/projects/microb2010/mainboard/commands_traj.c b/projects/microb2010/mainboard/commands_traj.c index 92ab9a0..1898bd8 100644 --- a/projects/microb2010/mainboard/commands_traj.c +++ b/projects/microb2010/mainboard/commands_traj.c @@ -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; diff --git a/projects/microb2010/mainboard/i2c_protocol.c b/projects/microb2010/mainboard/i2c_protocol.c index 3354e39..7a2c378 100644 --- a/projects/microb2010/mainboard/i2c_protocol.c +++ b/projects/microb2010/mainboard/i2c_protocol.c @@ -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) diff --git a/projects/microb2010/mainboard/robotsim.c b/projects/microb2010/mainboard/robotsim.c index 7c52835..2d0d7be 100644 --- a/projects/microb2010/mainboard/robotsim.c +++ b/projects/microb2010/mainboard/robotsim.c @@ -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; diff --git a/projects/microb2010/mainboard/strat.c b/projects/microb2010/mainboard/strat.c index db2221f..ad37ec4 100644 --- a/projects/microb2010/mainboard/strat.c +++ b/projects/microb2010/mainboard/strat.c @@ -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); -- 2.39.5