Inspired by NVIDIA dw_ros & leo-drive drivers.
- In this documentation and in the source 'interface' designates the HFM connector, and 'link' the number of the FAKRA Z. See here .
- In this documentation host relates to the Ubuntu 18.04 computer used to build the driver. Target refers to the Nvidia Drive system.
- Compatible with Driveworks 3.5.
- Compatible with ROS Melodic.
- Tested with Sekonix GMSL SF3324 and SF3325 cameras.
- Ubuntu 18.04.
- Nvidia GPU drivers:
sudo apt install nvidia-driver-470
- NVIDIA DRIVE™ OS 5.2.0 and DriveWorks 3.5 (Linux):
- Follow the download page to install NVIDIA DRIVE™ OS 5.2.0 and DriveWorks 3.5 (Linux). Follow the 'DriveWorks 3.5 Installation Guide'.
It is not possible to build directly on the target, we must crosscompile the driver on the host.
Export env variables pointing to the PDK and to the built image SYSROOT (These paths might change on your system):
PDK=$HOME/nvidia/nvidia_sdk/DRIVE_OS_5.2.0_SDK_Linux_OS_DRIVE_AGX_XAVIER/DRIVEOS/drive-t186ref-linux
SYSROOT=$PDK/targetfs
cd $SYSROOT
sudo apt install qemu-user-static
sudo cp /usr/bin/qemu-aarch64-static usr/bin
sudo cp -b /etc/resolv.conf etc
sudo mount -o bind /dev dev
sudo mount -o bind /proc proc
sudo mount -o bind /sys sys
sudo LC_ALL=C chroot .
# apt update
# apt install libboost-all-dev libtinyxml-dev libtinyxml2-dev liblz4-dev libbz2-dev libapr1 libaprutil1 libconsole-bridge-dev libpoco-dev libgpgme-dev python-defusedxml python-rospkg python-catkin-pkg python-netifaces liblog4cxx-dev libopenblas-dev libgflags-dev libglew-dev libopencv-dev
# exit
sudo umount sys proc dev
sudo rm usr/bin/qemu-aarch64-static
sudo mv etc/resolv.conf~ etc/resolv.conf
sudo rm -rf var/lib/apt/lists/*
sudo rm -rf dev/*
sudo rm -rf var/log/*
sudo rm -rf var/tmp/*
sudo rm -rf var/cache/apt/archives/*.deb
sudo rm -rf tmp/*
The broken symlinks can be fixed temporarily with overlays, using commands similar to the following:
sudo mkdir /lib/aarch64-linux-gnu
sudo mkdir /tmp/ros-cc-overlayfs
sudo mount -t overlay -o lowerdir=$SYSROOT/lib/aarch64-linux-gnu,upperdir=/lib/aarch64-linux-gnu,workdir=/tmp/ros-cc-overlayfs overlay /lib/aarch64-linux-gnu
- Follow this page to set up your
sources.list
and set up your keys. - Follow this page to install bootstrap dependencies and initialize rosdep.
- Run below commands to download source of ROS Melodic Morenia (Ubuntu 18.04 is the target root file system of DRIVE OS
Linux 5.2.0).
mkdir -p ~/ros_catkin_ws/src && cd ~/ros_catkin_ws rosinstall_generator ros_comm sensor_msgs camera_info_manager cv_bridge image_transport nodelet roscpp std_msgs --rosdistro melodic --deps --tar > melodic-ros_comm.rosinstall vcs import src < melodic-ros_comm.rosinstall
git clone https://github.com/UT-ADL/nvidia_gmsl_driver_ros.git src/nvidia_gmsl_driver_ros
rosdep install --from-paths src --ignore-src -r -y
rosdep install -si --reinstall --from-path src
Install the displayed dependencies on the emulated sysroot with apt install
.
sudo apt install python-numpy libyaml-cpp-dev python-empy
src/catkin/bin/catkin_make_isolated \
-DCMAKE_BUILD_TYPE=Release \
-DVIBRANTE_PDK:STRING=$PDK \
-DTRT_VERSION:STRING=6.3.1.3 \
-DCMAKE_TOOLCHAIN_FILE="$HOME/ros_catkin_ws/src/nvidia_gmsl_driver_ros/Toolchain-V5L.cmake" \
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/driveworks/targets/aarch64-Linux/lib -Wl,-rpath,/usr/local/driveworks/targets/aarch64-Linux/lib -L$SYSROOT/usr/local/cuda-10.2/targets/aarch64-linux/lib -Wl,-rpath,$SYSROOT/usr/local/cuda-10.2/targets/aarch64-linux/lib -L$SYSROOT/usr/lib/aarch64-linux-gnu/openblas -Wl,-rpath,$SYSROOT/usr/lib/aarch64-linux-gnu/openblas" \
--install
Replace with the current installation path with the binary installation path, so we can run any binary installed packages on the target.
sed -i "s#$HOME/ros_catkin_ws/install_isolated#/opt/ros/melodic#g" install_isolated/_setup_util.py
Follow http://wiki.ros.org/melodic/Installation/Ubuntu to install ROS necessary apt packages via below command
sudo apt install ros-melodic-ros-base ros-melodic-image-view
Install the same dependencies as we have installed on the emulated sysroot :
apt install libboost-all-dev libtinyxml-dev libtinyxml2-dev liblz4-dev libbz2-dev libapr1 libaprutil1 libconsole-bridge-dev libpoco-dev libgpgme-dev python-defusedxml python-rospkg python-catkin-pkg python-netifaces liblog4cxx-dev libopenblas-dev libgflags-dev libglew-dev libopencv-dev
Transfer the compiled workspace from the host to the target.
Install the dependancies with rosdep :
rosdep install --from-paths src --ignore-src -r -y
(The detailed reason is detailed in this post).
rm /usr/lib/libxerces-c*
source ~/install_isolated/setup.bash
In case you need to make changes to ports.yaml
:
- Copy the config file
ports.yaml
to your workspace. - Edit the config file
ports.yaml
to your need. - Pass its path to the launchfile into the
config_path
param .
This driver doesn't use the native nvidia RIG calibration file. It uses the ROS ones.
To calibrate the cameras :
- Run the driver with an empty calibration dir.
- Use ROS camera_calibration to calibrate the cameras.
- Put the camera calibration yaml files in your calib dir. Pass its path to the launchfile into the
calib_dir_path
param .
Note : In the calibration dir the calibration files MUST have this syntax : interface<a-d>_link<0-3>.yaml
. For
example : interfacea_link1.yaml
.
roslaunch nvidia_gmsl_driver_ros nvidia_gmsl_driver_ros.launch
Parameter | Default | Comment |
---|---|---|
config_path |
$(dirname)/../config/ports.yaml |
Path to the config file. |
calib_dir_path |
$(dirname)/../calib/ |
Path to the camera calibration directory. |
framerate |
30 |
Output framerate. |
verbose |
False |
Enables verbose output. |
encoder |
jpg |
Encoder. Possible values: { jpg , h264 , h265 , vp9 } |
bitrate |
8000000 |
Output bitrate (Minimum 30000 ).Only for encoder in {h264 , h265 , vp9 }. |
output_width |
1920 |
Output width. |
output_height |
1208 |
Output height. |