Index: branch/beaussant/Emb_App/SessionM32C_E8a_system.hsf
===================================================================
--- branch/beaussant/Emb_App/SessionM32C_E8a_system.hsf	(revision 284)
+++ branch/beaussant/Emb_App/SessionM32C_E8a_system.hsf	(revision 285)
@@ -149,10 +149,10 @@
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_13" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_14" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_15" "0000000000000512" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF3112" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_16" "0000000000FF313C" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_17" "0000000000FFF800" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000A1C" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000820" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_18" "0000000000000A4E" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_19" "0000000000000852" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_2" "000000000000FFFF" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_20" "00000000000000C0" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_21" "0000000000000000" 
@@ -171,9 +171,9 @@
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_33" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_34" "000000000000036A" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_35" "0000000000000000" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "0000000000000005" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000000512" 
-"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000A1C" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_4" "0000000000000007" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_5" "0000000000120000" 
+"{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_6" "0000000000000A4E" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_7" "0000000000000512" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_8" "0000000000000000" 
 "{64753FED-D387-4B8C-A91D-D3419C869C07}C_REGISTER_REG_9" "0000000000000000" 
@@ -209,15 +209,25 @@
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0000_SCOPE" "Current Scope," 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001" "dist_obs, 1, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0001_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002" "consigne, 1, 0, P, Col, Hex, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002" "consigne, 1, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0002_SCOPE" "Current Scope," 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003" "c, 10, 0, P, Col, Hex, N" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0003_SCOPE" "Global," 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004" "commandeR, 1, 0, P, Col, Dec, MA" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0004_SCOPE" "Current Scope," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005" "commandeV, 1, 0, P, Col, Dec, MN" 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005_SCOPE" "Global," 
-"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "6" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005" "in, 1, 0, P, Col, Dec, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0005_SCOPE" "Current Scope," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0006" "cmpt, 1, 0, P, Col, Dec, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0006_SCOPE" "Current Scope," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0007" "is_stable, 1, 0, P, Col, Dec, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0007_SCOPE" "Global," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0008" "commandeV, 1, 0, P, Col, Dec, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0008_SCOPE" "Global," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0009" "est_stable, 1, 0, P, Col, Dec, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0009_SCOPE" "Global," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0010" "dans, 1, 0, P, Col, Dec, MA" 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEM0010_SCOPE" "Global," 
+"{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd0ECX_WATCH_ITEMCnt" "11" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth0" "120" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth1" "150" 
 "{B266D880-6FA1-11D5-8613-00A024591A38}WatchWnd1ColWidth12" "200" 
@@ -321,11 +331,11 @@
 [WINDOW_Z_ORDER]
 "E:\tp_info6_2018_beaussant\Emb_App\programme_principal_etud.c" 
 "E:\tp_info6_2018_beaussant\Emb_App\crt0mr.a30" 
-"E:\tp_info6_2018_beaussant\bsp\periph.c" 
 "E:\tp_info6_2018_beaussant\bsp\clavier.c" 
 "E:\tp_info6_2018_beaussant\Emb_App\conf_noyau.cfg" 
 "E:\tp_info6_2018_beaussant\bsp\uart0.c" 
 "E:\tp_info6_2018_beaussant\Emb_App\Debug\mr308.inc" 
+"E:\tp_info6_2018_beaussant\bsp\periph.c" 
 "E:\tp_info6_2018_beaussant\Emb_App\Debug\mrtable.a30" 
 "E:\tp_info6_2018_beaussant\bsp\lcd.c" 
 [TARGET_NAME]
@@ -374,5 +384,6 @@
 [FLASH_DETAILS]
 "" 0 0 "" 0 "" 0 0 "" 0 0 0 0 0 0 0 "" "" "" "" "" 
 [BREAKPOINTS]
-"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 101505400 1 "{00000000-0000-0000-C000-000000000046}" "" 
+"d:\profs\tp_info14_travail\tp_info14\emb_app\programme_principal_etud.c" 95 100807856 1 "{00000000-0000-0000-C000-000000000046}" "" 
+"e:\tp_info6_2018_beaussant\emb_app\crt0mr.a30" 100 16711726 1 "{00000000-0000-0000-C000-000000000046}" "" 
 [END]
Index: branch/beaussant/Emb_App/programme_principal_etud.c
===================================================================
--- branch/beaussant/Emb_App/programme_principal_etud.c	(revision 284)
+++ branch/beaussant/Emb_App/programme_principal_etud.c	(revision 285)
@@ -121,20 +121,21 @@
 //				correspondant au nom du véhicule si le nom se termine par '*'
 
 int pos_obs=0;
-int commandeT=500;
+int commandeT=700;
 int commandeV=40;
 int commandeR=0;
 //CanFrame touche;
 short consigne=450;
 int dist_obs=0;
-int dist_consigne=709;
+int dist_consigne=705;
 int cmpt;
 char kt=3;
-char kv=15;
+char kv=10;
 float kr=1.5;
 //char c;
 int in;
 int is_stable=0;
+int dans;
 int est_stable=0;
 
 void envoieFrame(unsigned char id, unsigned short val)
@@ -181,7 +182,7 @@
 int stable()
 {
 	is_stable=0;
-	if(intervalle(commandeR,2)==1)
+	if(intervalle(commandeR,5)==1 && cmpt<=20)
 	{
 		cmpt++;
 	}
@@ -230,16 +231,16 @@
 	envoieFrame('V',commandeV);
 	dist_obs=acquiFrame('U');
 	while(est_stable!=1){
+		dist_obs=acquiFrame('U');
+		if(dist_obs<1000){  
 		commandeR=-1*kr*(dist_consigne-dist_obs);
-		envoieFrame('D',commandeR);
-		dist_obs=acquiFrame('U');
+		envoieFrame('D',commandeR);		
+		est_stable=stable();
+		}
 		dly_tsk(10);
-		est_stable=stable();
 	}
+	sta_tsk(ID_asserv_r);
 	sta_tsk(ID_asserv_v);
-	sta_tsk(ID_asserv_r);
-		
-		
 }
 
 
@@ -248,11 +249,11 @@
 	envoieFrame('T',commandeT);
 	pos_obs=acquiFrame('R');
 	while(1)
-	{
+	{	
 		commandeT=kt*(consigne-pos_obs);
 		envoieFrame('T',commandeT);
 		pos_obs=acquiFrame('R');
-		dly_tsk(15);
+		dly_tsk(10);
 	}
 }
 
@@ -260,25 +261,39 @@
 {
 	dist_obs=acquiFrame('U');
 	while(1){
-		commandeR=-1*kr*(dist_consigne-dist_obs);
-		envoieFrame('D',commandeR);
 		dist_obs=acquiFrame('U');
+		if(dist_obs<1000 ){                     
+			envoieFrame('V',commandeV);
+			commandeR=-1*kr*(dist_consigne-dist_obs);
+			envoieFrame('D',commandeR);
+			dist_obs=acquiFrame('U');
+		}
 		dly_tsk(10);
-		}
+	}
+		
 }
 
-void asserv_vitesse()
-{
-	commandeV=50;
-	envoieFrame('V',commandeV);
+void asserv_vitesse(){
 	while(1){
-		commandeV=consigne+kv*commandeR;
-		envoieFrame('D',commandeR);
-		dist_obs=acquiFrame('U');
-		dly_tsk(10);
+		dans=intervalle(commandeR,14);
+		if(dans==1){
+			commandeV=70;
+			kr=0.5;
+		//consigne=0;
+		//kr=0;
+		
+			
 		}
+		else
+		{
+			commandeV=30;
+			//consigne=450;
+			kr=1.4;
+		
+		}
+		dly_tsk(30);
+		}
 }
-
 /*int virage()
 {
 	if(commandeR==0 && dist_obs<dist_consigne) return 1;
Index: branch/beaussant/Emb_App/conf_noyau.cfg
===================================================================
--- branch/beaussant/Emb_App/conf_noyau.cfg	(revision 284)
+++ branch/beaussant/Emb_App/conf_noyau.cfg	(revision 285)
@@ -75,8 +75,8 @@
 };
 
 task[]{
-	entry_address	= depart();
-	name	= ID_depart;
+	entry_address	= asserv_vitesse();
+	name	= ID_asserv_v;
 	stack_size	= 256;
 	stack_section	= stack;
 	priority	= 3;
@@ -85,15 +85,17 @@
 };
 
 task[]{
-	entry_address	= asserv_vitesse();
-	name	= ID_asserv_v;
+	entry_address	= depart();
+	name	= ID_depart;
 	stack_size	= 256;
 	stack_section	= stack;
-	priority	= 2;
+	priority	= 5;
 	initial_start	= OFF;
 	exinf	= 0x0;
 };
 
+
+
 task[]{
 	entry_address	= periph_rx();
 	name	= ID_periph_rx;
