diff --git a/.classpath.bak b/.classpath.bak new file mode 100644 index 00000000..03c422db --- /dev/null +++ b/.classpath.bak @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 00000000..67cc8b85 --- /dev/null +++ b/.devcontainer/README.md @@ -0,0 +1,47 @@ +# Virtual Robot Dev Container Setup + +This dev container provides a complete development environment for the Virtual Robot Simulator with: +- **Java 17** (BellSoft Liberica Full JDK with JavaFX) +- **Desktop environment** (accessible via noVNC on port 6080) +- **VS Code Java extensions** + +## Getting Started + +1. **Open in Dev Container** + - Open this folder in VS Code + - When prompted, click "Reopen in Container" (or use Command Palette: "Dev Containers: Reopen in Container") + - Wait for the container to build and setup to complete + +2. **Access the Desktop Environment** + - Once the container is running, open your browser to: `http://localhost:6080` + - Password: `vscode` + - This provides a full desktop environment where GUI applications will display + +3. **Run the Virtual Robot Application** + - In VS Code, go to Run and Debug (Cmd+Shift+D) + - Select "Launch Virtual Robot" from the dropdown + - Click the green play button or press F5 + - The application will open in the desktop environment (access via browser on port 6080) + +## Alternative: Running from Terminal + +You can also run the application from the integrated terminal: + +```bash +java --module-path $JAVA_HOME/lib \ + --add-modules javafx.controls,javafx.fxml,javafx.graphics \ + -cp Controller/src:TeamCode/src:lib/* \ + virtual_robot.controller.VirtualRobotApplication +``` + +## Project Structure + +- `Controller/src` - Main application code +- `TeamCode/src` - User-defined OpModes +- `lib/` - External dependencies + +## Notes + +- The DISPLAY environment variable is automatically set to `:1` +- JavaFX is included in the Liberica Full JDK +- Additional graphics libraries are pre-installed for GUI support diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..dc96d047 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,53 @@ +{ + "name": "Virtual Robot Simulator", + "image": "mcr.microsoft.com/devcontainers/base:debian", + + "features": { + "ghcr.io/devcontainers/features/desktop-lite:1": { + "password": "vscode", + "webPort": "6080", + "vncPort": "5901" + } + }, + + "customizations": { + "vscode": { + "extensions": [ + "vscjava.vscode-java-pack", + "vscjava.vscode-java-debug", + "redhat.java" + ], + "settings": { + "java.configuration.runtimes": [ + { + "name": "JavaSE-17", + "path": "/home/vscode/.sdkman/candidates/java/current", + "default": true + } + ], + "java.jdt.ls.java.home": "/home/vscode/.sdkman/candidates/java/current" + } + } + }, + + "forwardPorts": [6080, 5901], + "portsAttributes": { + "6080": { + "label": "Desktop (noVNC)", + "onAutoForward": "notify" + }, + "5901": { + "label": "VNC", + "onAutoForward": "ignore" + } + }, + + "postCreateCommand": "bash .devcontainer/setup.sh", + + "remoteEnv": { + "DISPLAY": ":1", + "JAVA_HOME": "/home/vscode/.sdkman/candidates/java/current" + }, + + "remoteUser": "vscode" +} diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh new file mode 100644 index 00000000..fc67a392 --- /dev/null +++ b/.devcontainer/setup.sh @@ -0,0 +1,61 @@ +#!/bin/bash +set -e + +echo "Setting up Virtual Robot development environment..." + +# Install basic dependencies first +echo "Installing system dependencies..." +sudo apt-get update +sudo apt-get install -y \ + curl \ + zip \ + unzip \ + libxrender1 \ + libxtst6 \ + libxi6 \ + libgtk-3-0 \ + x11-apps \ + libgl1-mesa-dri \ + libglx0 || true + +# Try to install libgl1-mesa-glx if available (older Debian versions) +sudo apt-get install -y libgl1-mesa-glx 2>/dev/null || true + +# Install SDKMAN if not already installed +if [ ! -d "$HOME/.sdkman" ]; then + echo "Installing SDKMAN..." + curl -s "https://get.sdkman.io" | bash +fi + +# Source SDKMAN +export SDKMAN_DIR="$HOME/.sdkman" +[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh" + +# Install Liberica 17 Full JDK (includes JavaFX) +echo "Installing BellSoft Liberica 17 Full JDK..." +sdk install java 17.0.13.fx-librca || sdk use java 17.0.13.fx-librca || true +sdk default java 17.0.13.fx-librca || true + +# Verify installation +echo "Java version:" +java -version + +# Set JAVA_HOME permanently +export JAVA_HOME="$HOME/.sdkman/candidates/java/current" +if ! grep -q "JAVA_HOME" "$HOME/.bashrc"; then + echo "export JAVA_HOME=$HOME/.sdkman/candidates/java/current" >> $HOME/.bashrc + echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> $HOME/.bashrc +fi + +# Also add to .bash_profile for login shells +if ! grep -q "JAVA_HOME" "$HOME/.bash_profile"; then + echo "export JAVA_HOME=$HOME/.sdkman/candidates/java/current" >> $HOME/.bash_profile + echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> $HOME/.bash_profile +fi + +echo "Setup complete! Java environment is ready." +echo "Java Home: $JAVA_HOME" +echo "Desktop environment will be available on port 6080 (noVNC)." +echo "You can access it at: http://localhost:6080" +echo "" +echo "To verify JavaFX is available, run: java --list-modules | grep javafx" diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..4674540a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,26 @@ +# Git +.git +.gitignore + +# IDE +.idea +*.iml +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json + +# Build outputs +out/ +*.class + +# Documentation +*.pdf +*.gif +*.jpg +*.md +!.devcontainer/*.md + +# OS +.DS_Store +Thumbs.db diff --git a/.idea/misc.xml b/.idea/misc.xml index c5967049..f3451911 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,3 +1,4 @@ + @@ -13,7 +14,7 @@ - + \ No newline at end of file diff --git a/.project.bak b/.project.bak new file mode 100644 index 00000000..b94a158b --- /dev/null +++ b/.project.bak @@ -0,0 +1,28 @@ + + + virtual_robot + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + + + 1768453886430 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..85b494ca --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,25 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "java", + "name": "Launch Virtual Robot", + "request": "launch", + "mainClass": "virtual_robot.controller.VirtualRobotApplication", + "classPaths": [ + "${workspaceFolder}/out", + "${workspaceFolder}/lib/dyn4j-4.1.4.jar", + "${workspaceFolder}/lib/guava-20.0.jar", + "${workspaceFolder}/lib/javassist-3.21.0-GA.jar", + "${workspaceFolder}/lib/reflections-0.9.11.jar", + "${workspaceFolder}/lib/RoadRunner.jar", + "${workspaceFolder}/lib/PedroPathing.jar", + "${workspaceFolder}/lib/Jamepad.jar", + "${workspaceFolder}/lib/EasyOpenCV_v1.5.0_OBJ_bundle.jar" + ], + "cwd": "${workspaceFolder}", + "console": "integratedTerminal", + "vmArgs": "-Dprism.order=sw" + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..19c0fcbf --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,27 @@ +{ + "java.project.sourcePaths": [ + "Controller/src", + "TeamCode/src", + "tmp_compile" + ], + "java.project.referencedLibraries": [ + "lib/**/*.jar" + ], + "java.project.outputPath": "out", + "java.configuration.updateBuildConfiguration": "automatic", + "java.debug.settings.forceBuildBeforeLaunch": true, + "java.configuration.runtimes": [ + { + "name": "JavaSE-17", + "path": "~/.sdkman/candidates/java/current", + "default": true + } + ], + "java.jdt.ls.java.home": "~/.sdkman/candidates/java/current", + "files.exclude": { + "**/.classpath": true, + "**/.project": true, + "**/.settings": true, + "**/.factorypath": true + } +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..169a37c4 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,23 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Verify Java Installation", + "type": "shell", + "command": "java -version && echo '' && echo 'JavaFX Modules:' && java --list-modules | grep javafx", + "presentation": { + "reveal": "always", + "panel": "new" + } + }, + { + "label": "Check DISPLAY", + "type": "shell", + "command": "echo \"DISPLAY=$DISPLAY\" && echo \"JAVA_HOME=$JAVA_HOME\"", + "presentation": { + "reveal": "always", + "panel": "new" + } + } + ] +} diff --git a/DEVCONTAINER_SETUP.md b/DEVCONTAINER_SETUP.md new file mode 100644 index 00000000..b4a10346 --- /dev/null +++ b/DEVCONTAINER_SETUP.md @@ -0,0 +1,85 @@ +# VS Code Dev Container Setup - Quick Start + +## What's Configured + +Your dev container is now configured with: +- ✅ BellSoft Liberica 17 Full JDK (with JavaFX) +- ✅ Desktop Lite feature for GUI applications +- ✅ VS Code Java extensions +- ✅ noVNC web-based desktop access + +## Starting the Dev Container + +1. **Open in VS Code** + ``` + code . + ``` + +2. **Reopen in Container** + - VS Code will prompt you to "Reopen in Container" + - Or use Command Palette (Cmd+Shift+P): "Dev Containers: Reopen in Container" + +3. **Wait for Setup** + - First time will take 5-10 minutes to: + - Download base image + - Install desktop environment + - Install Liberica JDK 17 via SDKMAN + - Install system dependencies + +## Accessing the GUI Desktop + +Once the container is running: + +1. **Open Browser** to: http://localhost:6080 +2. **Password**: `vscode` +3. **Run the application** from VS Code (F5) and it will appear in this desktop + +## Running Virtual Robot + +### Method 1: VS Code Debug (Recommended) +1. Press `F5` or go to Run & Debug +2. Select "Launch Virtual Robot" +3. View the GUI at http://localhost:6080 + +### Method 2: Terminal +```bash +cd /workspaces/virtual_robot +export JAVA_HOME=$HOME/.sdkman/candidates/java/current +java --module-path $JAVA_HOME/lib \ + --add-modules javafx.controls,javafx.fxml,javafx.graphics \ + -cp Controller/src:TeamCode/src \ + virtual_robot.controller.VirtualRobotApplication +``` + +## Verifying Installation + +Run the task "Verify Java Installation" from VS Code: +- Command Palette (Cmd+Shift+P) → "Tasks: Run Task" → "Verify Java Installation" + +Or manually: +```bash +java -version +java --list-modules | grep javafx +echo $DISPLAY +``` + +## Troubleshooting + +**GUI not showing?** +- Ensure you're accessing http://localhost:6080 +- Check that DISPLAY is set: `echo $DISPLAY` (should be `:1`) +- Restart the desktop: `sudo systemctl restart x11-common` + +**Java not found?** +- Source SDKMAN: `source ~/.sdkman/bin/sdkman-init.sh` +- Check Java: `sdk current java` + +## Next Steps + +After the container starts successfully, you can: +1. Write OpModes in `TeamCode/src/org/firstinspires/ftc/teamcode` +2. Use @TeleOp or @Autonomous annotations +3. Run and test in the virtual robot simulator +4. Access the desktop at http://localhost:6080 to see the GUI + +For more details, see `.devcontainer/README.md`