From: Xavier L. <Ba...@us...> - 2011-03-18 17:28:56
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 0d64d8bd6f803f1d1dbc09eb224b352aeb6301b8 (commit) from 0407514312c9770bd5303f1a20f4afa91237679d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0d64d8bd6f803f1d1dbc09eb224b352aeb6301b8 Author: Xavier Lagorce <Xav...@cr...> Date: Fri Mar 18 18:27:02 2011 +0100 [Controller_Motor_STM32] Better demonstration code State space command and state estimator seem to work ! ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/main.c b/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/main.c index 370f723..bd62ea4 100644 --- a/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/main.c +++ b/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/main.c @@ -40,8 +40,8 @@ static void init(void) // Start control of drive motors float k[] = {-68.0325, -1.0205}; float l0[] = {0.0236, 3.9715}; - mc_new_controller(MOTOR3, ENCODER3, 360.0/2000.0/15.0, 0.833, 0.015, 0.005, k, -k[0], l0); - mc_new_controller(MOTOR4, ENCODER4, 360.0/2000.0/15.0, 0.833, 0.015, 0.005, k, -k[0], l0); + mc_new_controller(MOTOR3, ENCODER3, -360.0/2000.0/15.0, 0.833, 0.015, 0.005, k, -k[0], l0); + mc_new_controller(MOTOR4, ENCODER4, -360.0/2000.0/15.0, 0.833, 0.015, 0.005, k, -k[0], l0); // Blink to say we are ready for (uint8_t i=0; i < 2; i++) { @@ -82,29 +82,24 @@ static void NORETURN square_process(void) static void NORETURN goto_process(void) { - float inc = 100; + float inc = 3.6; float ref = 0; - int32_t dt=1000; + int32_t dt= 5; uint8_t ind = 0; + LED1_ON(); // Make the wheels turn - while(ref < 1500) + while(ref < 7200) { mc_gotoPosition(MOTOR3, ref); mc_gotoPosition(MOTOR4, ref); - //position += speed * ((float)dt)/1000.0; ref = ref + inc; timer_delay(dt); - if(ind) { - LED1_ON(); - ind = 0; - } else { - LED1_OFF(); - ind = 1; - } } + timer_delay(1000); mc_delete_controller(MOTOR3); mc_delete_controller(MOTOR4); + LED1_OFF(); } @@ -115,10 +110,6 @@ int main(void) /* Create a new child process */ proc_new(goto_process, NULL, KERN_MINSTACKSIZE * 8, NULL); - //timer_delay(4000); - //mc_delete_controller(MOTOR3); - //mc_delete_controller(MOTOR4); - /* * The main process is kept to periodically report the stack * utilization of all the processes (1 probe per second). hooks/post-receive -- krobot |