UPDATE
This commit is contained in:
@ -2,14 +2,12 @@
|
||||
title: Documentation PLS5618
|
||||
template: splash
|
||||
hero:
|
||||
title: Documentation de PLS 5618
|
||||
actions:
|
||||
- text: Java
|
||||
link: /java/
|
||||
variant: primary
|
||||
- text: Robot
|
||||
link: /robot/
|
||||
variant: primary
|
||||
title: Documentation de PLS 5618
|
||||
actions:
|
||||
- text: Java
|
||||
link: /java/
|
||||
variant: primary
|
||||
- text: Robot
|
||||
link: /robot/
|
||||
variant: primary
|
||||
---
|
||||
|
||||
|
||||
|
@ -49,12 +49,12 @@ retourne (si elle retourne quelque chose) et les arguments qu'elle pourrait
|
||||
demander. Par exemple, pour la fonction `add`, elle retourne un `int` et prend
|
||||
deux arguments `int`.
|
||||
|
||||
```java
|
||||
// type-de-retour nom(argument)
|
||||
int add(int a, int b) {
|
||||
return a + b;
|
||||
return a + b;
|
||||
}
|
||||
```
|
||||
|
||||
````
|
||||
|
||||
On commence par donner le type de retour (un `int` dans ce cas), suivi du nom de
|
||||
la fonction (`add`) et, entre parenthèses, les arguments de la fonction (`a` et
|
||||
@ -78,4 +78,4 @@ Si vous voulez que votre fonction ne retourne rien, donnez-lui le type de retour
|
||||
void fun() {
|
||||
// Faire quelque chose
|
||||
}
|
||||
```
|
||||
````
|
||||
|
@ -2,7 +2,5 @@
|
||||
title: Créer un projet
|
||||
lang: fr
|
||||
sidebar:
|
||||
order: 2
|
||||
order: 2
|
||||
---
|
||||
|
||||
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Robot
|
||||
sidebar:
|
||||
hidden: true
|
||||
---
|
@ -2,10 +2,9 @@
|
||||
title: Installation
|
||||
lang: fr
|
||||
sidebar:
|
||||
order: 1
|
||||
order: 1
|
||||
---
|
||||
|
||||
|
||||
Pour programmer un robot _FRC_, nous avons plusieurs choses à installer :
|
||||
|
||||
- Les [outils de développement](#outils-de-développement), qui permettent de programmer le robot et déployer le programme sur un robot
|
@ -1,83 +0,0 @@
|
||||
---
|
||||
title: Installer AdvantageKit
|
||||
lang: fr
|
||||
sidebar:
|
||||
order: 2
|
||||
---
|
||||
|
||||
|
||||
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 bibliothèques qui permettent de choisir quoi enregistrer.
|
||||
|
||||
### Bibliothèques
|
||||
|
||||
Il faut utiliser la même technique que dans [Bibliothèques 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](https://github.com/Mechanical-Advantage/AdvantageScope).
|
@ -1,37 +0,0 @@
|
||||
---
|
||||
title: Bibliothèques de composants
|
||||
lang: fr
|
||||
sidebar:
|
||||
order: 1
|
||||
---
|
||||
|
||||
|
||||
NavX
|
||||
|
||||
```
|
||||
https://dev.studica.com/releases/2023/NavX.json
|
||||
```
|
||||
|
||||
Phoenix (CTRE)
|
||||
|
||||
```
|
||||
https://maven.ctr-electronics.com/release/com/ctre/phoenix/Phoenix5-frc2023-latest.json
|
||||
```
|
||||
|
||||
REV
|
||||
|
||||
```
|
||||
https://software-metadata.revrobotics.com/REVLib-2023.json
|
||||
```
|
||||
|
||||
AdvantageKit (voir [AdvantageKit](./advantagekit))
|
||||
|
||||
```
|
||||
https://github.com/Mechanical-Advantage/AdvantageKit/releases/latest/download/AdvantageKit.json
|
||||
```
|
||||
|
||||
YAGSL (Swerve, voir [YAGSL](./yagsl.md))
|
||||
|
||||
```
|
||||
https://broncbotz3481.github.io/YAGSL-Lib/yagsl/yagsl.json
|
||||
```
|
10
src/content/docs/robot/vendor_libraries.md
Normal file
10
src/content/docs/robot/vendor_libraries.md
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Bibliothèques de composants
|
||||
lang: fr
|
||||
sidebar:
|
||||
order: 3
|
||||
---
|
||||
|
||||
Voici le lien avec toutes les librairies que vous pourriez avoir besoin sur [le site de documentation](https://docs.wpilib.org/en/stable/docs/software/vscode-overview/3rd-party-libraries.html#vendor-libraries).
|
||||
|
||||
Pour les installer, allez dans votre projet, faites un clic droit sur le fichier build.gradle, choisissez `Manage Vendor Libraries`. Un menu apparaîtra en haut de l'écran, choisissez `Install new libraries (online)` et collez le lien que vous avez copié sur la page (finissant par `.json`). Les instructions sont aussi disponibles [dans la documentation officielle](https://docs.wpilib.org/en/stable/docs/software/vscode-overview/3rd-party-libraries.html#installing-libraries).
|
@ -1,18 +1,15 @@
|
||||
---
|
||||
title: YAGSL (Swerve)
|
||||
lang: fr
|
||||
sidebar:
|
||||
order: 3
|
||||
---
|
||||
|
||||
|
||||
[Yet Another Generic Swerve Library](https://github.com/BroncBotz3481/YAGSL) permet de facilement créer un sous-système swerve pour un robot.
|
||||
|
||||
Plus d'information sera ajoutée, mais pour l'instant vous pouvez suivre la documentation [ici](https://github.com/BroncBotz3481/YAGSL)
|
||||
Plus d'information sera ajoutée, mais pour l'instant vous pouvez suivre la documentation [ici](https://yagsl.gitbook.io/yagsl)
|
||||
|
||||
## Installation
|
||||
|
||||
Installer les [bibliothèques](vendor_libraries.md) de NavX, Phoenix, REV et YAGSL.
|
||||
Installer les [bibliothèques](./vendor_libraries) de NavX, Phoenix, REV et YAGSL.
|
||||
|
||||
## Configuration
|
||||
|
||||
@ -27,22 +24,18 @@ Vous pouvez donc aller chercher le dossier d'[exemple](https://github.com/BroncB
|
||||
3. Créer le `SwerveDrive` à partir de la configuration
|
||||
|
||||
```java
|
||||
SwerveDrive swerveDrive;
|
||||
|
||||
/** Creates a new SwerveSubsystem. */
|
||||
public SwerveSubsystem(File file) {
|
||||
try {
|
||||
this.swerveDrive = new SwerveParser(file).createSwerveDrive();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
double maximumSpeed = Units.feetToMeters(4.5)
|
||||
File swerveJsonDirectory = new File(Filesystem.getDeployDirectory(),"swerve");
|
||||
SwerveDrive swerveDrive = new SwerveParser(directory).createSwerveDrive(maximumSpeed);
|
||||
```
|
||||
|
||||
:::note
|
||||
|
||||
Ici, on utilise un [try-catch](../../java/try-catch){target="\_blank"}, car il pourrait y avoir une erreur si les fichiers de configuration n'existent pas;
|
||||
|
||||
:::
|
||||
|
||||
Vous devrez ensuite ajouter vos méthodes pour intéragir avec le `SwerveDrive` dans le subsystem.
|
||||
|
||||
```java
|
||||
swerveDrive.drive(new Translation2d(
|
||||
translationX.getAsDouble() * swerveDrive.getMaximumVelocity(),
|
||||
translationY.getAsDouble() * swerveDrive.getMaximumVelocity()),
|
||||
angularRotationX.getAsDouble() * swerveDrive.getMaximumAngularVelocity(),
|
||||
true,
|
||||
false);
|
||||
```
|
Reference in New Issue
Block a user