diff --git a/Device/list_motor.c b/Device/list_motor.c index 506cbe7c4bc7a480c2dcf266229a70e85b1001b2..15f3e5c0751da49b24f2ce28b28c74454e4130e9 100644 --- a/Device/list_motor.c +++ b/Device/list_motor.c @@ -129,15 +129,24 @@ void motors_all_init(void){ motors_init(&gm6020_up, 0x205, GM6020); motors_init(&m3508_frontleft, 0x201, M3508); motors_init(&m3508_frontright, 0x202, M3508); - motors_init(&m3508_backleft, 0x203, M3508); - motors_init(&m3508_backright, 0x204, M3508); + motors_init(&m3508_backright, 0x203, M3508); + motors_init(&m3508_backleft, 0x204, M3508); - gm6020_up.MIN_POSITION = 5565; - gm6020_up.MAX_POSITION = 6675; - gm6020_down.MIN_POSITION = 2519; - gm6020_down.MAX_POSITION = 7015; + // Paramètres ICRA +// gm6020_up.MIN_POSITION = 5565; +// gm6020_up.MAX_POSITION = 6675; +// gm6020_up.target = 6200; +// gm6020_down.MIN_POSITION = 2519; +// gm6020_down.MAX_POSITION = 7015; +// gm6020_down.target = 4750; + + // Paramètres StandardMeca + gm6020_up.MIN_POSITION = 2220; + gm6020_up.MAX_POSITION = 3840; + gm6020_up.target = 3450; + gm6020_down.MIN_POSITION = 2800; + gm6020_down.MAX_POSITION = 6700; gm6020_down.target = 4750; - gm6020_up.target = 6200; } diff --git a/Device/motor.c b/Device/motor.c index b28cc21c80e87771d85bc6d60f186d6e96c175af..4a2174c344e8f73e4e4dc060412838d0c198e3b0 100644 --- a/Device/motor.c +++ b/Device/motor.c @@ -92,7 +92,12 @@ void set_motor_speed(motor_t *motor) float target = motor->target; switch(motor->type){ case M3508: + if ((target < 100.0) && (target > -100.0)){ + run_motor_from_command(motor, motor->pid_pos, target, motor->info.M3508_info.angle); + } + else{ run_motor_from_command(motor, motor->pid_speed, target, motor->info.M3508_info.speed); + } case GM6020: run_motor_from_command(motor, motor->pid_speed, target, motor->info.GM6020_info.speed); case M2006: