forked from iRobotEducation/create3_docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
240 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# IPython Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# virtualenv | ||
venv/ | ||
ENV/ | ||
|
||
# MkDocs documentation | ||
site/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions | ||
# are met: | ||
# * Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# * Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# * Neither the name of NVIDIA CORPORATION nor the names of its | ||
# contributors may be used to endorse or promote products derived | ||
# from this software without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY | ||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
script_dir="$(cd "$(dirname "$0")" && pwd)" | ||
. "${script_dir}/nv-l4t-usb-device-mode-config.sh" | ||
|
||
if [ -f "${script_dir}/IP_ADDRESS_FOR_CREATE3_ROBOT.conf" ]; then | ||
robot_ip_conf_file=${script_dir}/IP_ADDRESS_FOR_CREATE3_ROBOT.conf | ||
cat $robot_ip_conf_file | ||
fi | ||
|
||
/sbin/ifconfig l4tbr0 up | ||
# The interface might lose the address when down. Add it here to make sure | ||
# it's configured. | ||
/sbin/ifconfig l4tbr0 ${net_ip} netmask ${net_mask} | ||
/sbin/ifconfig l4tbr0 add ${net_ipv6} | ||
|
||
# IF the config file for iRobot Create3 (IP_ADDRESS_FOR_CREATE3_ROBOT.conf) exists, | ||
# then apply the static IP address (192.168.186.3), instead of enabling DHCP server | ||
if [ -n "$robot_ip_conf_file" ]; then | ||
static_ip_for_robot=`cat $robot_ip_conf_file` | ||
/sbin/ifconfig l4tbr0 $static_ip_for_robot netmask 255.255.255.0 broadcast 192.168.186.255 | ||
echo "Static IP address set to $static_ip_for_robot" | ||
else | ||
|
||
# Start a DHCP server so that connected systems automatically receive an IP | ||
# address. This avoids users having to manually configure the connection, and | ||
# also prevents Network Manager on Linux from destroying any manually applied | ||
# configuration. | ||
# | ||
# The DHCP server must be started here, because it won't start if it's told to | ||
# run on an interface that's down. | ||
if [ -n "${net_dhcp_start}" ]; then | ||
echo "### IN" | ||
dhcpd_conf="${script_dir}/dhcpd.conf" | ||
dhcpd_leases="/run/l4t-usb-devmode-dhcpd.leases" | ||
dhcpd_pid="/run/l4t-usb-devmode-dhcpd.pid" | ||
cat > "${dhcpd_conf}" <<ENDOFHERE | ||
max-lease-time ${net_dhcp_lease_time}; | ||
default-lease-time ${net_dhcp_lease_time}; | ||
subnet ${net_net} netmask ${net_mask} { | ||
range ${net_dhcp_start} ${net_dhcp_end}; | ||
} | ||
ENDOFHERE | ||
rm -f "${dhcpd_leases}" | ||
touch "${dhcpd_leases}" | ||
/usr/sbin/dhcpd \ | ||
-cf "${dhcpd_conf}" \ | ||
-pf "${dhcpd_pid}" \ | ||
-lf "${dhcpd_leases}" \ | ||
l4tbr0 | ||
fi | ||
|
||
# When an interface is set to "down", all routes through it are lost, so we | ||
# must restore any routes when setting the interface to "up". | ||
if [ -n "${net_ipv4_defroute_router}" ]; then | ||
route add default gw ${net_ipv4_defroute_router} dev l4tbr0 \ | ||
${net_ipv4_defroute_metric:+metric ${net_ipv4_defroute_metric}} | ||
fi | ||
|
||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
Connect Create® 3 to NVIDIA Jetson Nano 2GB (and other variants) | ||
|
||
## Before you start | ||
!!! attention | ||
**These directions are written for someone with experience with embedded Linux and basic embedded computers.** | ||
It is highly recommended to read through the following documents before beginning: | ||
|
||
* [Getting Started with Jetson Nano 2GB Developer Kit](https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-2gb-devkit) | ||
|
||
For other Jetson platform: | ||
|
||
* [Getting Started with Jetson Nano Developer Kit](https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-devkit) | ||
* [Getting Started With Jetson Xavier NX Developer Kit](https://developer.nvidia.com/embedded/learn/get-started-jetson-xavier-nx-devkit) | ||
|
||
|
||
## Step-by-step | ||
|
||
### Getting Started Guide portion | ||
|
||
1. Download the SD card image for your Jetson platform and write onto a microSD card. | ||
|
||
2. Complete the getting started guide (listed above) until you complete the initial setup. | ||
|
||
### Alter "USB Device Mode" to apply static IP | ||
|
||
1. To alter the Jetson's "USB Device Mode" feature (specifically, disabling DHCP server and self-assign a static IP address); | ||
|
||
1. First, create a flag file to store IP address for Jetson to be used with Create3. | ||
|
||
sudo bash -c 'echo "192.168.186.3" > /opt/nvidia/l4t-usb-device-mode/IP_ADDRESS_FOR_CREATE3_ROBOT.conf' | ||
|
||
2. Then, modify the "nv-l4t-device-mode-runtime" service script (`/opt/nvidia/l4t-usb-device-mode/nv-l4t-usb-device-mode-runtime-start.sh`). The complete file is [here](data/nv-l4t-usb-device-mode-runtime-start.sh). | ||
<br> | ||
|
||
2. Connect micro-B end of the USB cable from Create3 robot to the micro-B USB port of Jetson. Then check if the static IP address is set by issuing `ifconfig` command. | ||
|
||
$ ifconfig l4tbr0 | ||
|
||
l4tbr0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 | ||
inet 192.168.186.3 netmask 255.255.255.0 broadcast 192.168.186.255 | ||
inet6 fe80::1 prefixlen 128 scopeid 0x20<link> | ||
inet6 fe80::ecb6:edff:feac:7dd5 prefixlen 64 scopeid 0x20<link> | ||
ether ee:b6:ed:ac:7d:d5 txqueuelen 1000 (Ethernet) | ||
RX packets 169 bytes 36206 (36.2 KB) | ||
RX errors 0 dropped 0 overruns 0 frame 0 | ||
TX packets 1644 bytes 213306 (213.3 KB) | ||
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | ||
|
||
|
||
!!! note | ||
If you ever want to stop using the Jetson device for Create3 and re-enable the original USB Device Mode feature (so that you can connect to your Windows PC in headless style), you can simply remove the flag file, or execute the following. | ||
|
||
sudo mv /opt/nvidia/l4t-usb-device-mode/IP_ADDRESS_FOR_CREATE3_ROBOT.conf /opt/nvidia/l4t-usb-device-mode/IP_ADDRESS_FOR_CREATE3_ROBOT.conf.bak | ||
|
||
|
||
### Start ROS2 Galactic container | ||
|
||
The recommended way to run ROS2 on Jetson is to use a pre-built Docker containers. | ||
|
||
1. Enable NVIDIA runtime for docker, if this is the first time running Docker containers on Jetson, to allow access to GPU from containers. | ||
|
||
Edit `/etc/docker/daemon.json` to be following. | ||
|
||
{ | ||
"runtimes": { | ||
"nvidia": { | ||
"path": "nvidia-container-runtime", | ||
"runtimeArgs": [] | ||
} | ||
}, | ||
"default-runtime": "nvidia" | ||
} | ||
|
||
|
||
2. Use `jetson-containers`' script to simplify the inovocation of `docker run` command. | ||
|
||
``` | ||
git clone https://github.com/dusty-nv/jetson-containers/ | ||
cd jetson-containers | ||
scripts/docker_run.sh -c dustynv/ros:galactic-ros-base-l4t-r32.6.1 | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters