Ajout advantagekit
This commit is contained in:
		| @@ -130,7 +130,7 @@ const config = { | |||||||
|         copyright: `Copyright © ${new Date().getFullYear()} PLS 5618. Fait avec Docusaurus.`, |         copyright: `Copyright © ${new Date().getFullYear()} PLS 5618. Fait avec Docusaurus.`, | ||||||
|       }, |       }, | ||||||
|       prism: { |       prism: { | ||||||
|         additionalLanguages: ["java"], |         additionalLanguages: ["java", "groovy"], | ||||||
|         theme: lightCodeTheme, |         theme: lightCodeTheme, | ||||||
|         darkTheme: darkCodeTheme, |         darkTheme: darkCodeTheme, | ||||||
|       }, |       }, | ||||||
|   | |||||||
| @@ -2,6 +2,6 @@ | |||||||
| sidebar_position: 2 | sidebar_position: 2 | ||||||
| --- | --- | ||||||
|  |  | ||||||
| # Débuter | # Premier Projet | ||||||
|  |  | ||||||
| Dans cette section, vous apprendrez comment installer le logiciel de programmation et comment créer un projet. | Dans cette section, vous apprendrez comment installer le logiciel de programmation et comment créer un projet. | ||||||
|   | |||||||
							
								
								
									
										77
									
								
								robot/nouveau_projet/advantagekit.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								robot/nouveau_projet/advantagekit.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,77 @@ | |||||||
|  | --- | ||||||
|  | sidebar_position: 2 | ||||||
|  | --- | ||||||
|  |  | ||||||
|  | # Installer AdvantageKit | ||||||
|  |  | ||||||
|  | AdvantageKit permet de recevoir plus d'information du robot, ce qui nous aidera à debug. | ||||||
|  |  | ||||||
|  | [Plus d'information](https://github.com/Mechanical-Advantage/AdvantageKit/blob/main/docs/INSTALLATION.md) | ||||||
|  |  | ||||||
|  | ## Ajouter le répertoire d'AdvantageKit | ||||||
|  |  | ||||||
|  | Ajouter ce code à la fin du fichier `build.gradle` pour ajouter le repertoire d'AdvantageKit. | ||||||
|  |  | ||||||
|  | ```groovy | ||||||
|  | repositories { | ||||||
|  |     maven { | ||||||
|  |         url = uri("https://maven.pkg.github.com/Mechanical-Advantage/AdvantageKit") | ||||||
|  |         credentials { | ||||||
|  |             username = "Mechanical-Advantage-Bot" | ||||||
|  |             password = "\u0067\u0068\u0070\u005f\u006e\u0056\u0051\u006a\u0055\u004f\u004c\u0061\u0079\u0066\u006e\u0078\u006e\u0037\u0051\u0049\u0054\u0042\u0032\u004c\u004a\u006d\u0055\u0070\u0073\u0031\u006d\u0037\u004c\u005a\u0030\u0076\u0062\u0070\u0063\u0051" | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | Il faut aussi ajouter ce code en dessous pour remplacer certaines fonctionalités de WPILib par celles de AdvantageKit. | ||||||
|  |  | ||||||
|  | ```groovy | ||||||
|  | configurations.all { | ||||||
|  |     exclude group: "edu.wpi.first.wpilibj" | ||||||
|  | } | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | ## Ajout dans le programme | ||||||
|  |  | ||||||
|  | Il faut ensuite ajouter les librairies qui permettent de choisir quoi enregistrer. | ||||||
|  |  | ||||||
|  | ### Librairie | ||||||
|  |  | ||||||
|  | Il faut utiliser la même technique que dans [Librairies de composants](./vendor_libraries) avec le lien suivant: | ||||||
|  |  | ||||||
|  | ``` | ||||||
|  | https://github.com/Mechanical-Advantage/AdvantageKit/releases/latest/download/AdvantageKit.json | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | ### Configuration du robot | ||||||
|  |  | ||||||
|  | Il faut ensuite aller remplacer le type de robot pour celui de AdvantageKit dans `Robot.java`: | ||||||
|  |  | ||||||
|  | ```java | ||||||
|  | public class Robot extends LoggedRobot { | ||||||
|  |     ... | ||||||
|  | } | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | Ensuite, dans `robotInit()` ajoutez les lignes suivantes: | ||||||
|  |  | ||||||
|  | ```java | ||||||
|  | Logger.getInstance().recordMetadata("ProjectName", "5618BOT"); | ||||||
|  | if (isReal()) { | ||||||
|  |     Logger.getInstance().addDataReceiver(new WPILOGWriter("/media/sda1/")); | ||||||
|  |     new PowerDistribution(1, ModuleType.kCTRE); | ||||||
|  | } | ||||||
|  | Logger.getInstance().addDataReceiver(new NT4Publisher()); | ||||||
|  | Logger.getInstance().start(); | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | :::caution | ||||||
|  | Il faut importer le `Logger` de `org.littletonrobotics.junction.Logger`. | ||||||
|  | ::: | ||||||
|  |  | ||||||
|  | :::note | ||||||
|  | Remplacer le ModuleType du PowerDistribution par kREV selon le PDP utilisé. | ||||||
|  | ::: | ||||||
|  |  | ||||||
|  | AdvantageKit est installé. Vous pouvez maintenant utiliser AdvantageScope. | ||||||
							
								
								
									
										5
									
								
								robot/nouveau_projet/index.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								robot/nouveau_projet/index.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | --- | ||||||
|  | sidebar_position: 3 | ||||||
|  | --- | ||||||
|  |  | ||||||
|  | # Nouveau Projet | ||||||
							
								
								
									
										5
									
								
								robot/nouveau_projet/vendor_libraries.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								robot/nouveau_projet/vendor_libraries.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | --- | ||||||
|  | sidebar_position: 1 | ||||||
|  | --- | ||||||
|  |  | ||||||
|  | # Librairies de composants | ||||||
		Reference in New Issue
	
	Block a user