X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=projects%2Fmicrob2010%2Fcobboard%2Fshovel.c;h=8714367decc766ba438a7a2b1ce722e413a83a20;hb=e6e4582229cd4ed8ffe73bdfbae79d236129df3b;hp=71139ab7ad78fab6357f6e59843c54d0e60d6071;hpb=d9b4e922ce1253224adb937d65c8c2e7cd5cfe87;p=aversive.git diff --git a/projects/microb2010/cobboard/shovel.c b/projects/microb2010/cobboard/shovel.c index 71139ab..8714367 100644 --- a/projects/microb2010/cobboard/shovel.c +++ b/projects/microb2010/cobboard/shovel.c @@ -1,6 +1,6 @@ -/* +/* * Copyright Droids Corporation (2010) - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -45,7 +45,9 @@ #define SHOVEL_DOWN 100 #define SHOVEL_MID 4500 -#define SHOVEL_UP 11000 +#define SHOVEL_UP 11300 +#define SHOVEL_KICKSTAND_UP 12800 +#define SHOVEL_KICKSTAND_DOWN 10000 static int32_t shovel_k1 = 1000; static int32_t shovel_k2 = 20; @@ -120,6 +122,7 @@ void shovel_set(void *mot, int32_t cmd) void shovel_down(void) { + shovel_current_limit_enable(0); quadramp_set_1st_order_vars(&cobboard.shovel.qr, 2500, 2500); quadramp_set_2nd_order_vars(&cobboard.shovel.qr, 50, 80); cs_set_consign(&cobboard.shovel.cs, SHOVEL_DOWN); @@ -127,6 +130,7 @@ void shovel_down(void) void shovel_mid(void) { + shovel_current_limit_enable(0); quadramp_set_1st_order_vars(&cobboard.shovel.qr, 2500, 2500); quadramp_set_2nd_order_vars(&cobboard.shovel.qr, 80, 80); cs_set_consign(&cobboard.shovel.cs, SHOVEL_MID); @@ -134,6 +138,7 @@ void shovel_mid(void) void shovel_up(void) { + shovel_current_limit_enable(0); if (state_get_cob_count() <= 1) quadramp_set_1st_order_vars(&cobboard.shovel.qr, 1000, 2500); else @@ -142,11 +147,22 @@ void shovel_up(void) cs_set_consign(&cobboard.shovel.cs, SHOVEL_UP); } -void shovel_kickstand(void) +void shovel_kickstand_up(void) { + shovel_set_current_limit_coefs(1000, 20); + shovel_current_limit_enable(1); quadramp_set_1st_order_vars(&cobboard.shovel.qr, 200, 200); quadramp_set_2nd_order_vars(&cobboard.shovel.qr, 10, 10); - cs_set_consign(&cobboard.shovel.cs, SHOVEL_UP); + cs_set_consign(&cobboard.shovel.cs, SHOVEL_KICKSTAND_UP); +} + +void shovel_kickstand_down(void) +{ + shovel_set_current_limit_coefs(500, 0); + shovel_current_limit_enable(1); + quadramp_set_1st_order_vars(&cobboard.shovel.qr, 200, 200); + quadramp_set_2nd_order_vars(&cobboard.shovel.qr, 10, 10); + cs_set_consign(&cobboard.shovel.cs, SHOVEL_KICKSTAND_DOWN); } uint8_t shovel_is_up(void)