From 5e9c24a1573a2571b6ae51e80bc6e500d5c63dae Mon Sep 17 00:00:00 2001 From: KiraYang3 Date: Thu, 17 Oct 2024 01:35:31 +0000 Subject: [PATCH 1/3] Get the rov ip from the .env file for the index.html file --- .env | 2 +- ui/launch/surface_launch.yaml | 8 ++++---- ui/src/app.py | 5 ++++- ui/src/templates/index.html | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.env b/.env index f9714fa..a34590d 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ -ROV_IP="192.168.1.11" +ROV_IP="192.168.1.3" ROV_USERNAME="pi" ROV_PASSWORD="pie" diff --git a/ui/launch/surface_launch.yaml b/ui/launch/surface_launch.yaml index cbf0853..c2efc36 100644 --- a/ui/launch/surface_launch.yaml +++ b/ui/launch/surface_launch.yaml @@ -5,7 +5,7 @@ launch: exec: app.py namespace: rov -- node: - pkg: gamepad - exec: sender.py - namespace: rov \ No newline at end of file +# - node: +# pkg: gamepad +# exec: sender.py +# namespace: rov \ No newline at end of file diff --git a/ui/src/app.py b/ui/src/app.py index 8d3de7f..7e2623c 100644 --- a/ui/src/app.py +++ b/ui/src/app.py @@ -6,14 +6,17 @@ from signal_handler import SignalHandler import rclpy import signal +from dotenv import load_dotenv app = Flask(__name__) +load_dotenv(dotenv_path=f"/workspaces/X17-Surface/.env") @app.route('/') def index(): - return render_template('index.html') + rov_ip = os.getenv("ROV_IP") + return render_template('index.html', rov_ip=rov_ip) def initialize_frontend_nodes(): diff --git a/ui/src/templates/index.html b/ui/src/templates/index.html index e29dc9e..4160790 100644 --- a/ui/src/templates/index.html +++ b/ui/src/templates/index.html @@ -11,8 +11,8 @@ 2. Change only the IP address, the port REMAINS 8889 3. Delete the extra camera output frames if duplicates --> - - + + \ No newline at end of file From 2f0f55ce502f4138780a285e6dd56f4cd0473fc2 Mon Sep 17 00:00:00 2001 From: ethanburmane Date: Thu, 17 Oct 2024 22:24:13 +0000 Subject: [PATCH 2/3] sending rov ip to index.html --- ui/src/app.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/src/app.py b/ui/src/app.py index 7e2623c..1c085e3 100644 --- a/ui/src/app.py +++ b/ui/src/app.py @@ -13,7 +13,7 @@ load_dotenv(dotenv_path=f"/workspaces/X17-Surface/.env") -@app.route('/') +@app.route("/") def index(): rov_ip = os.getenv("ROV_IP") return render_template('index.html', rov_ip=rov_ip) @@ -25,7 +25,7 @@ def initialize_frontend_nodes(): Returns the node object """ rclpy.init() - node = rclpy.create_node('flask_server') + node = rclpy.create_node("flask_server") node.get_logger().info("Flask server started") return node @@ -72,4 +72,5 @@ def establish_camera_streams(node, rov_connection): signal_handler = SignalHandler(node, rov_connection, streams) signal.signal(signal.SIGINT, signal_handler.close_application) - app.run(host='0.0.0.0', port=5000) \ No newline at end of file + app.run(host='0.0.0.0', port=5000) + From 526932f833e29255099b6114c56363a73f1a9648 Mon Sep 17 00:00:00 2001 From: ethanburmane Date: Thu, 17 Oct 2024 22:30:15 +0000 Subject: [PATCH 3/3] restoring files --- .../workflows/{manual.yml => build_test.yml} | 4 +- .github/workflows/python_linter.yml | 42 +++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) rename .github/workflows/{manual.yml => build_test.yml} (97%) create mode 100644 .github/workflows/python_linter.yml diff --git a/.github/workflows/manual.yml b/.github/workflows/build_test.yml similarity index 97% rename from .github/workflows/manual.yml rename to .github/workflows/build_test.yml index dd15207..ac83256 100644 --- a/.github/workflows/manual.yml +++ b/.github/workflows/build_test.yml @@ -5,10 +5,10 @@ name: X17-Surface Build Test on: push: branches: - - main + - master pull_request: branches: - - main + - master workflow_dispatch: jobs: diff --git a/.github/workflows/python_linter.yml b/.github/workflows/python_linter.yml new file mode 100644 index 0000000..1145353 --- /dev/null +++ b/.github/workflows/python_linter.yml @@ -0,0 +1,42 @@ +name: X17-Surface Python Linter + +# Controls when the action will run. +# Workflow runs when manually triggered using the UI, or when a push or pull request is made to the main branch +on: + push: + branches: + - master + workflow_dispatch: + +permissions: + contents: write # Grant write access to repository contents + +jobs: + format: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install Black + run: | + python -m pip install --upgrade pip + pip install black + + - name: Run Black to format code + run: black . + + - name: Commit changes if there are any + run: | + git config --local user.name "GitHub Action" + git config --local user.email "action@github.com" + git diff --exit-code || (git add . && git commit -m "Auto-format code using Black" && git push) + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use GitHub token for authentication +