From ff2f29afb6ac1f06b549f09a45523f347e7526d4 Mon Sep 17 00:00:00 2001 From: Rajat Singhal Date: Thu, 17 Dec 2020 11:32:18 +0530 Subject: [PATCH 1/4] Add Actions script to build and deploy to gh-pages --- .github/workflows/test_docs.yml | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/test_docs.yml diff --git a/.github/workflows/test_docs.yml b/.github/workflows/test_docs.yml new file mode 100644 index 0000000000..2499bc89db --- /dev/null +++ b/.github/workflows/test_docs.yml @@ -0,0 +1,47 @@ +name: Documentation Build & Deploy + +# Controls when the action will run. +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.7' + architecture: 'x64' + + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install mkdocs pymdown-extensions # Mkdocs requirements + + - name: Build API reference docs + run: | + python3 -m venv .env # Virtual env to avoid dep. issues + source .env/bin/activate + pip install Sphinx sphinx_rtd_theme numpy msgpack-rpc-python + + pushd PythonClient >/dev/null + ./build_api_docs.sh + popd >/dev/null + cp -r PythonClient/docs/_build docs/api_docs/ # Copy generated files + + deactivate + + - name: Build AirSim Documentation + run: ./build_docs.sh + + # Only on commits to 'master' branch + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + with: + github_token: $ + publish_dir: ./build_docs + From 66faf9c9d160dcae073846e8ace6276c6aa924b0 Mon Sep 17 00:00:00 2001 From: Rajat Singhal Date: Thu, 17 Dec 2020 12:10:37 +0530 Subject: [PATCH 2/4] PythonClient: Only import cv2 when required --- PythonClient/airsim/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PythonClient/airsim/utils.py b/PythonClient/airsim/utils.py index 665921db24..7f866d7d0a 100644 --- a/PythonClient/airsim/utils.py +++ b/PythonClient/airsim/utils.py @@ -6,7 +6,6 @@ import inspect import types import re -import cv2 # pip install opencv-python import logging from .types import * @@ -202,6 +201,8 @@ def write_pfm(file, image, scale=1): def write_png(filename, image): """ image must be numpy array H X W X channels """ + import cv2 # pip install opencv-python + ret = cv2.imwrite(filename, image) if not ret: logging.error(f"Writing PNG file {filename} failed") From 512d7082056a60d665aaece1d9de62b002284eac Mon Sep 17 00:00:00 2001 From: Rajat Singhal Date: Thu, 17 Dec 2020 12:24:06 +0530 Subject: [PATCH 3/4] Update build_api_docs.sh script --- PythonClient/build_api_docs.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PythonClient/build_api_docs.sh b/PythonClient/build_api_docs.sh index 548e7d9517..382c3122b7 100755 --- a/PythonClient/build_api_docs.sh +++ b/PythonClient/build_api_docs.sh @@ -1,2 +1,4 @@ -cd docs; -make html; +#!/bin/sh + +cd docs +make html From 05acb49c587b1ee4f1aa268a1e46399abb5ad82b Mon Sep 17 00:00:00 2001 From: Rajat Singhal Date: Thu, 17 Dec 2020 16:51:54 +0530 Subject: [PATCH 4/4] PythonClient: Update simCreateVoxelGrid docstring --- PythonClient/airsim/client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PythonClient/airsim/client.py b/PythonClient/airsim/client.py index 4509b8fc46..30334213f5 100644 --- a/PythonClient/airsim/client.py +++ b/PythonClient/airsim/client.py @@ -796,10 +796,12 @@ def simCreateVoxelGrid(self, position, x, y, z, res, of): Args: position (Vector3r): Position around which voxel grid is centered in m - x, y, z (float): Size of each voxel grid dimension in m + x, y, z (int): Size of each voxel grid dimension in m res (float): Resolution of voxel grid in m of (str): Name of output file to save voxel grid as + Returns: + bool: True if output written to file successfully, else False """ return self.client.call('simCreateVoxelGrid', position, x, y, z, res, of)