https://wiki.mchobby.be/index.php?title=RASP-GPS-ULTIME-Utiliser&feed=atom&action=history
RASP-GPS-ULTIME-Utiliser - Historique des versions
2024-03-29T07:09:33Z
Historique des révisions pour cette page sur le wiki
MediaWiki 1.35.0
https://wiki.mchobby.be/index.php?title=RASP-GPS-ULTIME-Utiliser&diff=6196&oldid=prev
Admin le 24 juillet 2013 à 20:23
2013-07-24T20:23:36Z
<p></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="fr">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Version précédente</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version du 24 juillet 2013 à 20:23</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l16" >Ligne 16 :</td>
<td colspan="2" class="diff-lineno">Ligne 16 :</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> try:</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> try:</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> report = session.next()</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> report = session.next()</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> # Attendre après <del class="diffchange diffchange-inline">une </del>information 'TPV' et afficher l'heure</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> # Attendre après <ins class="diffchange diffchange-inline">un rapport d'</ins>information 'TPV' et afficher l'heure</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> # Pour voir toutes les données, <del class="diffchange diffchange-inline">décommentez </del>la ligne ci-dessous</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> # Pour voir toutes les données, <ins class="diffchange diffchange-inline">dé-commentez </ins>la ligne ci-dessous</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> # print report</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> # print report</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if report['class'] == 'TPV':</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if report['class'] == 'TPV':</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l34" >Ligne 34 :</td>
<td colspan="2" class="diff-lineno">Ligne 34 :</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Fichier:RASP-GPS-ULTIME-Utiliser-01.png]]</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Fichier:RASP-GPS-ULTIME-Utiliser-01.png]]</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">Looking for position data rather than just the timestamp</del>? <del class="diffchange diffchange-inline">Essentially</del>, <del class="diffchange diffchange-inline">all you have to do is parse the </del>'<del class="diffchange diffchange-inline">report</del>' <del class="diffchange diffchange-inline">data following the example above</del>.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Vous êtes plus intéressé par les données de localisation</ins>? <ins class="diffchange diffchange-inline">Ce que vous aurez à faire</ins>, <ins class="diffchange diffchange-inline">pour l</ins>'<ins class="diffchange diffchange-inline">essentiel, est de '''parser''' les informations du rapport en suivant l</ins>'<ins class="diffchange diffchange-inline">exemple du code ci-dessus</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">To see what data is available, you can uncomment the </del>'print report' <del class="diffchange diffchange-inline">line</del>, <del class="diffchange diffchange-inline">and then just look at the different values and class names and pick and choose whatever you want</del>.</div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Vous pouvez dé-commenter la logne </ins>'print report' <ins class="diffchange diffchange-inline">pour voir quelles sont les informations disponibles et ensuite regarder les différentes valeurs et nom de classe qui défilent. Ne vous restera plus, ensuite</ins>, <ins class="diffchange diffchange-inline">qu'a sélectionner l'information qui vous intéresse</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">For example</del>, <del class="diffchange diffchange-inline">you could use the following </del>code <del class="diffchange diffchange-inline">to get the current speed using the </del>TPV <del class="diffchange diffchange-inline">class</del>: </div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Par exemple</ins>, <ins class="diffchange diffchange-inline">vous pouvez utiliser le </ins>code <ins class="diffchange diffchange-inline">suivant pour extraire la vitesse de la classe </ins>TPV: </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> <nowiki> if report['class'] == 'TPV':</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> <nowiki> if report['class'] == 'TPV':</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if hasattr(report, 'speed'):</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if hasattr(report, 'speed'):</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> print report.speed * gps.MPS_TO_KPH</nowiki></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> print report.speed * gps.MPS_TO_KPH</nowiki></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">Vous noterez au passage que la vitesse est fournie en Miles Per Hour (Mile par Heure) et qu'il faut la convertir en Kilomètre par heure en multipliant la vitesse avec la constante MPS_TO_KPH.</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">That's it</del>! <del class="diffchange diffchange-inline">It</del>'<del class="diffchange diffchange-inline">s pretty painless, and now it</del>'<del class="diffchange diffchange-inline">s up to you to figure out what you want to do with you </del>latitude, longitude, date <del class="diffchange diffchange-inline">and time</del>, <del class="diffchange diffchange-inline">speed</del>, altitude, etc.! </div></td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Voila</ins>! <ins class="diffchange diffchange-inline">Ce n</ins>'<ins class="diffchange diffchange-inline">est vraiment pas compliqué... vous pouvez maintenant imaginer ce que vous pouvez réaliser à l</ins>'<ins class="diffchange diffchange-inline">aide de la </ins>latitude, longitude, date <ins class="diffchange diffchange-inline">et heure</ins>, <ins class="diffchange diffchange-inline">vitesse</ins>, altitude, etc.! </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{RASP-GPS-ULTIME-TRAILER}}</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{RASP-GPS-ULTIME-TRAILER}}</div></td></tr>
</table>
Admin
https://wiki.mchobby.be/index.php?title=RASP-GPS-ULTIME-Utiliser&diff=6194&oldid=prev
Admin : Page créée avec « {{RASP-GPS-ULTIME-NAV}} {{bloc-etroit|text=Maintenant que avez un GPS et état de marche et '''gpsd''' fonctionnant avec lui, il est temps de faire quelque-chose avec ces do... »
2013-07-24T20:05:51Z
<p>Page créée avec « {{RASP-GPS-ULTIME-NAV}} {{bloc-etroit|text=Maintenant que avez un GPS et état de marche et '''gpsd''' fonctionnant avec lui, il est temps de faire quelque-chose avec ces do... »</p>
<p><b>Nouvelle page</b></p><div>{{RASP-GPS-ULTIME-NAV}}<br />
<br />
{{bloc-etroit|text=Maintenant que avez un GPS et état de marche et '''gpsd''' fonctionnant avec lui, il est temps de faire quelque-chose avec ces données!<br />
<br />
Le plus facile pour démarrer est d'utiliser [[Pi-WebIde|WebIDE]] et un peu de code Python pour accéder à gpsd.<br />
<br />
Créez un nouveau fichier dans WebIDE, ajoutez et exécutez ensuite le code suivant:}}<br />
<br />
<nowiki>import gps<br />
<br />
# Ecouter sur le port 2947 (gpsd) de localhost<br />
session = gps.gps("localhost", "2947")<br />
session.stream(gps.WATCH_ENABLE | gps.WATCH_NEWSTYLE)<br />
<br />
while True:<br />
try:<br />
report = session.next()<br />
# Attendre après une information 'TPV' et afficher l'heure<br />
# Pour voir toutes les données, décommentez la ligne ci-dessous<br />
# print report<br />
if report['class'] == 'TPV':<br />
if hasattr(report, 'time'):<br />
print report.time<br />
except KeyError:<br />
pass<br />
except KeyboardInterrupt:<br />
quit()<br />
except StopIteration:<br />
session = None<br />
print "GPSD est arrete (has terminated)"</nowiki><br />
<br />
Vous devriez voir quelque-chose de similaire à ceci (avec une mise-à-jour toutes les secondes):<br />
<br />
[[Fichier:RASP-GPS-ULTIME-Utiliser-01.png]]<br />
<br />
Looking for position data rather than just the timestamp? Essentially, all you have to do is parse the 'report' data following the example above.<br />
<br />
To see what data is available, you can uncomment the 'print report' line, and then just look at the different values and class names and pick and choose whatever you want.<br />
<br />
For example, you could use the following code to get the current speed using the TPV class: <br />
<br />
<nowiki> if report['class'] == 'TPV':<br />
if hasattr(report, 'speed'):<br />
print report.speed * gps.MPS_TO_KPH</nowiki><br />
<br />
That's it! It's pretty painless, and now it's up to you to figure out what you want to do with you latitude, longitude, date and time, speed, altitude, etc.! <br />
<br />
{{RASP-GPS-ULTIME-TRAILER}}</div>
Admin