Ligne 48 : |
Ligne 48 : |
| =Actionneurs= | | =Actionneurs= |
| | | |
| + | =Explication Programme= |
| + | ==Odometry== |
| + | ===MCP233.c=== |
| + | Ce fichier contient les commandes permettant de configurer le moteur |
| + | ===rbtMovement.c=== |
| + | On trouvera ici toutes les commandes de déplacement pour le robot |
| <syntaxhighlight lang="c"> | | <syntaxhighlight lang="c"> |
− | long some_function();
| + | void rbtMovement Init ( uint16_t whDist , uint16_t dmWh1, uint16_t dmWh2, |
− | /* int */ other_function(); | + | uint16_t ti c k s 1 , uint16_t t i c k s 2 ) |
| + | </syntaxhighlight> |
| + | Cette fonction permet de configurer les encodeurs : |
| + | 1. whDist = distance entre les 2 encodeurs |
| + | 2. dmWh1 et dmWh2 = diamètre en mm de chaque encodeur |
| + | 3. ticks1 et ticks2 = nombre de ticks par rotation des encodeurs |
| + | |
| + | <syntaxhighlight lang="c"> |
| + | void rbtMove ( in t32_ t d i s t ) //Deplacement du robo t en l i g n e d r o i t e en mm∗/ |
| + | 2 void rbt_turn ( in t16_ t a ngl e ) // Ro ta tion du ro bo t en d eg r e |
| + | </syntaxhighlight> |
| | | |
− | /* int */ calling_function()
| |
− | {
| |
− | long test1;
| |
− | register /* int */ test2;
| |
| | | |
− | test1 = some_function();
| + | <syntaxhighlight lang="c"> |
− | if (test1 > 0)
| + | s t a t i c void rb tS ta teMachine ( in t32_ t targetEncoderCountsM1 , in t32_ t |
− | test2 = 0;
| + | targetEncoderCountsM2 ) |
− | else
| |
− | test2 = other_function();
| |
− | return test2;
| |
− | }
| |
| </syntaxhighlight> | | </syntaxhighlight> |
| + | |
| + | Cette fonction permet de recevoir l’état du robot : |
| + | 1. BLOCKED = le robot ne bouge pas |
| + | 2. READY_TO_SEND = prêt a envoyer une commande |
| + | 3. IDLE = prêt a recevoir une commmande |
| + | 4. BUSY = En train d’exécuter une commande |
| + | 5. PAUSED = une commande a été annulé, le mouvement doit reprendre avant de repasser en état IDLE |
| + | 6. RESUMING = compléte la commande qui a été annulée avant de repasser en IDLE |