From b8067f560899771e166c988828016f46a7586011 Mon Sep 17 00:00:00 2001 From: John Welsh Date: Mon, 18 Jul 2022 15:01:43 -0700 Subject: [PATCH 1/5] Added native system setup instructions --- docs/software_setup/native_setup.md | 160 ++++++++++++++++++++++++++++ mkdocs.yml | 1 + 2 files changed, 161 insertions(+) create mode 100644 docs/software_setup/native_setup.md diff --git a/docs/software_setup/native_setup.md b/docs/software_setup/native_setup.md new file mode 100644 index 00000000..62fd1675 --- /dev/null +++ b/docs/software_setup/native_setup.md @@ -0,0 +1,160 @@ +# Native JetBot Setup (without Docker) + +This page details how you can configure your Jetson system to use JetBot without Docker. This is handy when you want to prototype without worrying about docker semantics, or have other reasons to work outside of a docker environment + +> If you see any issues with these instructions or have any questions, please feel free to open an issue on github [here](https://github.com/NVIDIA-AI-IOT/jetbot/issues). + +## Instructions + +### Step 1 - Install dependencies +1. Install NVIDIA JetPack, including NVIDIA TensorRT following [these instructions](https://developer.nvidia.com/embedded/jetpack). +2. Install PyTorch following [this guide](https://forums.developer.nvidia.com/t/pytorch-for-jetson-version-1-11-now-available/72048) provided on the NVIDIA devtalk forums. +3. Install Node JS to support Jupyter Lab + + ```bash + curl -sL https://deb.nodesource.com/setup_10.x | bash - + sudo apt-get install -y nodejs libffi-dev + ``` + +4. Install Jupyter Lab to support web-programming JetBot + + ```bash + sudo python3 -m pip install jupyter jupyterlab + jupyter labextension install @jupyter-widgets/jupyterlab-manager + ``` + +5. Install Jupyter Clickable Image widget (to support road following example). + + ```bash + sudo apt-get install -y libssl1.0-dev && \ + git clone https://github.com/jaybdub/jupyter_clickable_image_widget && \ + cd jupyter_clickable_image_widget && \ + git checkout tags/v0.1 && \ + sudo pip3 install -e . && \ + jupyter labextension install js && \ + jupyter lab build + cd .. + ``` + +6. Install other miscellaneous dependencies + + ```bash + sudo apt-get update && apt-get install -y supervisor unzip + sudo apt install -y python3-smbus && pip3 install pyzmq + ``` + +7. (optional) Install torch2trt to support TensorRT accelerated AI models + + ```bash + git clone https://github.com/NVIDIA-AI-IOT/torch2trt + cd torch2trt + python3 setup.py install + cd .. + ``` + +8. Install the JetBot Python package + + ```bash + git clone https://github.com/NVIDIA-AI-IOT/jetbot + cd jetbot + sudo python3 setup.py install + # if you plan to modify the jetbot python package, call this instead: sudo python3 setup.py develop + + ``` + + +### Step 2 - Set the Jupyter lab password + +Call the following from a terminal +```bash +jupyter notebook password +# enter password +``` + +You could now test the JetBot notebooks by running + +```bash +cd jetbot +jupyter lab --ip=0.0.0.0 --no-browser --allow-root +``` + +and then navigating to ``https://:8888`` and signing in with the password you set. + +However, it is convenient to have this server start automatically, which we will detail next. + +### Step 3 - Create a system service to start the Jupyter Lab server at boot + +1. Create file named ``jetbot_jupyter.service`` and add the following content. + + ```bash + [Unit] + Description=Jupyter Notebook + + [Service] + Type=simple + User=jetson + ExecStart=/bin/sh -c "jupyter lab --ip=0.0.0.0 --no-browser --allow-root" + WorkingDirectory=/home/jetson + Restart=Always + + [Install] + WantedBy=multi-user.target + ``` + + > Note: If you have a username other than "jetson" or want to launch Jupyter from a directory other than "/home/jetson", modify the file "User" and "WorkingDirectory" fields accordingly. + +2. Copy the file to the directory ``/etc/systemd/system`` so it can be discovered as a system service. + + ```bash + sudo cp jetbot_jupyter.service /etc/systemd/system/jetbot_jupyter.service + ``` + +3. Enable the system service to run at boot + + ```bash + sudo systemctl enable jetbot_jupyter + ``` + +Now, when you re-boot your Jetson, the Jupyter lab server should start in the background. + +That's great, but in order to connect to the server, you need to know it's IP address. The last step will be to enable a system service that displays the IP address on the JetBot's PiOLED display upon boot. + + +### Step 4 - Create system service to show the IP address upon boot + +This is very similar to creating a service for the Jupyter Lab server, we're just changing the application that's launched + +1. Create a file named ``jetbot_display.service`` and add the following content. + + ```bash + [Unit] + Description=Jupyter Notebook + + [Service] + Type=simple + User=jetson + ExecStart=/bin/sh -c "python3 -m jetbot.apps.stats" + WorkingDirectory=/home/jetson + Restart=Always + + [Install] + WantedBy=multi-user.target + ``` + +2. Copy the file to the directory ``/etc/systemd/system`` so it can be discovered as a system service. + + ```bash + sudo cp jetbot_display.service /etc/systemd/system/jetbot_display.service + ``` + +3. Enable the system service to run at boot + + ```bash + sudo systemctl enable jetbot_display + ``` + +That's it! Now you should be able to reboot the JetBot, and it's IP address should automatically show up on the PiOLED display. + +We hope this helps you create a custom native system configuration for using JetBot. If you have any questions or see any issues with this guide, please [create an issue on GitHub](https://github.com/NVIDIA-AI-IOT/jetbot/issues). + +Happy hacking! \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index e66be720..e4c1c827 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -40,6 +40,7 @@ nav: - Software Setup: - Using SD Card Image: software_setup/sd_card.md - Using Docker Container: software_setup/docker.md + - Native setup from scratch (No docker): software_setup/native_setup.md - Examples: - Basic Motion: examples/basic_motion.md - Teleoperation: examples/teleoperation.md From b9c3bb98d4890e781466b9ad9eaf4b115b6e18f3 Mon Sep 17 00:00:00 2001 From: John Welsh Date: Mon, 18 Jul 2022 15:35:53 -0700 Subject: [PATCH 2/5] add deploy docs gh workflow --- .github/workflows/deploy_docs.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/deploy_docs.yml diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml new file mode 100644 index 00000000..908edb88 --- /dev/null +++ b/.github/workflows/deploy_docs.yml @@ -0,0 +1,17 @@ +name: deploy_docs +on: + push: + branches: + - master + - main + - native-system-setup-instructions +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.x + - run: pip install mkdocs-material mike + - run: mike deploy ${GITHUB_REF##*/} --push \ No newline at end of file From d4c5dff9389950eea9c446db673d762bbbe94033 Mon Sep 17 00:00:00 2001 From: John Welsh Date: Mon, 18 Jul 2022 15:37:35 -0700 Subject: [PATCH 3/5] add mkdocs build w.o push --- .github/workflows/deploy_docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml index 908edb88..e6ce87a6 100644 --- a/.github/workflows/deploy_docs.yml +++ b/.github/workflows/deploy_docs.yml @@ -14,4 +14,4 @@ jobs: with: python-version: 3.x - run: pip install mkdocs-material mike - - run: mike deploy ${GITHUB_REF##*/} --push \ No newline at end of file + - run: mike deploy ${GITHUB_REF##*/} \ No newline at end of file From 65e45094f08917ad753439704a793c4553b1ed61 Mon Sep 17 00:00:00 2001 From: John Welsh Date: Mon, 18 Jul 2022 16:10:45 -0700 Subject: [PATCH 4/5] add action username / email --- .github/workflows/deploy_docs.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml index e6ce87a6..5472147f 100644 --- a/.github/workflows/deploy_docs.yml +++ b/.github/workflows/deploy_docs.yml @@ -13,5 +13,7 @@ jobs: - uses: actions/setup-python@v2 with: python-version: 3.x + - run: git config --global user.name "GitHub Action" + - run: git config --global user.email "action@github.com" - run: pip install mkdocs-material mike - - run: mike deploy ${GITHUB_REF##*/} \ No newline at end of file + - run: mike deploy ${GITHUB_REF##*/} --push \ No newline at end of file From d4c36a1f0cadc49f547d9acc33a6646f1f3eaa54 Mon Sep 17 00:00:00 2001 From: John Welsh Date: Mon, 18 Jul 2022 16:12:08 -0700 Subject: [PATCH 5/5] add fetch --- .github/workflows/deploy_docs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml index 5472147f..579e0fc8 100644 --- a/.github/workflows/deploy_docs.yml +++ b/.github/workflows/deploy_docs.yml @@ -13,6 +13,7 @@ jobs: - uses: actions/setup-python@v2 with: python-version: 3.x + - run: git fetch - run: git config --global user.name "GitHub Action" - run: git config --global user.email "action@github.com" - run: pip install mkdocs-material mike