Revision 118

View differences:

branch/zemeta/Emb_App/programme_principal_etud.c
198 198
		snd_dtq(CanTx, comm.msg) ;
199 199
	}
200 200
}
201

  
202
void asservissement_voiture()
203
{
204
	CanFrame requete, reponse ; 
205
	unsigned short K=1, angle_reel, error ;
206
	
207
	while(1)
208
	{
209
		// envoie commande deplacement voiture
210
		comm.data.id = 'V' ;
211
		comm.data.rtr = 0 ;
212
		comm.data.val = 20 ; 
213
		snd_dtq(CanTx, comm.msg) ;
214
		
215
		// envoie commande tourelle 
216
		comm.data.id = 'T' ;
217
		comm.data.rtr = 0 ;
218
		comm.data.val = 45 ; 
219
		snd_dtq(CanTx, comm.msg) ;
220
		
221
		//recuperation position tourelle
222
		requete.data.id = 'R' ; // variable requete sert a envoyter une requete.
223
		requete.data.rtr = 1 ;
224
		snd_dtq(CanTx, requete.msg);
225
		rcv_dtq(CanRx, &reponse.msg);
226
		angle_reel = reponse.data.val ; 
227
		
228
		//asservissement position tourelle
229
		error = comm.data.val - angle_reel ;
230
		com = k*error ; 
231
		
232
	}
233
	
234
}

Also available in: Unified diff