Revision 51 branch/lepogam/Emb_App/programme_principal_etud.c
programme_principal_etud.c | ||
---|---|---|
121 | 121 |
// correspondant au nom du v?hicule si le nom se termine par '*' |
122 | 122 |
|
123 | 123 |
unsigned int alpha=0; |
124 |
unsigned int theta=0; |
|
124 | 125 |
unsigned int consigne=450; |
126 |
unsigned int consigne_vitesse=30; |
|
125 | 127 |
unsigned int valeur=0; |
126 |
int k=8;
|
|
128 |
int k=1;
|
|
127 | 129 |
|
128 | 130 |
void asserv0(){ |
129 | 131 |
|
... | ... | |
148 | 150 |
comm.data.rtr=0; |
149 | 151 |
comm.data.val=valeur; |
150 | 152 |
snd_dtq (CanTx,comm.msg); |
153 |
dly_tsk(300); |
|
151 | 154 |
} |
152 | 155 |
} |
153 | 156 |
|
154 | 157 |
void asserv1(){ |
155 | 158 |
if(alpha!=consigne) valeur=k*(consigne-alpha); |
156 | 159 |
} |
160 |
void asserv_vitesse(){ |
|
161 |
/* |
|
162 |
//'U'/85/0x55?: Distance mesuree par le telemetre (1/100 de metre) |
|
163 |
//'D'/68/0x44?: Commande de l'angle des roues directrices (en 1/10 de degre). |
|
164 |
//'V'/86/0x56?: Commande en vitesse des roues motrices du vehicule (en radian /secondes). |
|
165 |
CanFrame comm; |
|
166 |
CanFrame demande; |
|
167 |
CanFrame reponse; |
|
168 |
while(1){ |
|
169 |
|
|
170 |
comm.data.id='D'; //envoi consigne vitesse |
|
171 |
comm.data.rtr=0; |
|
172 |
comm.data.val=consigne_vitesse; |
|
173 |
snd_dtq (CanTx,comm.msg); |
|
174 |
|
|
175 |
|
|
176 |
demande.data.id='U'; |
|
177 |
demande.data.rtr=1; |
|
178 |
|
|
179 |
snd_dtq (CanTx,demande.msg); // Interrogation du peripherique |
|
180 |
rcv_dtq (CanRx,&reponse.msg); // Attente de la reponse |
|
181 |
theta=reponse.data.val; // contient la valeur de retour du simulateur. |
|
182 |
|
|
183 |
|
|
184 |
comm.data.id='D'; |
|
185 |
comm.data.rtr=0; |
|
186 |
comm.data.val=valeur; |
|
187 |
snd_dtq (CanTx,comm.msg); |
|
188 |
} |
|
189 |
*/ |
|
190 |
} |
|
191 |
|
|
157 | 192 |
|
158 | 193 |
void main() |
159 | 194 |
{ |
Also available in: Unified diff