Getting Started - Jetson setup

From RidgeRun Developer Wiki

Follow Us On Twitter LinkedIn Email Share this page









RidgeRun Video Stabilization Library setup on Jetson

The following steps setups the neccesary dependencies in Jetpack 36.6.4.3 after flash with initrd script as explained in ICM42688 Setup.

Depedencies

Package dependencies

sudo apt update
sudo apt install automake autoconf m4
sudo apt install nvidia-l4t-jetson-multimedia-api nvidia-l4t-gstreamer
sudo apt install python3 python3-pip
sudo apt install ninja-build pkg-config

# For cal plotter
sudo apt install libboost-filesystem-dev libboost-system-dev libboost-iostreams-dev libgnuplot-iostream-dev

sudo pip3 install meson
sudo apt install libgudev-1.0-dev
sudo apt install libv4l-dev
sudo apt install lbzip2
sudo apt install cuda-toolkit-*
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-bad gstreamer1.0-plugins-good
sudo apt install nvidia-l4t-cuda
sudo usermod -aG i2c $USER

Install perf:

sudo apt install autogen -y
cd
git clone git@github.com:RidgeRun/gst-perf.git -b dev-0.4
cd gst-perf
./autogen.sh
./configure --prefix /usr/ --libdir /usr/lib/$(uname -m)-linux-gnu/
make
sudo make install
cd -

Add cuda PATH .bashrc:

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

Install gstcameradrivermeta:

cd
git clone https://gitlab.ridgerun.com/open/gstreamer/ridgerun-video-stabilization/gstcameradrivermeta.git
cd gstcameradrivermeta
make
sudo make install
sudo ldconfig

Install rrv4l2src:

cd
git clone https://gitlab.ridgerun.com/open/gstreamer/gst-v4l2src.git -b feature/add-timestamp-metadata
cd gst-v4l2src
export INSTALL_DIR=${HOME}/custom-gst-v4l2src # Add to .bashrc
mkdir -p ${INSTALL_DIR}
meson builddir --prefix=${INSTALL_DIR} --libdir=${INSTALL_DIR}/lib/$(uname -m)-linux-gnu
ninja -C builddir install
sudo ninja -C builddir install
export GST_PLUGIN_PATH=${INSTALL_DIR}/lib/aarch64-linux-gnu/gstreamer-1.0:$GST_PLUGIN_PATH # Add to .bashrc

Install custom nvarguscamerasrc:

cd
git clone https://gitlab.ridgerun.com/open/gstreamer/ridgerun-video-stabilization/gstnvarguscamerasrc
cd gstnvarguscamerasrc
git checkout jetpack-6.x
export INSTALL_DIR=${HOME}/custom-gst-nvarguscamerasrc # Add to .bashrc
export GST_INSTALL_DIR=${INSTALL_DIR}/lib/$(uname -m)-linux-gnu/gstreamer-1.0
mkdir -p ${INSTALL_DIR}/lib/$(uname -m)-linux-gnu/gstreamer-1.0
make
sudo -E make install
export GST_PLUGIN_PATH=${INSTALL_DIR}/lib/$(uname -m)-linux-gnu/gstreamer-1.0:${GST_PLUGIN_PATH} # Add to .bashrc
gst-inspect-1.0 nvarguscamerasrc

Install rvs:

cd ridgerun-video-stabilizer
meson build --optimization 3 --prefix /usr -Denable-docs=disabled -Ddeveloper-mode=false -Denable-opencl=disabled -Denable-gstreamer=enabled
ninja -C build
sudo ninja -C build install

For simplicity you can add the following to .bashrc:

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

export INSTALL_DIR=${HOME}/custom-gst-v4l2src
export GST_PLUGIN_PATH=${INSTALL_DIR}/lib/aarch64-linux-gnu/gstreamer-1.0:$GST_PLUGIN_PATH 
export INSTALL_DIR=${HOME}/custom-gst-nvarguscamerasrc
export GST_PLUGIN_PATH=${INSTALL_DIR}/lib/$(uname -m)-linux-gnu/gstreamer-1.0:${GST_PLUGIN_PATH}
export GST_PLUGIN_PATH=${INSTALL_DIR}/lib/aarch64-linux-gnu/gstreamer-1.0:$GST_PLUGIN_PATH

You can do the following to set the permissions to use the icm sensor automatically on boot.

Note: This is optional and only for ICM46288 sensor.

Add a service to set permissions on /sys virtual directory:

sudo tee /etc/systemd/system/iio-perms.service > /dev/null <<'EOF'
[Unit]
Description=Set permissions for IIO devices
After=multi-user.target
Wants=multi-user.target

[Service]
Type=oneshot
ExecStart=/bin/sh -c 'chmod -R 777 /sys/bus/iio/devices/iio:device* || true'
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
EOF

Enable the service:

sudo systemctl daemon-reload
sudo systemctl enable iio-perms.service
sudo systemctl start iio-perms.service

Create iio group and udev rule to set permission on /dev/iio:

# Create iio group
sudo groupadd -f iio

# Add current user to the group
sudo usermod -aG iio "$USER"

# apply group change:
newgrp iio

Create udev rule:

sudo tee /etc/udev/rules.d/99-iio.rules > /dev/null <<'EOF'
KERNEL=="iio:device*", SUBSYSTEM=="iio", GROUP="iio", MODE="0660"
EOF

Reload udev rules:

sudo udevadm control --reload-rules
sudo udevadm trigger --subsystem-match=iio