From e7df1edbb5c60290341225a0023fbe350575223a Mon Sep 17 00:00:00 2001 From: FriedLongJohns <81837862+FriedLongJohns@users.noreply.github.com> Date: Wed, 17 May 2023 17:46:21 -0700 Subject: [PATCH 1/3] Improve arm Kd --- .../robotcode2023/Constants.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/carlmontrobotics/robotcode2023/Constants.java b/src/main/java/org/carlmontrobotics/robotcode2023/Constants.java index 54c881d5..2fd118a2 100644 --- a/src/main/java/org/carlmontrobotics/robotcode2023/Constants.java +++ b/src/main/java/org/carlmontrobotics/robotcode2023/Constants.java @@ -31,7 +31,7 @@ public final class Constants { public static final class Drivetrain { //#region Subsystem Constants - + public static final double wheelBase = Units.inchesToMeters(19.75); public static final double trackWidth = Units.inchesToMeters(28.75); // "swerveRadius" is the distance from the center of the robot to one of the modules @@ -51,10 +51,10 @@ public static final class Drivetrain { public static final double maxStrafe = maxSpeed; // seconds it takes to go from 0 to 12 volts(aka MAX) public static final double secsPer12Volts = 0.1; - - - - + + + + // maxRCW is the angular velocity of the robot. // Calculated by looking at one of the motors and treating it as a point mass moving around in a circle. // Tangential speed of this point mass is maxSpeed and the radius of the circle is sqrt((wheelBase/2)^2 + (trackWidth/2)^2) @@ -181,7 +181,7 @@ public static final class Arm { // Arm, Wrist public static double[] kP = {4.2736, 4.8804}; // 4.2736 for arm from sysid was tested and it worked fine (V / rad) public static double[] kI = {0, 0}; // (V / (rad * s) ) - public static double[] kD = {0, 0.90262}; // 0 for arm from sysid was tested and it worked fine (V / (rad / s) ) + public static double[] kD = {0.1, 0.90262}; // 0 for arm from sysid was tested and it worked fine (V / (rad / s) ) // Arm, Wrist public static double[] posToleranceRad = { .07, .07 }; // rad @@ -212,7 +212,7 @@ public static final class Arm { public static final double DT_EXTENSION_FOR_ROLLER = Units.inchesToMeters(14); // TODO: Replace these values with Design's actual values - public static final double MARGIN_OF_ERROR = Math.toRadians(10); + public static final double MARGIN_OF_ERROR = Math.PI/18; public static final double ARM_LOWER_LIMIT_RAD = -3.569 + MARGIN_OF_ERROR; public static final double ARM_UPPER_LIMIT_RAD = .36 - MARGIN_OF_ERROR; public static final double ARM_DISCONTINUITY_RAD = (ARM_LOWER_LIMIT_RAD + ARM_UPPER_LIMIT_RAD) / 2 - Math.PI; @@ -386,7 +386,7 @@ public static class RollerMode { public double speed, time; public GameObject obj; public Color ledColor; - + /** * @param speed A number between -1 and 1 * @param time Amount of time in seconds to keep the motor running after From 310221af972f1ff99b7376839e65d97581c7aaa0 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Tue, 1 Aug 2023 14:56:12 -0700 Subject: [PATCH 2/3] update codespaces files --- .devcontainer/Dockerfile | 23 ------------ .devcontainer/devcontainer.json | 47 +++++++++++-------------- .devcontainer/installWPILibExtension.sh | 7 ++++ 3 files changed, 27 insertions(+), 50 deletions(-) delete mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/installWPILibExtension.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 2ddae150..00000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -# [Choice] Java version (use -bullseye variants on local arm64/Apple Silicon): 11, 17, 11-bullseye, 17-bullseye, 11-buster, 17-buster -ARG VARIANT=11-bullseye -FROM mcr.microsoft.com/vscode/devcontainers/java:${VARIANT} - -# [Option] Install Maven -ARG INSTALL_MAVEN="false" -ARG MAVEN_VERSION="" -# [Option] Install Gradle -ARG INSTALL_GRADLE="false" -ARG GRADLE_VERSION="" -RUN if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \ - && if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi - -# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 -ARG NODE_VERSION="none" -RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi - -# [Optional] Uncomment this section to install additional OS packages. -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends - -# [Optional] Uncomment this line to install global node packages. -# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c96fe70c..9ecad411 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,46 +1,39 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/java { "name": "Java", - "build": { - "dockerfile": "Dockerfile", - "args": { - // Update the VARIANT arg to pick a Java version: 11, 17 - // Append -bullseye or -buster to pin to an OS version. - // Use the -bullseye variants on local arm64/Apple Silicon. - "VARIANT": "17-bullseye", - // Options - "INSTALL_MAVEN": "false", - "INSTALL_GRADLE": "false", - "NODE_VERSION": "lts/*" + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/java:1-17-bookworm", + + "features": { + "ghcr.io/devcontainers/features/java:1": { + "version": "none", + "installMaven": "false", + "installGradle": "true" } }, + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "", + // Configure tool-specific properties. "customizations": { - // Configure properties specific to VS Code. "vscode": { - // Set *default* container specific settings.json values on container create. - "settings": { - }, - - // Add the IDs of extensions you want installed when the container is created. "extensions": [ - "vscjava.vscode-java-pack", "redhat.java", "ms-vscode.cpptools", "vcjava.vscode-java-debug", "ms-toolsai.jupyter", - "vcjava.vscode-java-dependency", - "wpilibsuite.vscode-wpilib" + "vcjava.vscode-java-dependency" ] } }, - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "java -version", + "postAttachCommand": "./.devcontainer/installWPILibExtension.sh && exit" - // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. - "remoteUser": "vscode" + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" } diff --git a/.devcontainer/installWPILibExtension.sh b/.devcontainer/installWPILibExtension.sh new file mode 100644 index 00000000..f789b8b7 --- /dev/null +++ b/.devcontainer/installWPILibExtension.sh @@ -0,0 +1,7 @@ +# Modified from ChatGPT suggestions +WPILIB_VSIX_URL=$(curl -s "https://api.github.com/repos/wpilibsuite/vscode-wpilib/releases/latest" | jq -r '.assets[] | select(.name | test(".vsix$")) | .browser_download_url') +INSTALL_LOCATION="/tmp/wpilib-extension/latest.vsix" +echo "$WPILIB_VSIX_URL" +curl --create-dirs -L -o "$INSTALL_LOCATION" "$WPILIB_VSIX_URL" +code --install-extension "$INSTALL_LOCATION" + From 7bbc43dcea0bbbf54bbd2c2596113dd0360ea6f8 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Tue, 1 Aug 2023 22:02:40 +0000 Subject: [PATCH 3/3] make installWPILibExtension.sh executable --- .devcontainer/installWPILibExtension.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .devcontainer/installWPILibExtension.sh diff --git a/.devcontainer/installWPILibExtension.sh b/.devcontainer/installWPILibExtension.sh old mode 100644 new mode 100755