RASP-SENSE-HAT-ASTRO-PI-Mouvement

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche


MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.

Senseur de mouvement

Le Sense HAT met en oeuvre de nombreux senseurs, l'un d'eux est un senseur de mouvement appelé IMU. L'IMU est capable de mesurer le type de mouvement qu'il subit.

La source anglaise de cette traduction se trouve ici https://www.raspberrypi.org/learning/astro-pi-guide/sensors/humidity.md

Qu'est ce qu'un IMU?

Il est équipé d'une centrale de mesure inertielle (dite IMU pou Inertial Measurement Unit) sous forme d'une puce qui inclus:

  • Un gyroscope (qui mesure le moment et la rotation)
  • Un accéléromètre (qui mesure les forces d'accélération et peut être utilisé pour trouver la direction de la gravité)
  • Un magnétomètre (qui mesure le champ magnétique de la terre, c'est un peu comme une boussole)

RASP-SENSE-HAT-ASTRO-PI-Mouvement.jpg

Why is a movement sensor important, though? When you're up in space there is one question of absolute importance to which you must always know the answer: which way am I pointing?

If you don't know your orientation you are in big trouble, so an IMU sensor like this one is used on all manned and unmanned spacecraft to track movements and maintain an understanding of orientation. Even the earliest spacecraft had them. Ask your grandparents if they remember the Apollo missions (wikipedia, anglais) that landed humans on the surface of the moon.

Above is a picture of the IMU sensor from the Apollo command module. You'll notice how big it is compared to the tiny black cube on the Astro Pi; that's the difference between 1975 and 2015 technology. Incidentally, the Astro Pi IMU is probably not as accurate as the Apollo one, however it is a million times cheaper!

Comment l'orientation est elle représentée?

We all know the Earth rotates around an axis that runs between the North and South Poles. All objects in space or otherwise have three axes around which they can rotate. If you know how much rotation has happened on each axis, then you know which way the object is pointing.

Les 3 axes utilisés pour décrire le mouvement sont:

  • Elévation, dit "Pitch" en anglais (comme quand l'avion décolle)
  • Roulis/Roulement, dit "Roll" en anglais (comme un avion qui faire la rouleau de la victoire, ou une voiture qui fait un tonneau)
  • Lacet/Embardée, dit "Yaw" en anglais (imaginez un avion qui dévie de sa route comme le ferait une voiture, où une voiture qui prend un virage "en lacet")

Etant donné que l'interface de programmation du Sense Hat utilise ces mêmes mots clés en anglais pour vous permettre d'accéder aux valeurs, nous allons préserver les termes "Pitch"n "Roll", "Yaw".

RASP-SENSE-HAT-ASTRO-PI-Debuter-29.png

RASP-SENSE-HAT-ASTRO-PI-Debuter-30.jpg

Les images ci-dessus montre les 3 axes en relation avec le Sense Hat ainsi que la correspondance dans le monde réel.

Nous allons maintenant démarrer le programme d'exemple en 3D.

Démonstration Appolo Soyuz

The image below shows the Apollo Soyuz module that was used to take humans to the surface of the moon during the 1970s. The 3D demo we're going to play with shows this same spacecraft (but with less detail).

RASP-SENSE-HAT-ASTRO-PI-Mouvement-10.jpg

You will need to have your Raspberry Pi and Sense HAT connected to the internet in order to download the required software.

Enter the commands below into a terminal window:

sudo apt-get install python3-pip
sudo pip-3.2 install pi3d
git clone git://github.com/astro-pi/apollo-soyuz
cd apollo-soyuz
sudo ./soyuz.py

Pi 1 users will have to wait 3 to 4 minutes for this to load. For Pi 2 users it's about 30 seconds. When you see the spacecraft appear on the screen start moving the Raspberry Pi and Sense HAT around with your hands. The the main booster is where the SD card slot is on your Pi.

See if you can get the spacecraft to do the pitch, roll and yaw movements. Refer back to the video (YouTube, anglais) if you need to remind yourself which is which.

The code behind this demo is basically calling the Sense HAT get_orientation function which accesses the IMU sensor. This then returns three angles between 0 and 360 degrees, one for each axis (pitch, roll and yaw). The spacecraft model is then rotated by those angles so that it points in the same direction. This is all repeating over and over very quickly to maintain the orientation of the model with what the IMU is reporting.

Press Esc to exit the demo. Let's try a simpler version of this ourselves in code.

Quelle direction est-elle pointée?

1. Open Python 3 from a terminal window as sudo by typing:

sudo idle3 &

Source: Getting Started with Astro PI et Astro-Pi Guide proposé par Raspberry Pi Learning Resource (www.raspberrypi.org)

Licence Creative Commons - CC-BY-SA
The learning resource is provided for free by the Raspberry Pi Foundation under a Creative Commons licence.
Find more at raspberrypi.org/resources and github.com/raspberrypilearning.

Traduction réalisée par Meurisse. D pour shop.MCHobby.be - Licence CC-BY-SA.
Crédit de traduction: Toute référence, mention ou extrait de cette traduction doit également être explicitement accompagné du crédit de traduction suivant : «  Traduction par MCHobby (shop.MCHobby.be) » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.