This section is added to provide instructions regarding the extra steps required to setup docker images on Jetson Nano that can work with PX4 autopilot hardware e.g. Pixhawk.
Dockerfile.ros.melodic.px4
: Adds MAVROS and some extra confgiurations to prepare the docker image to work with PX4-supported autopilot hardwarescripts/docker_build_ros_px4.sh
: BuildsDockerfile.ros.melodic.px4
scripts/docker_run_px4.sh
provides a convenience script to run docker containers fromDockerfile.ros.melodic.px4
scripts/setup_jetson.sh
: A convenience script to install everything on a jetson nano.scripts/installRealsenseUdev.md
Installs the required udev rules for Intel D435 depth cameras. This is required before using te camera inside a docker container.
- Clone this package to your
~/src/
foldercd ~/src git clone https://github.com/mzahana/jetson-containers.git
- Execute the setup script,
./setup_jetson.sh
cd ~/src/jetson-containers/scripts/
./setup_jetson.sh
- Reboot your Jetson after the setup is completed
- The setup script creates an alias in the
$HOME/.bashrc
file. The alias is namedpx4_container
. You can execute this alias in a terminal and you will be logged into the container with username (and password)riot
. - Setup instruction for Jetson Nano 4G shield can be found here
- Follow the instructions in the above page to setup the 4G shield
- Before executing
sudo dhclient -1 -v wwan0
to allocate an IP, you may need to set the APN as described in this issue. Basically, you will need to send the AT commandAT+CGDCONT=1,"IP","inet.bell.ca"
.inet.bell.ca
is the APN. Make sure that you find the right APN for your 4G service provider.
The docker container has MAVROS package which can be used to communicate with PX4 as follows
- Connect the serial port
/dev/ttyTHS1
(pins 6-GND, 8-TX, 10-RX), reference, to Pixhawk serial port, usuallyTELEM2
- Configure the serial port on Pixhawk, reference. Use Baud rate of
500000
as921600
baudrate is not supported in the default Jetson kernel. On Xavier NX, you can use 921600 baudrate - In the docker container terminal, launch a MAVROS node to establish the communication
roslaunch mavros px4.launch fcu_url:=/dev/ttyTHS1:500000
NOTE: The following sections are from the original repo
Hosted on NVIDIA GPU Cloud (NGC) are the following Docker container images for machine learning on Jetson:
Dockerfiles are also provided for the following containers, which can be built for JetPack 4.4 or newer:
- ROS Melodic (
ros:melodic-ros-base-l4t-r32.4.4
) - ROS Noetic (
ros:noetic-ros-base-l4t-r32.4.4
) - ROS2 Eloquent (
ros:eloquent-ros-base-l4t-r32.4.4
) - ROS2 Foxy (
ros:foxy-ros-base-l4t-r32.4.4
)
Below are the instructions to build and test the containers using the included Dockerfiles.
To enable access to the CUDA compiler (nvcc) during docker build
operations, add "default-runtime": "nvidia"
to your /etc/docker/daemon.json
configuration file before attempting to build the containers:
{
"runtimes": {
"nvidia": {
"path": "nvidia-container-runtime",
"runtimeArgs": []
}
},
"default-runtime": "nvidia"
}
You will then want to restart the Docker service or reboot your system before proceeding.
To rebuild the containers from a Jetson device running JetPack 4.4 or newer, first clone this repo:
$ git clone https://github.com/dusty-nv/jetson-containers
$ cd jetson-containers
To build the ML containers (l4t-pytorch
, l4t-tensorflow
, l4t-ml
), use scripts/docker_build_ml.sh
- along with an optional argument of which container(s) to build:
$ ./scripts/docker_build_ml.sh all # build all: l4t-pytorch, l4t-tensorflow, and l4t-ml
$ ./scripts/docker_build_ml.sh pytorch # build only l4t-pytorch
$ ./scripts/docker_build_ml.sh tensorflow # build only l4t-tensorflow
You have to build
l4t-pytorch
andl4t-tensorflow
to buildl4t-ml
, because it uses those base containers in the multi-stage build.
Note that the TensorFlow and PyTorch pip wheel installers for aarch64 are automatically downloaded in the Dockerfiles from the Jetson Zoo.
To build the ROS containers, use scripts/docker_build_ros.sh
with the name of the ROS distro to build:
$ ./scripts/docker_build_ros.sh all # build all: melodic, noetic, eloquent, foxy
$ ./scripts/docker_build_ros.sh melodic # build only melodic
$ ./scripts/docker_build_ros.sh noetic # build only noetic
$ ./scripts/docker_build_ros.sh eloquent # build only eloquent
$ ./scripts/docker_build_ros.sh foxy # build only foxy
Note that ROS Noetic and ROS2 Foxy are built from source for Ubuntu 18.04, while ROS Melodic and ROS2 Eloquent are installed from Debian packages into the containers.
To run a series of automated tests on the packages installed in the containers, run the following from your jetson-containers
directory:
$ ./scripts/docker_test_ml.sh all # test all: l4t-pytorch, l4t-tensorflow, and l4t-ml
$ ./scripts/docker_test_ml.sh pytorch # test only l4t-pytorch
$ ./scripts/docker_test_ml.sh tensorflow # test only l4t-tensorflow
To test ROS:
$ ./scripts/docker_test_ros.sh all # build all: melodic, noetic, eloquent, foxy
$ ./scripts/docker_test_ros.sh melodic # build only melodic
$ ./scripts/docker_test_ros.sh noetic # build only noetic
$ ./scripts/docker_test_ros.sh eloquent # build only eloquent
$ ./scripts/docker_test_ros.sh foxy # build only foxy