diff --git a/includes/config.h b/includes/config.h index 9cb9db2..a986667 100644 --- a/includes/config.h +++ b/includes/config.h @@ -45,7 +45,7 @@ //Grabing constants #define GRAB_POSITION 23 #define MAX_GRABBING_SPEED 550 -#define RELEASING_SPEED 400 +#define RELEASING_SPEED 1050 #define INIT_GRAB_POSITION -15 diff --git a/src/main.c b/src/main.c index 23156f3..954a972 100644 --- a/src/main.c +++ b/src/main.c @@ -122,6 +122,11 @@ int main(int argc, char *argv[]) s->sock = -1; game_wrapper(s, p); break; + case 7: + init_robot(s); + grab(s, MAX_GRABBING_SPEED); + getchar(); + release(s, RELEASING_SPEED); } } //Close external ressources diff --git a/src/motors.c b/src/motors.c index 084322f..0fb769f 100644 --- a/src/motors.c +++ b/src/motors.c @@ -75,13 +75,15 @@ int release(state *s, int speed) log_this(s, "[%s:release] Releasing failed already in release position\n", __FILE__); return -1; } + sleep(5); ev3_set_speed_sp(s->grabmotor, speed); - ev3_set_ramp_up_sp(s->grabmotor, 7000); + ev3_set_ramp_up_sp(s->grabmotor, 5500); ev3_set_position_sp(s->grabmotor, -7); ev3_command_motor_by_name(s->grabmotor, "run-to-abs-pos"); while (ev3_motor_state(s->grabmotor) & MOTOR_RUNNING); //log_this(s, "Motor %d on port %c opened, assigned and reseted\n", motor->motor_nr, motor->port); ev3_set_ramp_up_sp(s->grabmotor, 0); + sleep(4); return 0; } diff --git a/src/utilspositions.c b/src/utilspositions.c index 3f68492..15d7bd5 100644 --- a/src/utilspositions.c +++ b/src/utilspositions.c @@ -167,7 +167,7 @@ void init_main_positions(state *s, mainpos *p){ //printf("%d\n",side); position s_fr_init={.x = (S_FR_S_0_X + S_FR_S_2_X)/2,.y = (S_FR_S_0_Y + S_FR_S_2_Y )/2 }; position s_fr_ballareaposition = {.x = S_BA_3_X, .y = S_BA_3_Y}; - position s_fr_endingposition = {.x = (S_FR_E_0_X + S_FR_E_2_X)/2 - ROBOT_WIDTH,.y = (S_FR_E_0_Y + S_FR_E_2_Y )/2 }; + position s_fr_endingposition = {.x = (S_FR_E_0_X + S_FR_E_2_X)/2 ,.y = (S_FR_E_0_Y + S_FR_E_2_Y )/2 }; position l_fr_init = {.x = side*(L_FR_S_0_X + L_FR_S_2_X)/2, .y = (L_FR_S_0_Y + L_FR_S_2_Y)/2}; position l_fr_dodgefirst = {.x = side*(L_O1_2_X + BIG_ARENA_MAX_X + ROBOT_WIDTH*1.5)/2, .y = L_O1_2_Y + L_FR_S_0_Y};