RP20240_Device_USB/Readme.md

127 lines
18 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Projet modèle pour le Rpi Pico (RP2040)
=======================================
Code pour travailler sur la communication USB, côté device.
Nous commençons à stocker les données reçues dans des structures pour simplifier l'interprétation des données.
Méthode de test
---------------
* Ouvrir un terminal pour lire les données reçues en désactivant l'écho
`stty -F /dev/ttyACM1 -echo`
`cat /dev/ttyACM0`
* Ouvrir un terminal pour envoyer les données. Contrôle de la LED avec :
`echo -e "\xFF\xFF\x06rD\x00\x01\x06\x00" > /dev/ttyACM1`
ou
`echo -e "\xFF\xFF\x06rD\x00\x01\x36\x00" > /dev/ttyACM1`
* Tester la réception de la position
`echo -e "\xFF\xFF\x11rP\x00\x0C\x01\x01\x01\x01\x05\x05\x05\x05\x09\x09\x09\x09\x00" > /dev/ttyACM1`
Difficultés rencontrées
-----------------------
En testant avec Linux, le terminal peut manger certains caractères lorsqu'il les reçoit (0x11, 0x12 et 0x13).
Annexe
======
Table des registres :
---------------------
| Adresse | R/W | Type | Donnée |
| ------- | --- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 0x00 | RW | flottant 32 bits | Position X en mm |
| 0x01 | RW | flottant 32 bits | Position X en mm |
| 0x02 | RW | flottant 32 bits | Position X en mm |
| 0x03 | RW | flottant 32 bits | Position X en mm |
| 0x04 | RW | flottant 32 bits | Position Y en mm |
| 0x05 | RW | flottant 32 bits | Position Y en mm |
| 0x06 | RW | flottant 32 bits | Position Y en mm |
| 0x07 | RW | flottant 32 bits | Position Y en mm |
| 0x08 | RW | flottant 32 bits | Orientation en radian |
| 0x09 | RW | flottant 32 bits | Orientation en radian |
| 0x0A | RW | flottant 32 bits | Orientation en radian |
| 0x0B | RW | flottant 32 bits | Orientation en radian |
| 0x0C | R | Boolean | Mouvement en cours : 1<br>Mouvement terminé : 0 |
| 0x0D | RW | uint8_t | Mode<br>0 : arrêt des moteurs<br>1 : pilotage des moteurs PWM<br>2 : pilotage en vitesse des roues<br>3 : pilotage avec la loi de commande<br>4 : Trajectoire |
| 0x0E | RW | int_16 | Commande PWM moteur gauche |
| 0x0F | RW | int_16 | Commande PWM moteur gauche |
| 0x10 | RW | int_16 | Commande PWM moteur droit |
| 0x11 | RW | int_16 | Commande PWM moteur droit |
| 0x12 | RW | Flottant 32 bits | Consigne vitesse gauche en mm/s |
| 0x13 | RW | Flottant 32 bits | Consigne vitesse gauche en mm/s |
| 0x14 | RW | Flottant 32 bits | Consigne vitesse gauche en mm/s |
| 0x15 | RW | Flottant 32 bits | Consigne vitesse gauche en mm/s |
| 0x16 | RW | Flottant 32 bits | Consigne vitesse gauche en mm/s |
| 0x17 | RW | Flottant 32 bits | Consigne vitesse gauche en mm/s |
| 0x18 | RW | Flottant 32 bits | Consigne vitesse gauche en mm/s |
| 0x19 | RW | Flottant 32 bits | Consigne vitesse gauche en mm/s |
| 0x1A | RW | Flottant 32 bits | Consigne d’avance du robot |
| 0x1B | RW | Flottant 32 bits | Consigne d’avance du robot |
| 0x1C | RW | Flottant 32 bits | Consigne d’avance du robot |
| 0x1D | RW | Flottant 32 bits | Consigne d’avance du robot |
| 0x1E | RW | Flottant 32 bits | Consigne de rotation du robot |
| 0x1F | RW | Flottant 32 bits | Consigne de rotation du robot |
| 0x20 | RW | Flottant 32 bits | Consigne de rotation du robot |
| 0x21 | RW | Flottant 32 bits | Consigne de rotation du robot |
| 0x22 | RW | Enum 8 bits | Trajectoire, type :<br>0 : Droite<br>1 : Circulaire<br>2 : Bézier<br>3 : Composée<br>4 : Rotation |
| 0x23 | RW | Flottant 32 bits | Point 1, X |
| 0x24 | RW | Flottant 32 bits | Point 1, X |
| 0x25 | RW | Flottant 32 bits | Point 1, X |
| 0x26 | RW | Flottant 32 bits | Point 1, X |
| 0x27 | RW | Flottant 32 bits | Point 1, Y |
| 0x28 | RW | Flottant 32 bits | Point 1, Y |
| 0x29 | RW | Flottant 32 bits | Point 1, Y |
| 0x2A | RW | Flottant 32 bits | Point 1, Y |
| 0x2B | RW | Flottant 32 bits | Point 2, X |
| 0x2C | RW | Flottant 32 bits | Point 2, X |
| 0x2D | RW | Flottant 32 bits | Point 2, X |
| 0x2E | RW | Flottant 32 bits | Point 2, X |
| 0x2F | RW | Flottant 32 bits | Point 2, Y |
| 0x30 | RW | Flottant 32 bits | Point 2, Y |
| 0x31 | RW | Flottant 32 bits | Point 2, Y |
| 0x32 | RW | Flottant 32 bits | Point 2, Y |
| 0x33 | RW | Flottant 32 bits | Point 3, X |
| 0x34 | RW | Flottant 32 bits | Point 3, X |
| 0x35 | RW | Flottant 32 bits | Point 3, X |
| 0x36 | RW | Flottant 32 bits | Point 3, X |
| 0x37 | RW | Flottant 32 bits | Point 3, Y |
| 0x38 | RW | Flottant 32 bits | Point 3, Y |
| 0x39 | RW | Flottant 32 bits | Point 3, Y |
| 0x3A | RW | Flottant 32 bits | Point 3, Y |
| 0x3B | RW | Flottant 32 bits | Point 4, X |
| 0x3C | RW | Flottant 32 bits | Point 4, X |
| 0x3D | RW | Flottant 32 bits | Point 4, X |
| 0x3E | RW | Flottant 32 bits | Point 4, X |
| 0x3F | RW | Flottant 32 bits | Point 4, Y |
| 0x40 | RW | Flottant 32 bits | Point 4, Y |
| 0x41 | RW | Flottant 32 bits | Point 4, Y |
| 0x42 | RW | Flottant 32 bits | Point 4, Y |
| 0x43 | RW | Flottant 32 bits | orientation_debut_rad |
| 0x44 | RW | Flottant 32 bits | orientation_debut_rad |
| 0x45 | RW | Flottant 32 bits | orientation_debut_rad |
| 0x46 | RW | Flottant 32 bits | orientation_debut_rad |
| 0x47 | RW | Flottant 32 bits | orientation_fin_rad |
| 0x48 | RW | Flottant 32 bits | orientation_fin_rad |
| 0x49 | RW | Flottant 32 bits | orientation_fin_rad |
| 0x4A | RW | Flottant 32 bits | orientation_fin_rad |
| 0x4B | RW | Flottant 32 bits | rayon mm |
| 0x4C | RW | Flottant 32 bits | rayon mm |
| 0x4D | RW | Flottant 32 bits | rayon mm |
| 0x4E | RW | Flottant 32 bits | rayon mm |
| 0x4F | RW | Flottant 32 bits | Angle début rad |
| 0x50 | RW | Flottant 32 bits | Angle début rad |
| 0x51 | RW | Flottant 32 bits | Angle début rad |
| 0x52 | RW | Flottant 32 bits | Angle début rad |
| 0x53 | RW | Flottant 32 bits | Angle fin rad |
| 0x54 | RW | Flottant 32 bits | Angle fin rad |
| 0x55 | RW | Flottant 32 bits | Angle fin rad |
| 0x56 | RW | Flottant 32 bits | Angle fin rad |