#include "shovel.h"
#define SHOVEL_DOWN 100
-#define SHOVEL_MID 5250
+#define SHOVEL_MID 4500
#define SHOVEL_UP 11000
/* init spickle position at beginning */
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;
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;
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;
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)
}
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();
((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;
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);