{"id":2148,"date":"2021-05-06T16:15:08","date_gmt":"2021-05-06T14:15:08","guid":{"rendered":"http:\/\/anthony.lepors.fr\/raspi-thermo-cam\/?page_id=2148"},"modified":"2021-05-06T17:18:32","modified_gmt":"2021-05-06T15:18:32","slug":"pilotage-moteur-joystick","status":"publish","type":"page","link":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/pilotage-moteur-joystick\/","title":{"rendered":"Piloter 2 moteurs avec un Joystick"},"content":{"rendered":"<p>[et_pb_section fb_built=\u00a0\u00bb1&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_row _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_column type=\u00a0\u00bb4_4&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_text _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb]<\/p>\n<h1>Pilotage de 2 moteurs DC avec un Joystick virtuel en JAVA<\/h1>\n<p>Dans le but de cr\u00e9er un robot thermique, nous souhaitons piloter le Raspberry en direct au travers d&rsquo;une interface d\u00e9velopp\u00e9e en Java Swing. Pour cela, la partie la plus importante concerne le pilotage de 2 moteurs DC avec le GPIO du Raspberry.\u00a0Apr\u00e8s avoir fait le n\u00e9cessaire au niveau des installations de Pi4J sur le Raspberry (<a href=\"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/raspberry-installation-pi4j\/\">voir page<\/a>) et sur le PC Windows (<a href=\"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/developpement-java-eclipse\/\">voir page<\/a>), nous pouvons maintenant d\u00e9velopper une application en nous appuyant sur le pr\u00e9c\u00e9dent test r\u00e9alis\u00e9 avec le contr\u00f4le d&rsquo;une LED (<a href=\"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/controle-led-java\/\">voir page pr\u00e9c\u00e9dente<\/a>).<\/p>\n<p>Le robot que nous utilisons est un robot con\u00e7u par Anthony pour son TPE de Premi\u00e8re S. Une page r\u00e9sume la construction de ce dernier (<a href=\"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/creation-robot\">voir onglet Mat\u00e9riel<\/a>). Pour ce projet, le Raspberry \u00e9tait programm\u00e9 en Python (<a href=\"https:\/\/antholp.wixsite.com\/raspi-car\">projet Raspi Car<\/a>) et c&rsquo;est donc ici l&rsquo;occasion de faire le code \u00e9quivalent en Java.<\/p>\n<h2>Branchement des moteurs avec la puce L293D<\/h2>\n<p class=\"font_7\">Le L293D est un composant indispensable pour piloter 2 moteurs \u00e0 courant continu.\u00a0Il permet de contr\u00f4ler le sens et la vitesse\u00a0de rotation d&rsquo;un ou deux moteurs en inversant la polarit\u00e9 du c\u00e2blage. Les moteurs sont en effet branch\u00e9s sur le L293D, qui lui est connect\u00e9 au GPIO du Raspberry. Le plan de c\u00e2blage de la puce avec les 2 moteurs est le suivant :<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=\u00a0\u00bb2_3,1_3&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb custom_padding=\u00a0\u00bb0px||||false|false\u00a0\u00bb][et_pb_column type=\u00a0\u00bb2_3&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_image src=\u00a0\u00bbhttps:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-content\/uploads\/2021\/05\/cablage-moteurs-DC.png\u00a0\u00bb title_text=\u00a0\u00bbcablage-moteurs-DC\u00a0\u00bb show_in_lightbox=\u00a0\u00bbon\u00a0\u00bb _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb box_shadow_style=\u00a0\u00bbpreset1&Prime;][\/et_pb_image][\/et_pb_column][et_pb_column type=\u00a0\u00bb1_3&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_image src=\u00a0\u00bbhttps:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-content\/uploads\/2021\/05\/branchement-l293d.jpg\u00a0\u00bb title_text=\u00a0\u00bbbranchement-l293d\u00a0\u00bb show_in_lightbox=\u00a0\u00bbon\u00a0\u00bb _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb min_height=\u00a0\u00bb11px\u00a0\u00bb custom_margin=\u00a0\u00bb123px||||false|false\u00a0\u00bb custom_padding=\u00a0\u00bb||0px|||\u00a0\u00bb box_shadow_style=\u00a0\u00bbpreset1&Prime;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb custom_padding=\u00a0\u00bb0px||10px||false|false\u00a0\u00bb][et_pb_column type=\u00a0\u00bb4_4&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_text _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb]<\/p>\n<p>Les ports GPIO utilis\u00e9s pour le branchement de la L293D sont list\u00e9s ci-dessous, avec leur correspondance en librairie WiringPi :<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=\u00a0\u00bb1_2,1_2&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb custom_padding=\u00a0\u00bb0px||0px||false|false\u00a0\u00bb][et_pb_column type=\u00a0\u00bb1_2&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_text _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb]<\/p>\n<ul type=\"disc\" style=\"margin-left: .375in; direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in;\">\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 12.75pt;\">Enable 1 : SCLK 11 du GPIO, <strong>WiringPi 14<\/strong><\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 12.75pt;\">Input 1 : MISO 9 du GPIO,\u00a0<span><strong>WiringPi 13<\/strong><\/span><\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 12.75pt;\">Output 1 : moteur B\u00a0(c\u00e2ble noir)<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 12.75pt;\">Ground : masse du Raspberry<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 12.75pt;\">Ground : masse du Raspberry<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 12.75pt;\">Output 2 : moteur B (c\u00e2ble rouge)<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 12.75pt;\">Input 2 : MOSI 10 du GPIO,\u00a0<span><strong>WiringPi 12<\/strong><\/span><\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 12.75pt;\">Vs : alimentation en 5 Volt\u00a0de la batterie externe<\/span><\/li>\n<\/ul>\n<p>[\/et_pb_text][\/et_pb_column][et_pb_column type=\u00a0\u00bb1_2&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_text _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb]<\/p>\n<ul>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 12.75pt;\">Vss : alimentation en 5 Volt du Raspberry Pi<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 12.75pt;\">Input 4 : MOSI 20 du GPIO,\u00a0<span><strong>WiringPi 28<\/strong><\/span><\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 12.75pt;\">Output 4 : moteur A (c\u00e2ble noir)<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 12.75pt;\">Ground : masse du Raspberry<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 12.75pt;\">Ground : masse du Raspberry<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 12.75pt;\">Output 3 : moteur A (c\u00e2ble rouge)<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 12.75pt;\">Input 3 : 16 du GPIO,\u00a0<span><strong>WiringPi 27<\/strong><\/span><\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 12.75pt;\">Enable 2 : SCLK 21 du GPIO,\u00a0<span><strong>WiringPi 29<\/strong><\/span><\/span><\/li>\n<\/ul>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb custom_padding=\u00a0\u00bb0px||||false|false\u00a0\u00bb][et_pb_column type=\u00a0\u00bb4_4&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_text _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb]<\/p>\n<h2>Branchement du support amovible Pan Tilt<\/h2>\n<p class=\"font_7\">Le support Pan\/Tilt est un support amovible que nous utiliserons pour faire pivoter le module thermique et ainsi conna\u00eetre la chaleur \u00e0 diff\u00e9rents endroits. Le support se compose en 2 parties :<\/p>\n<ul type=\"disc\" style=\"margin-left: .375in; direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in;\">\n<li>en bas : le Pan qui pivote de gauche \u00e0 droite, branch\u00e9 sur la pin 5 du GPIO,\u00a0<span><strong>WiringPi 21<\/strong><\/span><\/li>\n<li>en haut : le Tilt qui pivote de haut en bas, branch\u00e9 sur la pin 6 du GPIO,\u00a0<span><strong>WiringPi 22<\/strong><\/span><\/li>\n<\/ul>\n<p>Le plan de cabl\u00e2ge du support Pan\/Tilt est celui ci-dessous. Le + 5 Volt provient de la batterie externe.<\/p>\n<p>[\/et_pb_text][et_pb_image src=\u00a0\u00bbhttps:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-content\/uploads\/2021\/05\/cablage-pan-tilt.png\u00a0\u00bb alt=\u00a0\u00bbPlan de c\u00e2blage du support Pan Tilt\u00a0\u00bb title_text=\u00a0\u00bbPlan de c\u00e2blage du support Pan Tilt\u00a0\u00bb show_in_lightbox=\u00a0\u00bbon\u00a0\u00bb align=\u00a0\u00bbcenter\u00a0\u00bb _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb width=\u00a0\u00bb60%\u00a0\u00bb box_shadow_style=\u00a0\u00bbpreset1&Prime;][\/et_pb_image][et_pb_text _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb]<\/p>\n<h2>Conception de l&rsquo;interface Java Swing avec Joystick virtuel<\/h2>\n<p>Pour le codage, nous avons cr\u00e9\u00e9 un projet \u00ab\u00a0RaspiThermoCam\u00a0\u00bb sur Eclipse. Nous travaillons dans le package par d\u00e9faut. Ensuite, nous cr\u00e9ons 5 classes selon la m\u00e9thode MVC et nous ajoutons les librairies Pi4J au projet. De plus, nous prenons soin de compiler le code en version Java 11, comme expliqu\u00e9 sur la page D\u00e9veloppement sur Eclipse pour Raspberry (<a href=\"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/developpement-java-eclipse\/\">voir ici<\/a>). Les 5 classes sont les suivantes :<\/p>\n<ul type=\"disc\" style=\"margin-left: .375in; direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in;\">\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">AppJoystick.java<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">Controller.java<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">Joystick.java<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">Robot.java<\/span><\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\"><span style=\"font-family: Calibri; font-size: 11.0pt;\">View.java<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: Calibri; font-size: 11.0pt;\"><\/span>Le projet est t\u00e9l\u00e9chargeable avec le lien ci-dessous. L&rsquo;archive contient les fichiers binaires, les fichiers sources au format Java et les donn\u00e9es de l&rsquo;application.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=\u00a0\u00bb1_4,1_2,1_4&Prime; use_custom_gutter=\u00a0\u00bbon\u00a0\u00bb gutter_width=\u00a0\u00bb4&Prime; make_equal=\u00a0\u00bbon\u00a0\u00bb _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb custom_margin=\u00a0\u00bb5px||5px||false|false\u00a0\u00bb custom_padding=\u00a0\u00bb5px||5px||false|false\u00a0\u00bb border_width_all=\u00a0\u00bb2px\u00a0\u00bb box_shadow_style=\u00a0\u00bbpreset1&Prime;][et_pb_column type=\u00a0\u00bb1_4&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_image src=\u00a0\u00bbhttps:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-content\/uploads\/2021\/02\/logo-zip.jpg\u00a0\u00bb title_text=\u00a0\u00bblogo_zip\u00a0\u00bb align=\u00a0\u00bbcenter\u00a0\u00bb _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb module_alignment=\u00a0\u00bbcenter\u00a0\u00bb max_height=\u00a0\u00bb81px\u00a0\u00bb custom_margin=\u00a0\u00bb0px||0px||false|false\u00a0\u00bb custom_padding=\u00a0\u00bb0px||0px||false|false\u00a0\u00bb][\/et_pb_image][\/et_pb_column][et_pb_column type=\u00a0\u00bb1_2&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_blurb title=\u00a0\u00bbProjet Java &#8211; Raspi Thermo Cam\u00a0\u00bb use_icon=\u00a0\u00bbon\u00a0\u00bb font_icon=\u00a0\u00bb%%272%%\u00a0\u00bb icon_placement=\u00a0\u00bbleft\u00a0\u00bb use_icon_font_size=\u00a0\u00bbon\u00a0\u00bb icon_font_size=\u00a0\u00bb48px\u00a0\u00bb _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb header_font=\u00a0\u00bbOpen Sans||||||||\u00a0\u00bb body_font=\u00a0\u00bbOpen Sans||||||||\u00a0\u00bb body_text_align=\u00a0\u00bbleft\u00a0\u00bb custom_padding=\u00a0\u00bb15px||15px||false|false\u00a0\u00bb]<\/p>\n<p>17 files\u00a0 \u00a0 \u00a0144 KB\u00a0 \u00a0 \u00a006\/05\/2021<\/p>\n<p>[\/et_pb_blurb][\/et_pb_column][et_pb_column type=\u00a0\u00bb1_4&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_button button_url=\u00a0\u00bbhttps:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-content\/uploads\/2021\/05\/RaspiThermoCam.zip\u00a0\u00bb button_text=\u00a0\u00bbDOWNLOAD\u00a0\u00bb button_alignment=\u00a0\u00bbleft\u00a0\u00bb _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb custom_button=\u00a0\u00bbon\u00a0\u00bb button_text_color=\u00a0\u00bb#FFFFFF\u00a0\u00bb button_bg_color=\u00a0\u00bb#ff8080&Prime; button_border_color=\u00a0\u00bb#FFFFFF\u00a0\u00bb button_font=\u00a0\u00bbOpen Sans||||||||\u00a0\u00bb button_icon=\u00a0\u00bb%%209%%\u00a0\u00bb button_icon_color=\u00a0\u00bb#FFFFFF\u00a0\u00bb position_origin_a=\u00a0\u00bbcenter_left\u00a0\u00bb custom_margin=\u00a0\u00bb15px||15px||false|false\u00a0\u00bb][\/et_pb_button][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_column type=\u00a0\u00bb4_4&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_text _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb]<\/p>\n<p>Nous commen\u00e7ons le d\u00e9veloppement par la cr\u00e9ation de l&rsquo;interface :\u00a0<\/p>\n<p>[\/et_pb_text][et_pb_image src=\u00a0\u00bbhttps:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-content\/uploads\/2021\/05\/interface-pilotage-robot.png\u00a0\u00bb alt=\u00a0\u00bbInterface Java Swing pour le pilotage du robot\u00a0\u00bb title_text=\u00a0\u00bbInterface Java Swing pour le pilotage du robot\u00a0\u00bb show_in_lightbox=\u00a0\u00bbon\u00a0\u00bb align=\u00a0\u00bbcenter\u00a0\u00bb _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb width=\u00a0\u00bb50%\u00a0\u00bb box_shadow_style=\u00a0\u00bbpreset1&Prime;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row use_custom_gutter=\u00a0\u00bbon\u00a0\u00bb gutter_width=\u00a0\u00bb1&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb custom_margin=\u00a0\u00bb5px||5px||false|false\u00a0\u00bb custom_padding=\u00a0\u00bb0px||0px||false|false\u00a0\u00bb border_width_all=\u00a0\u00bb2px\u00a0\u00bb box_shadow_style=\u00a0\u00bbpreset1&Prime;][et_pb_column type=\u00a0\u00bb4_4&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_blurb title=\u00a0\u00bbJava\u00a0\u00bb use_icon=\u00a0\u00bbon\u00a0\u00bb font_icon=\u00a0\u00bb%%209%%\u00a0\u00bb icon_placement=\u00a0\u00bbleft\u00a0\u00bb use_icon_font_size=\u00a0\u00bbon\u00a0\u00bb icon_font_size=\u00a0\u00bb20px\u00a0\u00bb _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb header_text_color=\u00a0\u00bb#FFFFFF\u00a0\u00bb header_font_size=\u00a0\u00bb16px\u00a0\u00bb header_line_height=\u00a0\u00bb1.3em\u00a0\u00bb background_color=\u00a0\u00bb#000000&Prime; width=\u00a0\u00bb100px\u00a0\u00bb max_width=\u00a0\u00bb100px\u00a0\u00bb custom_margin=\u00a0\u00bb||-42px||false|false\u00a0\u00bb custom_padding=\u00a0\u00bb10px|15px|2px|15px|false|false\u00a0\u00bb][\/et_pb_blurb][et_pb_text _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb text_text_color=\u00a0\u00bb#000000&Prime; background_color=\u00a0\u00bb#eff0f1&Prime; custom_margin=\u00a0\u00bb|||110px|false|false\u00a0\u00bb custom_padding=\u00a0\u00bb1%|1%|1%|1%|false|false\u00a0\u00bb border_width_top=\u00a0\u00bb10px\u00a0\u00bb border_color_top=\u00a0\u00bb#ff8080&Prime;][crayon lang=\u00a0\u00bbjava\u00a0\u00bb theme=\u00a0\u00bbclassic\u00a0\u00bb title=\u00a0\u00bbView.java\u00a0\u00bb]<\/p>\n<p>\/\/ Anthony LE PORS &#8211; Pilotage d&rsquo;un Robot Raspi Thermo Cam &#8211; Avril 2021<br \/>\n\/\/ VIEW : Interface graphique<\/p>\n<p>import javax.swing.*;<br \/>\nimport java.awt.*;<br \/>\nimport java.awt.event.*;<\/p>\n<p>public class View {<\/p>\n<p>\t\/\/ View utilise Swing pour afficher interface utilisateur\t<\/p>\n<p>\t\/\/ d\u00e9finit les attributs : les composants de l&rsquo;inteface<br \/>\n\tprivate JFrame fenetre; \/\/ fenetre<br \/>\n\tprivate JPanel contenu; \/\/ panneau<\/p>\n<p>\tprivate int hauteurFenetre, largeurFenetre;<br \/>\n\tprivate int espacement, espacementHorizontal;<\/p>\n<p>\tprivate JLabel labelTitre;<br \/>\n\tprivate JLabel labelDirection;<br \/>\n\tprivate JLabel labelRotation;<br \/>\n\tprivate JButton btnParabilis;<br \/>\n\tprivate JButton btnGetThermal;<\/p>\n<p>\tprivate JSeparator separateur;<\/p>\n<p>\tprivate Joystick joystickDirection;<\/p>\n<p>\tprivate JSlider sliderVertical;<br \/>\n\tprivate JSlider sliderHorizontal;<\/p>\n<p>\t\/\/ Instanciation : constructeur de la fenetre<br \/>\n\tpublic View(String title) {<br \/>\n\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ PARAMETRAGE DE LA FENETRE \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\tfenetre = new JFrame(title);<br \/>\n        fenetre.setIconImage(new ImageIcon(\u00ab\u00a0data\/logo.png\u00a0\u00bb).getImage());<br \/>\n        fenetre.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); \/\/ ne fait rien a la fermeture<br \/>\n        fenetre.setSize(350,300); \/\/ taille de la fenetre<br \/>\n\t\tfenetre.setMinimumSize(new Dimension(350,300));<\/p>\n<p>\t\tfenetre.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width &#8211; 350, Toolkit.getDefaultToolkit().getScreenSize().height &#8211; 300);<\/p>\n<p>        fenetre.setVisible(true);<br \/>\n        fenetre.getContentPane().setLayout(null);<\/p>\n<p>\t\tlargeurFenetre = fenetre.getContentPane().getBounds().width;<br \/>\n        hauteurFenetre = fenetre.getContentPane().getBounds().height;<\/p>\n<p>\t\tespacement = hauteurFenetre\/35;<br \/>\n\t\tespacementHorizontal = largeurFenetre\/50;<\/p>\n<p>\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ PARAMETRAGE DU PANNEAU \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\tcontenu = new JPanel();<br \/>\n        contenu.setBounds(0, 0, largeurFenetre, hauteurFenetre);<br \/>\n        fenetre.getContentPane().add(contenu);<br \/>\n        contenu.setBackground(new Color(203,224,233)); \/\/ bleu<br \/>\n        contenu.setLayout(null);<br \/>\n        contenu.setVisible(true);<\/p>\n<p>\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ AJOUT DES ELEMENTS AU PANNEAU \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<\/p>\n<p>\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ LABEL TITRE \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\tlabelTitre = new JLabel(\u00ab\u00a0Pilotage du Raspi Thermo Cam\u00a0\u00bb);<br \/>\n        labelTitre.setBounds(0,5,largeurFenetre,hauteurFenetre\/10);<br \/>\n        labelTitre.setHorizontalAlignment(JLabel.CENTER);<br \/>\n        labelTitre.setVerticalAlignment(JLabel.CENTER);<br \/>\n        contenu.add(labelTitre);<\/p>\n<p>\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ LABEL DIRECTION \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\tlabelDirection = new JLabel(\u00ab\u00a0Direction du robot\u00a0\u00bb);<br \/>\n\t\tlabelDirection.setBounds(0,hauteurFenetre\/12 + espacement,largeurFenetre*2\/3,30);<br \/>\n        labelDirection.setHorizontalAlignment(JLabel.CENTER);<br \/>\n        labelDirection.setVerticalAlignment(JLabel.CENTER);<br \/>\n        contenu.add(labelDirection);<\/p>\n<p>\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ LABEL ROTATION \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\tlabelRotation = new JLabel(\u00ab\u00a0Rotation de la cam\u00e9ra\u00a0\u00bb);<br \/>\n\t\tlabelRotation.setBounds(0,hauteurFenetre\/10 + espacement + hauteurFenetre\/3 + espacement*3,largeurFenetre*2\/3,30);<br \/>\n        labelRotation.setHorizontalAlignment(JLabel.CENTER);<br \/>\n        labelRotation.setVerticalAlignment(JLabel.CENTER);<br \/>\n        contenu.add(labelRotation);<\/p>\n<p>\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ SEPARATEUR \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\tseparateur = new JSeparator(JSeparator.VERTICAL);<br \/>\n\t\tseparateur.setBounds(largeurFenetre*2\/3 + 2, 5 + hauteurFenetre\/10 + 5, 2, hauteurFenetre &#8211; (5 + hauteurFenetre\/10 + 5 + espacement));<br \/>\n\t\tcontenu.add(separateur);\t<\/p>\n<p>\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ PANEL FOND JOYSTICK DIRECTION \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\tjoystickDirection = new Joystick((largeurFenetre*2\/3)\/2 &#8211; (hauteurFenetre\/3)\/2, hauteurFenetre\/12 + espacement + 30, hauteurFenetre\/3);<br \/>\n        contenu.add(joystickDirection.getFondJoystick());<\/p>\n<p>\t\tjoystickDirection.getFondJoystick().setVisible(false);<br \/>\n\t\tjoystickDirection.getFondJoystick().setVisible(true);<\/p>\n<p>\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ JSLIDER ROTATION HORIZONTALE  \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\tsliderHorizontal = new JSlider(-50, 90, 0);<br \/>\n\t\tsliderHorizontal.setBounds(espacementHorizontal, hauteurFenetre\/10 + espacement*6 + hauteurFenetre\/3 + 10 + hauteurFenetre\/6 -25, largeurFenetre*10\/21, 50);<br \/>\n\t\tsliderHorizontal.setPaintTrack(true);<br \/>\n\t\tsliderHorizontal.setPaintTicks(true);<br \/>\n\t\tsliderHorizontal.setPaintLabels(true);<br \/>\n\t\tsliderHorizontal.setMajorTickSpacing(25);<br \/>\n\t\tsliderHorizontal.setMinorTickSpacing(5);<br \/>\n\t\tcontenu.add(sliderHorizontal);<br \/>\n\t\tsliderHorizontal.setVisible(false);<br \/>\n\t\tsliderHorizontal.setVisible(true);<\/p>\n<p>\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ JSLIDER ROTATION VERTICALE  \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\tsliderVertical = new JSlider(JSlider.VERTICAL,-30, 80, 0);<br \/>\n\t\tsliderVertical.setBounds(largeurFenetre*10\/21 + espacementHorizontal*2, hauteurFenetre\/10 + espacement*6 + hauteurFenetre\/3 + 10, 50, hauteurFenetre\/3);<br \/>\n\t\tsliderVertical.setPaintTrack(true);<br \/>\n\t\tsliderVertical.setPaintTicks(true);<br \/>\n\t\tsliderVertical.setPaintLabels(true);<br \/>\n\t\tsliderVertical.setMajorTickSpacing(30);<br \/>\n\t\tsliderVertical.setMinorTickSpacing(5);<br \/>\n\t\tcontenu.add(sliderVertical);<br \/>\n\t\tsliderVertical.setVisible(false);<br \/>\n\t\tsliderVertical.setVisible(true);<\/p>\n<p>\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ BOUTON PARABILIS THERMAL \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\tbtnParabilis = new JButton(\u00ab\u00a0ParabilisThermal\u00a0\u00bb);<br \/>\n\t\tbtnParabilis.setBounds(largeurFenetre *2\/3 + espacementHorizontal,hauteurFenetre*1\/2 &#8211; 45, largeurFenetre*1\/3 &#8211; 2*espacementHorizontal, 30);<br \/>\n\t\tcontenu.add(btnParabilis);<br \/>\n\t\tbtnParabilis.setVisible(false);<br \/>\n\t\tbtnParabilis.setVisible(true);<\/p>\n<p>\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ BOUTON GET THERMAL \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n\t\tbtnGetThermal = new JButton(\u00ab\u00a0GetThermal\u00a0\u00bb);<br \/>\n\t\tbtnGetThermal.setBounds(largeurFenetre *2\/3 + espacementHorizontal,hauteurFenetre*1\/2 + 15, largeurFenetre*1\/3 &#8211; 2*espacementHorizontal, 30);<br \/>\n\t\tcontenu.add(btnGetThermal);<br \/>\n\t\tbtnGetThermal.setVisible(false);<br \/>\n\t\tbtnGetThermal.setVisible(true);<\/p>\n<p>\t\tfenetre.validate();<\/p>\n<p>\t\t\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ REDIMENSIONNEMENT DE LA FENETRE \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n        fenetre.addComponentListener(new ComponentAdapter() {<br \/>\n            public void componentResized(ComponentEvent e) {<br \/>\n                largeurFenetre = fenetre.getContentPane().getBounds().width;<br \/>\n\t\t\t\thauteurFenetre = fenetre.getContentPane().getBounds().height;<br \/>\n\t\t\t\tespacement = hauteurFenetre\/35;<br \/>\n\t\t\t\tespacementHorizontal = largeurFenetre\/50;<\/p>\n<p>\t\t\t\tcontenu.setBounds(0, 0, largeurFenetre, hauteurFenetre);<br \/>\n\t\t\t\tlabelTitre.setBounds(0,5,largeurFenetre,hauteurFenetre\/10);<br \/>\n\t\t\t\tlabelDirection.setBounds(0,hauteurFenetre\/12 + espacement,largeurFenetre*2\/3,30);<br \/>\n\t\t\t\tlabelRotation.setBounds(0,hauteurFenetre\/10 + espacement + hauteurFenetre\/3 + espacement*3,largeurFenetre*2\/3,30);<br \/>\n\t\t\t\tseparateur.setBounds(largeurFenetre*2\/3 + 2, 5 + hauteurFenetre\/10 + 5, 2, hauteurFenetre &#8211; (5 + hauteurFenetre\/10 + 5 + espacement));<br \/>\n\t\t\t\tbtnParabilis.setBounds(largeurFenetre *2\/3 + espacementHorizontal,hauteurFenetre*1\/2 &#8211; 45, largeurFenetre*1\/3 &#8211; 2*espacementHorizontal, 30);<br \/>\n\t\t\t\tbtnGetThermal.setBounds(largeurFenetre *2\/3 + espacementHorizontal,hauteurFenetre*1\/2 + 15, largeurFenetre*1\/3 &#8211; 2*espacementHorizontal, 30);<\/p>\n<p>\t\t\t\tjoystickDirection.redimensionnement((largeurFenetre*2\/3)\/2 &#8211; (hauteurFenetre\/3)\/2, hauteurFenetre\/12 + espacement + 30, hauteurFenetre\/3);<\/p>\n<p>\t\t\t\tsliderHorizontal.setBounds(espacementHorizontal, hauteurFenetre\/10 + espacement*6 + hauteurFenetre\/3 + 10 + hauteurFenetre\/6 -25, largeurFenetre*10\/21, 50);<br \/>\n\t\t\t\tsliderVertical.setBounds(largeurFenetre*10\/21 + espacementHorizontal*2, hauteurFenetre\/10 + espacement*6 + hauteurFenetre\/3 + 10, 50, hauteurFenetre\/3);<br \/>\n            }<br \/>\n        });<br \/>\n\t}<\/p>\n<p>\t\/\/ methodes<br \/>\n\t\/\/ on g\u00e9n\u00e8re les getters et les setters pour chaque \u00e9l\u00e9ment<br \/>\n\t\/\/ getter permet de recuperer un element private avec une methode publique\t<\/p>\n<p>\tpublic Joystick getJoystickDirection() {<br \/>\n\t\treturn joystickDirection;<br \/>\n\t}<\/p>\n<p>\tpublic JFrame getFenetre() {<br \/>\n\t\treturn fenetre;<br \/>\n\t}<\/p>\n<p>\tpublic JSlider getSliderVertical() {<br \/>\n\t\treturn sliderVertical;<br \/>\n\t}<\/p>\n<p>\tpublic JSlider getSliderHorizontal() {<br \/>\n\t\treturn sliderHorizontal;<br \/>\n\t}<\/p>\n<p>\tpublic JButton getBtnParabilis() {<br \/>\n\t\treturn btnParabilis;<br \/>\n\t}<\/p>\n<p>\tpublic JButton getBtnGetThermal() {<br \/>\n\t\treturn btnGetThermal;<br \/>\n\t}<br \/>\n}<\/p>\n<p>[\/crayon][\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row use_custom_gutter=\u00a0\u00bbon\u00a0\u00bb gutter_width=\u00a0\u00bb1&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb custom_margin=\u00a0\u00bb5px||5px||false|false\u00a0\u00bb custom_padding=\u00a0\u00bb0px||0px||false|false\u00a0\u00bb border_width_all=\u00a0\u00bb2px\u00a0\u00bb box_shadow_style=\u00a0\u00bbpreset1&Prime;][et_pb_column type=\u00a0\u00bb4_4&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_blurb title=\u00a0\u00bbJava\u00a0\u00bb use_icon=\u00a0\u00bbon\u00a0\u00bb font_icon=\u00a0\u00bb%%209%%\u00a0\u00bb icon_placement=\u00a0\u00bbleft\u00a0\u00bb use_icon_font_size=\u00a0\u00bbon\u00a0\u00bb icon_font_size=\u00a0\u00bb20px\u00a0\u00bb _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb header_text_color=\u00a0\u00bb#FFFFFF\u00a0\u00bb header_font_size=\u00a0\u00bb16px\u00a0\u00bb header_line_height=\u00a0\u00bb1.3em\u00a0\u00bb background_color=\u00a0\u00bb#000000&Prime; width=\u00a0\u00bb100px\u00a0\u00bb max_width=\u00a0\u00bb100px\u00a0\u00bb custom_margin=\u00a0\u00bb||-42px||false|false\u00a0\u00bb custom_padding=\u00a0\u00bb10px|15px|2px|15px|false|false\u00a0\u00bb][\/et_pb_blurb][et_pb_text _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb text_text_color=\u00a0\u00bb#000000&Prime; background_color=\u00a0\u00bb#eff0f1&Prime; custom_margin=\u00a0\u00bb|||110px|false|false\u00a0\u00bb custom_padding=\u00a0\u00bb1%|1%|1%|1%|false|false\u00a0\u00bb border_width_top=\u00a0\u00bb10px\u00a0\u00bb border_color_top=\u00a0\u00bb#ff8080&Prime;][crayon lang=\u00a0\u00bbjava\u00a0\u00bb theme=\u00a0\u00bbclassic\u00a0\u00bb  title=\u00a0\u00bbJoystick.java\u00a0\u00bb]<\/p>\n<p>\/\/ Anthony LE PORS &#8211; Pilotage d&rsquo;un Robot Raspi Thermo Cam &#8211; Avril 2021<br \/>\n\/\/ Classe joystick : JPanel pour afficher un joystick<\/p>\n<p>import javax.swing.*;<br \/>\nimport java.awt.*;<br \/>\nimport java.awt.event.*;<\/p>\n<p>public class Joystick {<br \/>\n    \/\/ attributs<br \/>\n    private JPanel fondJoystick;<br \/>\n    private JLabel labelJoystick;<br \/>\n\tprivate ImageIcon imageJoystick;<br \/>\n\tprivate ImageIcon imageJoystickScaled;<\/p>\n<p>    private int tailleFond, tailleJoystick, valeurMax;<br \/>\n    private int[] positionCurseur = new int[2];<br \/>\n    private boolean depasseGauche = false;<br \/>\n    private boolean depasseDroite = false;<br \/>\n    private boolean depasseBas = false;<br \/>\n    private boolean depasseHaut= false;<\/p>\n<p>    private int[] pointMilieu = new int[2];<br \/>\n    private int[] puissance = new int[2];<\/p>\n<p>    \/\/ constructeur<br \/>\n    Joystick (int x, int y, int cote){<br \/>\n        this.tailleFond = cote;<br \/>\n        this.tailleJoystick = cote\/2;<br \/>\n        creationJoystick(x, y, tailleFond);<br \/>\n    }<\/p>\n<p>    \/\/ methodes<br \/>\n    public void creationJoystick(int x, int y, int cote){<br \/>\n        \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ PANEL FOND JOYSTICK \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n        fondJoystick = new JPanel(); \/\/ creation du plateau<br \/>\n        fondJoystick.setLayout(null);<br \/>\n        fondJoystick.setBounds(x, y, cote, cote);<br \/>\n        fondJoystick.setBackground(new Color(255,255,255)); \/\/ blanc<br \/>\n        fondJoystick.setVisible(false);<br \/>\n        fondJoystick.setVisible(true);<\/p>\n<p>        this.tailleFond = fondJoystick.getBounds().width;<br \/>\n        this.tailleJoystick = tailleFond*2\/5;<br \/>\n        this.valeurMax = tailleFond\/2 &#8211; tailleJoystick\/2;<\/p>\n<p>        \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ CREATION DES IMAGES \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n        imageJoystick = new ImageIcon(\u00ab\u00a0data\/joystick.png\u00a0\u00bb);<br \/>\n        imageJoystickScaled = new ImageIcon(imageJoystick.getImage().getScaledInstance(tailleJoystick, tailleJoystick, Image.SCALE_SMOOTH));<\/p>\n<p>        \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ LABEL JOYSTICK \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n        labelJoystick = new JLabel(imageJoystickScaled, JLabel.CENTER);<br \/>\n        labelJoystick.setBounds(tailleFond\/2 &#8211; tailleJoystick\/2, tailleFond\/2 &#8211; tailleJoystick\/2, tailleJoystick, tailleJoystick);<br \/>\n        fondJoystick.add(labelJoystick);<br \/>\n        labelJoystick.setVisible(false);<br \/>\n        labelJoystick.setVisible(true);<\/p>\n<p>        \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ DRAG DU JOYSTICK \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\n        dragJoystick();<br \/>\n    }<\/p>\n<p>    public void redimensionnement(int x, int y, int cote){<br \/>\n        fondJoystick.setBounds(x, y, cote, cote);<br \/>\n        fondJoystick.remove(labelJoystick);<\/p>\n<p>        this.tailleFond = fondJoystick.getBounds().width;<br \/>\n        this.tailleJoystick = tailleFond*2\/5;<br \/>\n        this.valeurMax = tailleFond\/2 &#8211; tailleJoystick\/2;<\/p>\n<p>        imageJoystickScaled = new ImageIcon(imageJoystick.getImage().getScaledInstance(tailleJoystick, tailleJoystick, Image.SCALE_SMOOTH));<br \/>\n        labelJoystick = new JLabel(imageJoystickScaled, JLabel.CENTER);<br \/>\n        labelJoystick.setBounds(tailleFond\/2 &#8211; tailleJoystick\/2, tailleFond\/2 &#8211; tailleJoystick\/2, tailleJoystick, tailleJoystick);<br \/>\n        fondJoystick.add(labelJoystick);<br \/>\n        dragJoystick();<br \/>\n        labelJoystick.setVisible(false);<br \/>\n        labelJoystick.setVisible(true);<br \/>\n    }<\/p>\n<p>    public void dragJoystick(){<br \/>\n        labelJoystick.addMouseListener(new MouseAdapter(){<br \/>\n            @Override<br \/>\n            public void mouseReleased(MouseEvent e){<br \/>\n                labelJoystick.setBounds(tailleFond\/2 &#8211; tailleJoystick\/2, tailleFond\/2 &#8211; tailleJoystick\/2, tailleJoystick, tailleJoystick);<\/p>\n<p>                pointMilieu[0] = tailleFond\/2 &#8211; (labelJoystick.getX() + tailleJoystick\/2);<br \/>\n                pointMilieu[1] = tailleFond\/2 &#8211; (labelJoystick.getY() + tailleJoystick\/2);      <\/p>\n<p>                System.out.println(\u00ab\u00a0Position Joystick : \u00a0\u00bb + pointMilieu[0] + \u00a0\u00bb ; \u00a0\u00bb + pointMilieu[1]);<\/p>\n<p>                puissance[0] = 0;<br \/>\n                puissance[1] = 0;<br \/>\n            }<br \/>\n        });<\/p>\n<p>        labelJoystick.addMouseMotionListener(new MouseAdapter(){<br \/>\n            @Override<br \/>\n            public void mouseDragged(MouseEvent e){<br \/>\n                positionCurseur[0] = e.getXOnScreen() &#8211; fondJoystick.getLocationOnScreen().x;<br \/>\n                positionCurseur[1] = e.getYOnScreen() &#8211; fondJoystick.getLocationOnScreen().y;<\/p>\n<p>                pointMilieu[0] = tailleFond\/2 &#8211; (labelJoystick.getX() + tailleJoystick\/2);<br \/>\n                pointMilieu[1] = tailleFond\/2 &#8211; (labelJoystick.getY() + tailleJoystick\/2);    <\/p>\n<p>                for (int i = 0; i < 2; i++) {\n                \tpuissance[i] = pointMilieu[i] * 100\/valeurMax; \/\/ valeur entre -100 et 100\n                \t                \t\n                \tif (puissance[i] < 0) {\n                \t\tpuissance[i] = puissance[i]\/2 - 50; \/\/ valeur dans [-100;-50]\n                \t}\n                \t\n                \telse if (puissance[i] > 0) {<br \/>\n                \t\tpuissance[i] = puissance[i]\/2 + 50; \/\/ valeur dans [50;100]<br \/>\n                \t}<br \/>\n                }<\/p>\n<p>                System.out.println(\u00ab\u00a0Curseur X : \u00a0\u00bb + positionCurseur[0]);<br \/>\n                System.out.println(\u00ab\u00a0Curseur Y : \u00a0\u00bb + positionCurseur[1]);<br \/>\n                System.out.println(\u00ab\u00a0Position Joystick : \u00a0\u00bb + pointMilieu[0] + \u00a0\u00bb ; \u00a0\u00bb + pointMilieu[1]);<\/p>\n<p>                System.out.println(\u00ab\u00a0Puissance Joystick : \u00a0\u00bb + puissance[0] + \u00a0\u00bb ; \u00a0\u00bb + puissance[1]);<\/p>\n<p>                depasseGauche = false;<br \/>\n                depasseDroite = false;<br \/>\n                depasseHaut = false;<br \/>\n                depasseBas = false;<\/p>\n<p>                if (positionCurseur[0] < tailleJoystick\/2 ) depasseGauche = true;\n                if (positionCurseur[0] > tailleFond &#8211; tailleJoystick\/2 ) depasseDroite = true;<br \/>\n                if (positionCurseur[1] < tailleJoystick\/2 ) depasseHaut = true;\n                if (positionCurseur[1] > tailleFond &#8211; tailleJoystick\/2 ) depasseBas = true;<\/p>\n<p>                \/\/ position par defaut<br \/>\n                labelJoystick.setBounds(positionCurseur[0] &#8211; tailleJoystick\/2, positionCurseur[1] &#8211; tailleJoystick\/2, tailleJoystick, tailleJoystick);<\/p>\n<p>                \/\/ blocage a gauche HAUT et BAS<br \/>\n                if (depasseGauche){<br \/>\n                    if (depasseHaut) labelJoystick.setBounds(0, 0, tailleJoystick, tailleJoystick);<br \/>\n                    else if (depasseBas) labelJoystick.setBounds(0, tailleFond &#8211; tailleJoystick, tailleJoystick, tailleJoystick);<br \/>\n                    else labelJoystick.setBounds(0, positionCurseur[1] &#8211; tailleJoystick\/2, tailleJoystick, tailleJoystick);<br \/>\n                }<\/p>\n<p>                \/\/ blocage a droite HAUT et BAS<br \/>\n                if (depasseDroite){<br \/>\n                    if (depasseHaut) labelJoystick.setBounds(tailleFond &#8211; tailleJoystick, 0, tailleJoystick, tailleJoystick);<br \/>\n                    else if (depasseBas) labelJoystick.setBounds(tailleFond &#8211; tailleJoystick, tailleFond &#8211; tailleJoystick, tailleJoystick, tailleJoystick);<br \/>\n                    else labelJoystick.setBounds(tailleFond &#8211; tailleJoystick, positionCurseur[1] &#8211; tailleJoystick\/2, tailleJoystick, tailleJoystick);<br \/>\n                }<\/p>\n<p>                \/\/ blocage en haut GAUCHE et DROITE<br \/>\n                if (depasseHaut){<br \/>\n                    if (depasseGauche) labelJoystick.setBounds(0, 0, tailleJoystick, tailleJoystick);<br \/>\n                    else if (depasseDroite) labelJoystick.setBounds(tailleFond &#8211; tailleJoystick, 0, tailleJoystick, tailleJoystick);<br \/>\n                    else labelJoystick.setBounds(positionCurseur[0] &#8211; tailleJoystick\/2, 0, tailleJoystick, tailleJoystick);<br \/>\n                }<\/p>\n<p>                \/\/ blocage en bas GAUCHE et DROITE<br \/>\n                if (depasseBas){<br \/>\n                    if (depasseGauche) labelJoystick.setBounds(0, tailleFond &#8211; tailleJoystick, tailleJoystick, tailleJoystick);<br \/>\n                    else if (depasseDroite) labelJoystick.setBounds(tailleFond &#8211; tailleJoystick, tailleFond &#8211; tailleJoystick, tailleJoystick, tailleJoystick);<br \/>\n                    else labelJoystick.setBounds(positionCurseur[0] &#8211; tailleJoystick\/2, tailleFond &#8211; tailleJoystick, tailleJoystick, tailleJoystick);<br \/>\n                }<br \/>\n            }<br \/>\n        });<br \/>\n    }<\/p>\n<p>    \/\/ getters et setters<br \/>\n    public JPanel getFondJoystick(){<br \/>\n        return this.fondJoystick;<br \/>\n    }<\/p>\n<p>    public JLabel getLabelJoystick() {<br \/>\n\t\treturn labelJoystick;<br \/>\n\t}<\/p>\n<p>\tpublic int getTailleFond(){<br \/>\n        return this.tailleFond;<br \/>\n    }<\/p>\n<p>\tpublic int getTailleJoystick(){<br \/>\n        return this.tailleJoystick;<br \/>\n    }<\/p>\n<p>\tpublic int[] getPointMilieu() {<br \/>\n\t\treturn pointMilieu;<br \/>\n\t}<\/p>\n<p>\tpublic int[] getPuissance() {<br \/>\n\t\treturn puissance;<br \/>\n\t}<\/p>\n<p>}<\/p>\n<p>[\/crayon][\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_column type=\u00a0\u00bb4_4&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_text _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb]<\/p>\n<p>Ensuite, nous passons au code de la classe Robot. Les missions principales de cette classe sont la cr\u00e9ation des fonctions de d\u00e9placement des moteurs et de rotation du support amovible.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row use_custom_gutter=\u00a0\u00bbon\u00a0\u00bb gutter_width=\u00a0\u00bb1&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb custom_margin=\u00a0\u00bb5px||5px||false|false\u00a0\u00bb custom_padding=\u00a0\u00bb0px||0px||false|false\u00a0\u00bb border_width_all=\u00a0\u00bb2px\u00a0\u00bb box_shadow_style=\u00a0\u00bbpreset1&Prime;][et_pb_column type=\u00a0\u00bb4_4&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_blurb title=\u00a0\u00bbJava\u00a0\u00bb use_icon=\u00a0\u00bbon\u00a0\u00bb font_icon=\u00a0\u00bb%%209%%\u00a0\u00bb icon_placement=\u00a0\u00bbleft\u00a0\u00bb use_icon_font_size=\u00a0\u00bbon\u00a0\u00bb icon_font_size=\u00a0\u00bb20px\u00a0\u00bb _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb header_text_color=\u00a0\u00bb#FFFFFF\u00a0\u00bb header_font_size=\u00a0\u00bb16px\u00a0\u00bb header_line_height=\u00a0\u00bb1.3em\u00a0\u00bb background_color=\u00a0\u00bb#000000&Prime; width=\u00a0\u00bb100px\u00a0\u00bb max_width=\u00a0\u00bb100px\u00a0\u00bb custom_margin=\u00a0\u00bb||-42px||false|false\u00a0\u00bb custom_padding=\u00a0\u00bb10px|15px|2px|15px|false|false\u00a0\u00bb][\/et_pb_blurb][et_pb_text _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb text_text_color=\u00a0\u00bb#000000&Prime; background_color=\u00a0\u00bb#eff0f1&Prime; custom_margin=\u00a0\u00bb|||110px|false|false\u00a0\u00bb custom_padding=\u00a0\u00bb1%|1%|1%|1%|false|false\u00a0\u00bb border_width_top=\u00a0\u00bb10px\u00a0\u00bb border_color_top=\u00a0\u00bb#ff8080&Prime;][crayon lang=\u00a0\u00bbjava\u00a0\u00bb theme=\u00a0\u00bbclassic\u00a0\u00bb title=\u00a0\u00bbRobot.java\u00a0\u00bb]<\/p>\n<p>\/\/ Anthony LE PORS &#8211; Pilotage d&rsquo;un Robot Raspi Thermo Cam &#8211; Avril 2021<br \/>\n\/\/ Classe robot : controle du Raspberry<\/p>\n<p>import com.pi4j.io.gpio.*;<br \/>\nimport com.pi4j.util.CommandArgumentParser;<br \/>\nimport com.pi4j.wiringpi.SoftPwm;<br \/>\nimport java.io.*;<\/p>\n<p>public class Robot {<br \/>\n\t\/\/ attributs : elements du robot<br \/>\n\tprivate GpioController gpio;<\/p>\n<p>\tprivate int moteurGA = 27;<br \/>\n\tprivate int moteurGB = 28;<br \/>\n\tprivate int moteurDA = 13;<br \/>\n\tprivate int moteurDB = 12;<\/p>\n<p>\tprivate GpioPinDigitalOutput moteurGaucheE;<br \/>\n\tprivate GpioPinDigitalOutput moteurDroiteE;<\/p>\n<p>\tprivate Pin pinPan;<br \/>\n\tprivate GpioPinPwmOutput pwmPan;<br \/>\n\tprivate Pin pinTilt;<br \/>\n\tprivate GpioPinPwmOutput pwmTilt;<\/p>\n<p>\t\/\/ constructeur du robot<br \/>\n\tpublic Robot(){<br \/>\n\t\tthis.gpio = GpioFactory.getInstance();<\/p>\n<p>\t\tthis.moteurGaucheE = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_29);<br \/>\n\t\tthis.moteurDroiteE = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_14);<\/p>\n<p>\t\t\/\/ creation des sorties PWM<br \/>\n\t\tSoftPwm.softPwmCreate(moteurGA, 0, 100);<br \/>\n\t\tSoftPwm.softPwmCreate(moteurGB, 0, 100);<br \/>\n\t\tSoftPwm.softPwmCreate(moteurDA, 0, 100);<br \/>\n\t\tSoftPwm.softPwmCreate(moteurDB, 0, 100);<\/p>\n<p>\t\tmoteurGaucheE.high(); \/\/ active moteur Gauche<br \/>\n\t\tmoteurDroiteE.high();\/\/ active moteur Droite<\/p>\n<p>\t\tpinPan = CommandArgumentParser.getPin(RaspiPin.class, RaspiPin.GPIO_21);<br \/>\n\t\tpwmPan = gpio.provisionSoftPwmOutputPin(pinPan);<br \/>\n        pwmPan.setPwmRange(100);<\/p>\n<p>        pinTilt = CommandArgumentParser.getPin(RaspiPin.class, RaspiPin.GPIO_22);<br \/>\n\t\tpwmTilt = gpio.provisionSoftPwmOutputPin(pinTilt);<br \/>\n\t\tpwmTilt.setPwmRange(100);<br \/>\n\t}<\/p>\n<p>\t\/\/ methodes <\/p>\n<p>\tpublic void deplacement(int[] puissance) {<br \/>\n\t\tint vitesse = Math.max(Math.abs(puissance[0]), Math.abs(puissance[1]));<\/p>\n<p>\t\tif (puissance[1] > 0) {<br \/>\n\t\t\tif (puissance[0] > 0) { \/\/ zone 1<br \/>\n\t\t\t\tSoftPwm.softPwmWrite(moteurGA, vitesse &#8211; puissance[0]);<br \/>\n\t\t\t\tSoftPwm.softPwmWrite(moteurGB, 0);<\/p>\n<p>\t\t\t\tSoftPwm.softPwmWrite(moteurDA, vitesse);<br \/>\n\t\t\t\tSoftPwm.softPwmWrite(moteurDB, 0);<br \/>\n\t\t\t}<\/p>\n<p>\t\t\telse if (puissance[0] < 0) { \/\/ zone 2\t\t\t\t\n\t\t\t\tSoftPwm.softPwmWrite(moteurGA, vitesse);\n\t\t\t\tSoftPwm.softPwmWrite(moteurGB, 0);\n\t\t\t\t\n\t\t\t\tSoftPwm.softPwmWrite(moteurDA, vitesse + puissance[0]);\n\t\t\t\tSoftPwm.softPwmWrite(moteurDB, 0);\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\telse if (puissance[0] == 0) {\n\t\t\t\tavancer(puissance[1]);\n\t\t\t}\n\t\t}\n\t\t\n\t\telse if (puissance[1] < 0) {\n\t\t\tif (puissance[0] < 0) { \/\/ zone 3\n\t\t\t\tSoftPwm.softPwmWrite(moteurGA, 0);\n\t\t\t\tSoftPwm.softPwmWrite(moteurGB, vitesse);\n\t\t\t\t\n\t\t\t\tSoftPwm.softPwmWrite(moteurDA, 0);\n\t\t\t\tSoftPwm.softPwmWrite(moteurDB, vitesse + puissance[0]);\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\telse if (puissance[0] > 0) { \/\/ zone 4<br \/>\n\t\t\t\tSoftPwm.softPwmWrite(moteurGA, 0);<br \/>\n\t\t\t\tSoftPwm.softPwmWrite(moteurGB, vitesse &#8211; puissance[0]);<\/p>\n<p>\t\t\t\tSoftPwm.softPwmWrite(moteurDA, 0);<br \/>\n\t\t\t\tSoftPwm.softPwmWrite(moteurDB, vitesse);<br \/>\n\t\t\t}<\/p>\n<p>\t\t\telse if (puissance[0] == 0) {<br \/>\n\t\t\t\tavancer(puissance[1]);<br \/>\n\t\t\t}<br \/>\n\t\t}<\/p>\n<p>\t\telse if (puissance[1] == 0) {<br \/>\n\t\t\tif (puissance[0] == 0) {<br \/>\n\t\t\t\tstop();<br \/>\n\t\t\t}else { \/\/ pivot droite ou gauche<br \/>\n\t\t\t\ttourner(puissance[0]);<br \/>\n\t\t\t}<br \/>\n\t\t}<br \/>\n\t}<\/p>\n<p>\tpublic void avancer(int vitesse) {<br \/>\n\t\tif (vitesse > 0) {<br \/>\n\t\t\tSystem.out.println(\u00ab\u00a0Avant\u00a0\u00bb);<\/p>\n<p>\t\t\tSoftPwm.softPwmWrite(moteurGA, vitesse);<br \/>\n\t\t\tSoftPwm.softPwmWrite(moteurGB, 0);<\/p>\n<p>\t\t\tSoftPwm.softPwmWrite(moteurDA, vitesse);<br \/>\n\t\t\tSoftPwm.softPwmWrite(moteurDB, 0);<br \/>\n\t\t}<\/p>\n<p>\t\telse {<br \/>\n\t\t\tSystem.out.println(\u00ab\u00a0Arriere\u00a0\u00bb);<\/p>\n<p>\t\t\tSoftPwm.softPwmWrite(moteurGA, 0);<br \/>\n\t\t\tSoftPwm.softPwmWrite(moteurGB, -vitesse);<\/p>\n<p>\t\t\tSoftPwm.softPwmWrite(moteurDA, 0);<br \/>\n\t\t\tSoftPwm.softPwmWrite(moteurDB, -vitesse);<br \/>\n\t\t}<br \/>\n\t}<\/p>\n<p>\tpublic void tourner(int vitesse) {<br \/>\n\t\tif (vitesse > 0) {<br \/>\n\t\t\tSystem.out.println(\u00ab\u00a0Gauche\u00a0\u00bb);<\/p>\n<p>\t\t\tSoftPwm.softPwmWrite(moteurGA, 0);<br \/>\n\t\t\tSoftPwm.softPwmWrite(moteurGB, vitesse);<\/p>\n<p>\t\t\tSoftPwm.softPwmWrite(moteurDA, vitesse);<br \/>\n\t\t\tSoftPwm.softPwmWrite(moteurDB, 0);<br \/>\n\t\t}<\/p>\n<p>\t\telse {<br \/>\n\t\t\tSystem.out.println(\u00ab\u00a0Droite\u00a0\u00bb);<\/p>\n<p>\t\t\tSoftPwm.softPwmWrite(moteurGA, -vitesse);<br \/>\n\t\t\tSoftPwm.softPwmWrite(moteurGB, 0);<\/p>\n<p>\t\t\tSoftPwm.softPwmWrite(moteurDA, 0);<br \/>\n\t\t\tSoftPwm.softPwmWrite(moteurDB, -vitesse);<br \/>\n\t\t}<br \/>\n\t}<\/p>\n<p>\tpublic void stop() {<br \/>\n\t\tSystem.out.println(\u00ab\u00a0Stop\u00a0\u00bb);<\/p>\n<p>\t\tSoftPwm.softPwmWrite(moteurGA, 0);<br \/>\n\t\tSoftPwm.softPwmWrite(moteurGB, 0);<\/p>\n<p>\t\tSoftPwm.softPwmWrite(moteurDA, 0);<br \/>\n\t\tSoftPwm.softPwmWrite(moteurDB, 0);<br \/>\n\t}<\/p>\n<p>\tpublic void rotationPan(int angle) {<br \/>\n\t\tSystem.out.println(\u00ab\u00a0Rotation du Pan\u00a0\u00bb);<\/p>\n<p>        pwmPan.setPwm(angle);<br \/>\n        System.out.println(\u00ab\u00a0Angle choisi \u00a0\u00bb + pwmPan.getPwm());<br \/>\n        try {<br \/>\n\t\t\tThread.sleep(100);<br \/>\n\t\t} catch (InterruptedException e) {e.printStackTrace();}<\/p>\n<p>        System.out.println(\u00ab\u00a0pwm end\u00a0\u00bb);<br \/>\n\t}<\/p>\n<p>\tpublic void rotationTilt(int angle) {<br \/>\n\t\tSystem.out.println(\u00ab\u00a0Rotation du Tilt\u00a0\u00bb);<\/p>\n<p>        pwmTilt.setPwm(angle);<br \/>\n        System.out.println(\u00ab\u00a0Angle choisi \u00a0\u00bb + pwmTilt.getPwm());<br \/>\n        try {<br \/>\n\t\t\tThread.sleep(100);<br \/>\n\t\t} catch (InterruptedException e) {e.printStackTrace();}<\/p>\n<p>        System.out.println(\u00ab\u00a0pwm end\u00a0\u00bb);<br \/>\n\t}<\/p>\n<p>\tpublic void lancerParabilis() {<br \/>\n\t\ttry {<br \/>\n\t\t\tProcessBuilder builder = new ProcessBuilder(\u00ab\u00a0bash\u00a0\u00bb, \u00ab\u00a0-c\u00a0\u00bb, \u00ab\u00a0\/home\/pi\/RaspiThermoCam\/data\/ParabilisThermal.sh\u00a0\u00bb);<br \/>\n\t\t\tbuilder.start();<br \/>\n\t\t}catch (IOException ie) {ie.printStackTrace();}<br \/>\n\t}<\/p>\n<p>\tpublic void lancerGetThermal() {<br \/>\n\t\ttry {<br \/>\n\t\t\tProcessBuilder builder = new ProcessBuilder(\u00ab\u00a0bash\u00a0\u00bb, \u00ab\u00a0-c\u00a0\u00bb, \u00ab\u00a0\/home\/pi\/RaspiThermoCam\/data\/GetThermal.sh\u00a0\u00bb);<br \/>\n\t\t\tbuilder.start();<br \/>\n\t\t}catch (IOException ie) {ie.printStackTrace();}<br \/>\n\t}<\/p>\n<p>\tpublic void resetGPIO() {<br \/>\n\t\trotationPan(18); \/\/ tout droit<br \/>\n\t\trotationTilt(17); \/\/ tout droit<\/p>\n<p>\t\tgpio.shutdown();<\/p>\n<p>\t\tmoteurGaucheE.low(); \/\/ eteint moteur Gauche<br \/>\n\t\tmoteurDroiteE.low();\/\/ eteint moteur Droite<br \/>\n\t}<br \/>\n}<\/p>\n<p>[\/crayon][\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_column type=\u00a0\u00bb4_4&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_text _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb]<\/p>\n<p>Il s&rsquo;en suit la cr\u00e9ation de la classe Controller qui ordonne les actions du Raspberry en fonction des \u00e9v\u00e9nements sur l&rsquo;interface.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row use_custom_gutter=\u00a0\u00bbon\u00a0\u00bb gutter_width=\u00a0\u00bb1&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb custom_margin=\u00a0\u00bb5px||5px||false|false\u00a0\u00bb custom_padding=\u00a0\u00bb0px||0px||false|false\u00a0\u00bb border_width_all=\u00a0\u00bb2px\u00a0\u00bb box_shadow_style=\u00a0\u00bbpreset1&Prime;][et_pb_column type=\u00a0\u00bb4_4&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_blurb title=\u00a0\u00bbJava\u00a0\u00bb use_icon=\u00a0\u00bbon\u00a0\u00bb font_icon=\u00a0\u00bb%%209%%\u00a0\u00bb icon_placement=\u00a0\u00bbleft\u00a0\u00bb use_icon_font_size=\u00a0\u00bbon\u00a0\u00bb icon_font_size=\u00a0\u00bb20px\u00a0\u00bb _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb header_text_color=\u00a0\u00bb#FFFFFF\u00a0\u00bb header_font_size=\u00a0\u00bb16px\u00a0\u00bb header_line_height=\u00a0\u00bb1.3em\u00a0\u00bb background_color=\u00a0\u00bb#000000&Prime; width=\u00a0\u00bb100px\u00a0\u00bb max_width=\u00a0\u00bb100px\u00a0\u00bb custom_margin=\u00a0\u00bb||-42px||false|false\u00a0\u00bb custom_padding=\u00a0\u00bb10px|15px|2px|15px|false|false\u00a0\u00bb][\/et_pb_blurb][et_pb_text _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb text_text_color=\u00a0\u00bb#000000&Prime; background_color=\u00a0\u00bb#eff0f1&Prime; custom_margin=\u00a0\u00bb|||110px|false|false\u00a0\u00bb custom_padding=\u00a0\u00bb1%|1%|1%|1%|false|false\u00a0\u00bb border_width_top=\u00a0\u00bb10px\u00a0\u00bb border_color_top=\u00a0\u00bb#ff8080&Prime;][crayon lang=\u00a0\u00bbjava\u00a0\u00bb theme=\u00a0\u00bbclassic\u00a0\u00bb title=\u00a0\u00bbController.java\u00a0\u00bb]<\/p>\n<p>\/\/ Anthony LE PORS &#8211; Pilotage d&rsquo;un Robot Raspi Thermo Cam &#8211; Avril 2021<br \/>\n\/\/ Controller : lien entre Robot et Interface<\/p>\n<p>import java.awt.event.*;<br \/>\nimport javax.swing.event.*;<\/p>\n<p>public class Controller {<br \/>\n\t\/\/ attributs<br \/>\n\tprivate View view;<br \/>\n\tprivate Robot robot;<\/p>\n<p>\t\/\/ constructeur<br \/>\n\tpublic Controller(View v, Robot r) {<br \/>\n\t\tview = v;<br \/>\n\t\trobot = r;<br \/>\n\t}<\/p>\n<p>\t\/\/ methodes<br \/>\n\t\/\/ action des boutons<br \/>\n\tpublic void initController() {<br \/>\n\t\tactionFermeture();<br \/>\n\t\tactionJoystickDirection();<\/p>\n<p>\t\tview.getFenetre().addComponentListener(new ComponentAdapter() {<br \/>\n            public void componentResized(ComponentEvent e) {<br \/>\n                actionJoystickDirection();<br \/>\n            }<br \/>\n        });<\/p>\n<p>\t\tview.getSliderHorizontal().addChangeListener(new ChangeListener() {<br \/>\n\t\t\tpublic void stateChanged(ChangeEvent e) {<br \/>\n\t\t\t\trobot.rotationPan((int) (view.getSliderHorizontal().getValue()*(-0.105) + 19.066));<br \/>\n\t\t\t}<br \/>\n\t\t});<\/p>\n<p>\t\tview.getSliderVertical().addChangeListener(new ChangeListener() {<br \/>\n\t\t\tpublic void stateChanged(ChangeEvent e) {<br \/>\n\t\t\t\trobot.rotationTilt((int) (view.getSliderVertical().getValue()*(-0.1091) + 16.727));<br \/>\n\t\t\t}<br \/>\n\t\t});<\/p>\n<p>\t\tview.getBtnParabilis().addActionListener(event -> robot.lancerParabilis());<br \/>\n\t\tview.getBtnGetThermal().addActionListener(event -> robot.lancerGetThermal());<br \/>\n\t}<\/p>\n<p>\t\/\/ evenements lors d&rsquo;un appui sur bouton<br \/>\n\tprivate void actionFermeture() {<br \/>\n\t\tview.getFenetre().addWindowListener(new WindowAdapter() {<br \/>\n            @Override<br \/>\n            public void windowClosing(WindowEvent e) {<br \/>\n                robot.resetGPIO();<br \/>\n                view.getFenetre().dispose();<br \/>\n            }<br \/>\n        });<br \/>\n\t}<\/p>\n<p>\tprivate void actionJoystickDirection() {<br \/>\n\t\tview.getJoystickDirection().getLabelJoystick().addMouseMotionListener(new MouseAdapter(){<br \/>\n            @Override<br \/>\n            public void mouseDragged(MouseEvent e){<br \/>\n            \trobot.deplacement(view.getJoystickDirection().getPuissance());<br \/>\n            }<br \/>\n\t\t});<\/p>\n<p>\t\tview.getJoystickDirection().getLabelJoystick().addMouseListener(new MouseAdapter(){<br \/>\n            @Override<br \/>\n            public void mouseReleased(MouseEvent e){<br \/>\n            \trobot.stop();<br \/>\n            }<br \/>\n\t\t});<br \/>\n\t}<\/p>\n<p>}<\/p>\n<p>[\/crayon][\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_column type=\u00a0\u00bb4_4&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_text _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb]<\/p>\n<p>Enfin, le main permet de coordonner toutes les classes, toujours selon la m\u00e9thode MVC.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row use_custom_gutter=\u00a0\u00bbon\u00a0\u00bb gutter_width=\u00a0\u00bb1&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb custom_margin=\u00a0\u00bb5px||5px||false|false\u00a0\u00bb custom_padding=\u00a0\u00bb0px||0px||false|false\u00a0\u00bb border_width_all=\u00a0\u00bb2px\u00a0\u00bb box_shadow_style=\u00a0\u00bbpreset1&Prime;][et_pb_column type=\u00a0\u00bb4_4&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_blurb title=\u00a0\u00bbJava\u00a0\u00bb use_icon=\u00a0\u00bbon\u00a0\u00bb font_icon=\u00a0\u00bb%%209%%\u00a0\u00bb icon_placement=\u00a0\u00bbleft\u00a0\u00bb use_icon_font_size=\u00a0\u00bbon\u00a0\u00bb icon_font_size=\u00a0\u00bb20px\u00a0\u00bb _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb header_text_color=\u00a0\u00bb#FFFFFF\u00a0\u00bb header_font_size=\u00a0\u00bb16px\u00a0\u00bb header_line_height=\u00a0\u00bb1.3em\u00a0\u00bb background_color=\u00a0\u00bb#000000&Prime; width=\u00a0\u00bb100px\u00a0\u00bb max_width=\u00a0\u00bb100px\u00a0\u00bb custom_margin=\u00a0\u00bb||-42px||false|false\u00a0\u00bb custom_padding=\u00a0\u00bb10px|15px|2px|15px|false|false\u00a0\u00bb][\/et_pb_blurb][et_pb_text _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb text_text_color=\u00a0\u00bb#000000&Prime; background_color=\u00a0\u00bb#eff0f1&Prime; custom_margin=\u00a0\u00bb|||110px|false|false\u00a0\u00bb custom_padding=\u00a0\u00bb1%|1%|1%|1%|false|false\u00a0\u00bb border_width_top=\u00a0\u00bb10px\u00a0\u00bb border_color_top=\u00a0\u00bb#ff8080&Prime;][crayon lang=\u00a0\u00bbjava\u00a0\u00bb theme=\u00a0\u00bbclassic\u00a0\u00bb title=\u00a0\u00bbAppJoystick.java\u00a0\u00bb]<\/p>\n<p>\/\/ Anthony LE PORS &#8211; Pilotage d&rsquo;un Robot Raspi Thermo Cam &#8211; Avril 2021<br \/>\n\/\/ MAIN &#8211; M\u00e9thode MVC<\/p>\n<p>public class AppJoystick {<\/p>\n<p>\tpublic static void main(String[] args) {<br \/>\n\t\t\/\/ on assemble les pi\u00e8ces de la m\u00e9thode MVC (ici RVC)<br \/>\n\t\tView fenetreInterface = new View(\u00ab\u00a0Raspi Thermo Cam\u00a0\u00bb);<br \/>\n\t\tRobot raspiThermoCam = new Robot();<br \/>\n\t\tController controlActions = new Controller(fenetreInterface, raspiThermoCam);<br \/>\n\t\tcontrolActions.initController();<br \/>\n\t}<br \/>\n}<\/p>\n<p>[\/crayon][\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_column type=\u00a0\u00bb4_4&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_text _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb]<\/p>\n<h2>Compilation et ex\u00e9cution du pilotage des moteurs avec le Joystick virtuel Java<\/h2>\n<p>Pour compiler, nous ex\u00e9cutons le main sur Eclipse, toujours sur le PC Windows.\u00a0Evidemment, des erreurs apparaissent puisque ce fichier ne peut pas s\u2019ex\u00e9cuter sur Windows sans les ports GPIO. Mais les fichiers compil\u00e9s apparaissent cette-fois dans le r\u00e9pertoire \/bin du projet. En effet, les fichiers \u00ab .class \u00bb compil\u00e9s sont ajout\u00e9s dans ce r\u00e9pertoire. Avec WinSCP, nous transf\u00e9rons le dossier du projet sur le Raspberry. Il ne nous reste plus qu\u2019\u00e0 lancer le programme avec la commande suivante :<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row use_custom_gutter=\u00a0\u00bbon\u00a0\u00bb gutter_width=\u00a0\u00bb1&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb custom_margin=\u00a0\u00bb5px||5px||false|false\u00a0\u00bb custom_padding=\u00a0\u00bb0px||0px||false|false\u00a0\u00bb border_width_all=\u00a0\u00bb2px\u00a0\u00bb box_shadow_style=\u00a0\u00bbpreset1&Prime;][et_pb_column type=\u00a0\u00bb4_4&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_blurb title=\u00a0\u00bbTerminal\u00a0\u00bb use_icon=\u00a0\u00bbon\u00a0\u00bb font_icon=\u00a0\u00bb%%209%%\u00a0\u00bb icon_placement=\u00a0\u00bbleft\u00a0\u00bb use_icon_font_size=\u00a0\u00bbon\u00a0\u00bb icon_font_size=\u00a0\u00bb20px\u00a0\u00bb _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb header_text_color=\u00a0\u00bb#FFFFFF\u00a0\u00bb header_font_size=\u00a0\u00bb16px\u00a0\u00bb header_line_height=\u00a0\u00bb1.3em\u00a0\u00bb background_color=\u00a0\u00bb#000000&Prime; width=\u00a0\u00bb135px\u00a0\u00bb max_width=\u00a0\u00bb135px\u00a0\u00bb custom_margin=\u00a0\u00bb||-42px||false|false\u00a0\u00bb custom_padding=\u00a0\u00bb10px|15px|2px|15px|false|false\u00a0\u00bb][\/et_pb_blurb][et_pb_text _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb text_text_color=\u00a0\u00bb#000000&Prime; background_color=\u00a0\u00bb#eff0f1&Prime; custom_margin=\u00a0\u00bb|||145px|false|false\u00a0\u00bb custom_padding=\u00a0\u00bb1%|1%|1%|1%|false|false\u00a0\u00bb border_width_top=\u00a0\u00bb10px\u00a0\u00bb border_color_top=\u00a0\u00bb#ff8080&Prime;][crayon theme=\u00a0\u00bbanthoterm\u00a0\u00bb nums=\u00a0\u00bbfalse\u00a0\u00bb toolbar=\u00a0\u00bbfalse\u00a0\u00bb plain=\u00a0\u00bbfalse\u00a0\u00bb]<\/p>\n<p>cd \/home\/pi\/RaspiThermoCam # on se place dans le r\u00e9pertoire qui contient les fichiers compil\u00e9s<br \/>\nsudo java -classpath .:classes:\/opt\/pi4j\/lib\/&rsquo;*&rsquo; AppJoystick # commande pour ex\u00e9cuter l&rsquo;appli via le main et en utilisant les librairies Pi4J<\/p>\n<p>[\/crayon][\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_column type=\u00a0\u00bb4_4&Prime; _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb][et_pb_text _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb]<\/p>\n<p>Le r\u00e9sultat du pilotage des moteurs du Raspberry avec un joystick est visible sur la vid\u00e9o ci-dessous :\u00a0<\/p>\n<p>[\/et_pb_text][et_pb_video src=\u00a0\u00bbhttps:\/\/www.youtube.com\/watch?v=gECeiTlpt00&Prime; use_icon_font_size=\u00a0\u00bbon\u00a0\u00bb _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb width=\u00a0\u00bb75%\u00a0\u00bb module_alignment=\u00a0\u00bbcenter\u00a0\u00bb box_shadow_style=\u00a0\u00bbpreset1&Prime; locked=\u00a0\u00bboff\u00a0\u00bb][\/et_pb_video][et_pb_text _builder_version=\u00a0\u00bb4.8.2&Prime; _module_preset=\u00a0\u00bbdefault\u00a0\u00bb hover_enabled=\u00a0\u00bb0&Prime; sticky_enabled=\u00a0\u00bb0&Prime;]<\/p>\n<p>L&rsquo;utilisation de ce robot en tant que robot thermique est en ligne sur une page en cliquant <a href=\"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/robot-thermique\">ici<\/a>.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Pilotage de 2 moteurs DC avec un joystick virtuel? Contr\u00f4le du GPIO sur le Raspberry Pi avec les librairies Pi4J et interface Java Swing.<\/p>\n","protected":false},"author":1,"featured_media":2145,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"class_list":["post-2148","page","type-page","status-publish","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Piloter 2 moteurs avec un Joystick | Raspberry Pi - Raspi Thermo Cam<\/title>\n<meta name=\"description\" content=\"Pilotage de 2 moteurs DC avec un joystick virtuel? Contr\u00f4le du GPIO sur le Raspberry Pi avec les librairies Pi4J et interface Java Swing.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/pilotage-moteur-joystick\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Piloter 2 moteurs avec un Joystick | Raspberry Pi - Raspi Thermo Cam\" \/>\n<meta property=\"og:description\" content=\"Pilotage de 2 moteurs DC avec un joystick virtuel? Contr\u00f4le du GPIO sur le Raspberry Pi avec les librairies Pi4J et interface Java Swing.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/pilotage-moteur-joystick\/\" \/>\n<meta property=\"og:site_name\" content=\"Raspi Thermo Cam - Projet Cam\u00e9ra Thermique\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-06T15:18:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-content\/uploads\/2021\/05\/Control-2-motors-joystick.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Piloter 2 moteurs avec un Joystick | Raspberry Pi - Raspi Thermo Cam\" \/>\n<meta name=\"twitter:description\" content=\"Pilotage de 2 moteurs DC avec un joystick virtuel? Contr\u00f4le du GPIO sur le Raspberry Pi avec les librairies Pi4J et interface Java Swing.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-content\/uploads\/2021\/05\/Control-2-motors-joystick.png\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/anthony.lepors.fr\\\/raspi-thermo-cam\\\/pilotage-moteur-joystick\\\/\",\"url\":\"https:\\\/\\\/anthony.lepors.fr\\\/raspi-thermo-cam\\\/pilotage-moteur-joystick\\\/\",\"name\":\"Piloter 2 moteurs avec un Joystick | Raspberry Pi - Raspi Thermo Cam\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/anthony.lepors.fr\\\/raspi-thermo-cam\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/anthony.lepors.fr\\\/raspi-thermo-cam\\\/pilotage-moteur-joystick\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/anthony.lepors.fr\\\/raspi-thermo-cam\\\/pilotage-moteur-joystick\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/anthony.lepors.fr\\\/raspi-thermo-cam\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/Control-2-motors-joystick.png\",\"datePublished\":\"2021-05-06T14:15:08+00:00\",\"dateModified\":\"2021-05-06T15:18:32+00:00\",\"description\":\"Pilotage de 2 moteurs DC avec un joystick virtuel? Contr\u00f4le du GPIO sur le Raspberry Pi avec les librairies Pi4J et interface Java Swing.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/anthony.lepors.fr\\\/raspi-thermo-cam\\\/pilotage-moteur-joystick\\\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/anthony.lepors.fr\\\/raspi-thermo-cam\\\/pilotage-moteur-joystick\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/anthony.lepors.fr\\\/raspi-thermo-cam\\\/pilotage-moteur-joystick\\\/#primaryimage\",\"url\":\"https:\\\/\\\/anthony.lepors.fr\\\/raspi-thermo-cam\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/Control-2-motors-joystick.png\",\"contentUrl\":\"https:\\\/\\\/anthony.lepors.fr\\\/raspi-thermo-cam\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/Control-2-motors-joystick.png\",\"width\":1280,\"height\":720},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/anthony.lepors.fr\\\/raspi-thermo-cam\\\/pilotage-moteur-joystick\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/anthony.lepors.fr\\\/raspi-thermo-cam\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Piloter 2 moteurs avec un Joystick\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/anthony.lepors.fr\\\/raspi-thermo-cam\\\/#website\",\"url\":\"https:\\\/\\\/anthony.lepors.fr\\\/raspi-thermo-cam\\\/\",\"name\":\"Raspi Thermo Cam - Projet Cam\u00e9ra Thermique\",\"description\":\"Site web qui retrace la r\u00e9alisation d&#039;un projet de cam\u00e9ra thermique avec un Raspberry. Nous utilisons le module FLIR Lepton 3.5 avec un Raspberry Pi 400.\",\"publisher\":{\"@id\":\"https:\\\/\\\/anthony.lepors.fr\\\/raspi-thermo-cam\\\/#\\\/schema\\\/person\\\/92186a88d3e51aa770548fabc8d16e06\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/anthony.lepors.fr\\\/raspi-thermo-cam\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/anthony.lepors.fr\\\/raspi-thermo-cam\\\/#\\\/schema\\\/person\\\/92186a88d3e51aa770548fabc8d16e06\",\"name\":\"Anthony LE PORS\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ff32c3852ab8cee9e1657174d156c802a9f0e1f3a3e0256a92e6ecc810f2383b?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ff32c3852ab8cee9e1657174d156c802a9f0e1f3a3e0256a92e6ecc810f2383b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ff32c3852ab8cee9e1657174d156c802a9f0e1f3a3e0256a92e6ecc810f2383b?s=96&d=mm&r=g\",\"caption\":\"Anthony LE PORS\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ff32c3852ab8cee9e1657174d156c802a9f0e1f3a3e0256a92e6ecc810f2383b?s=96&d=mm&r=g\"},\"sameAs\":[\"https:\\\/\\\/anthony.lepors.fr\\\/raspi-thermo-cam\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Piloter 2 moteurs avec un Joystick | Raspberry Pi - Raspi Thermo Cam","description":"Pilotage de 2 moteurs DC avec un joystick virtuel? Contr\u00f4le du GPIO sur le Raspberry Pi avec les librairies Pi4J et interface Java Swing.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/pilotage-moteur-joystick\/","og_locale":"fr_FR","og_type":"article","og_title":"Piloter 2 moteurs avec un Joystick | Raspberry Pi - Raspi Thermo Cam","og_description":"Pilotage de 2 moteurs DC avec un joystick virtuel? Contr\u00f4le du GPIO sur le Raspberry Pi avec les librairies Pi4J et interface Java Swing.","og_url":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/pilotage-moteur-joystick\/","og_site_name":"Raspi Thermo Cam - Projet Cam\u00e9ra Thermique","article_modified_time":"2021-05-06T15:18:32+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-content\/uploads\/2021\/05\/Control-2-motors-joystick.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_title":"Piloter 2 moteurs avec un Joystick | Raspberry Pi - Raspi Thermo Cam","twitter_description":"Pilotage de 2 moteurs DC avec un joystick virtuel? Contr\u00f4le du GPIO sur le Raspberry Pi avec les librairies Pi4J et interface Java Swing.","twitter_image":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-content\/uploads\/2021\/05\/Control-2-motors-joystick.png","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/pilotage-moteur-joystick\/","url":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/pilotage-moteur-joystick\/","name":"Piloter 2 moteurs avec un Joystick | Raspberry Pi - Raspi Thermo Cam","isPartOf":{"@id":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/#website"},"primaryImageOfPage":{"@id":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/pilotage-moteur-joystick\/#primaryimage"},"image":{"@id":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/pilotage-moteur-joystick\/#primaryimage"},"thumbnailUrl":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-content\/uploads\/2021\/05\/Control-2-motors-joystick.png","datePublished":"2021-05-06T14:15:08+00:00","dateModified":"2021-05-06T15:18:32+00:00","description":"Pilotage de 2 moteurs DC avec un joystick virtuel? Contr\u00f4le du GPIO sur le Raspberry Pi avec les librairies Pi4J et interface Java Swing.","breadcrumb":{"@id":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/pilotage-moteur-joystick\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/pilotage-moteur-joystick\/"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/pilotage-moteur-joystick\/#primaryimage","url":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-content\/uploads\/2021\/05\/Control-2-motors-joystick.png","contentUrl":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-content\/uploads\/2021\/05\/Control-2-motors-joystick.png","width":1280,"height":720},{"@type":"BreadcrumbList","@id":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/pilotage-moteur-joystick\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/"},{"@type":"ListItem","position":2,"name":"Piloter 2 moteurs avec un Joystick"}]},{"@type":"WebSite","@id":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/#website","url":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/","name":"Raspi Thermo Cam - Projet Cam\u00e9ra Thermique","description":"Site web qui retrace la r\u00e9alisation d&#039;un projet de cam\u00e9ra thermique avec un Raspberry. Nous utilisons le module FLIR Lepton 3.5 avec un Raspberry Pi 400.","publisher":{"@id":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/#\/schema\/person\/92186a88d3e51aa770548fabc8d16e06"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":["Person","Organization"],"@id":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/#\/schema\/person\/92186a88d3e51aa770548fabc8d16e06","name":"Anthony LE PORS","image":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/secure.gravatar.com\/avatar\/ff32c3852ab8cee9e1657174d156c802a9f0e1f3a3e0256a92e6ecc810f2383b?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ff32c3852ab8cee9e1657174d156c802a9f0e1f3a3e0256a92e6ecc810f2383b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ff32c3852ab8cee9e1657174d156c802a9f0e1f3a3e0256a92e6ecc810f2383b?s=96&d=mm&r=g","caption":"Anthony LE PORS"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/ff32c3852ab8cee9e1657174d156c802a9f0e1f3a3e0256a92e6ecc810f2383b?s=96&d=mm&r=g"},"sameAs":["https:\/\/anthony.lepors.fr\/raspi-thermo-cam"]}]}},"_links":{"self":[{"href":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-json\/wp\/v2\/pages\/2148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-json\/wp\/v2\/comments?post=2148"}],"version-history":[{"count":0,"href":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-json\/wp\/v2\/pages\/2148\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-json\/wp\/v2\/media\/2145"}],"wp:attachment":[{"href":"https:\/\/anthony.lepors.fr\/raspi-thermo-cam\/wp-json\/wp\/v2\/media?parent=2148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}