140 lines
3.1 KiB
Markdown
140 lines
3.1 KiB
Markdown
# Setup with Nvidia-Jetson-Orin
|
|
|
|
Initial setup and installation of _RapidPoseTriangulation_ on a _Nvidia Jetson_ device. \
|
|
Tested with a _Jetson AGX Orin Developer Kit_ module.
|
|
|
|
<br>
|
|
|
|
## Base installation
|
|
|
|
- Install newest software image: \
|
|
(https://developer.nvidia.com/sdk-manager)
|
|
|
|
- Initialize system: \
|
|
(https://developer.nvidia.com/embedded/learn/get-started-jetson-agx-orin-devkit)
|
|
|
|
- Install basic tools:
|
|
|
|
```bash
|
|
sudo apt install -y curl nano wget git
|
|
sudo apt install -y terminator
|
|
```
|
|
|
|
- Test docker is working:
|
|
|
|
```bash
|
|
sudo docker run --rm hello-world
|
|
```
|
|
|
|
- Enable _docker_ without _sudo_: \
|
|
(https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user)
|
|
|
|
- Enable GPU-access for docker building:
|
|
|
|
Run `sudo nano /etc/docker/daemon.json` and add:
|
|
|
|
```json
|
|
{
|
|
"runtimes": {
|
|
"nvidia": {
|
|
"args": [],
|
|
"path": "nvidia-container-runtime"
|
|
}
|
|
},
|
|
"default-runtime": "nvidia"
|
|
}
|
|
```
|
|
|
|
Restart docker: `sudo systemctl restart docker`
|
|
|
|
- Install _vs-code_: \
|
|
(https://code.visualstudio.com/docs/setup/linux)
|
|
|
|
- Test docker is working:
|
|
|
|
```bash
|
|
docker run --rm hello-world
|
|
docker run -it --rm --runtime=nvidia --network=host -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix nvcr.io/nvidia/l4t-base:r36.2.0
|
|
docker run -it --rm --runtime=nvidia --network=host dustynv/onnxruntime:1.20-r36.4.0
|
|
```
|
|
|
|
- Check _cuda_ access in container:
|
|
|
|
```bash
|
|
python3 -c 'import torch; print(torch.cuda.is_available());'
|
|
```
|
|
|
|
- Enable maximum performance mode:
|
|
|
|
```bash
|
|
sudo nvpmodel -m 0
|
|
sudo jetson_clocks
|
|
```
|
|
|
|
<br>
|
|
|
|
## RPT installation
|
|
|
|
- Build docker container:
|
|
|
|
```bash
|
|
docker build --progress=plain -f extras/jetson/dockerfile -t rapidposetriangulation .
|
|
./run_container.sh
|
|
```
|
|
|
|
- Build _rpt_ package inside container:
|
|
|
|
```bash
|
|
cd /RapidPoseTriangulation/swig/ && make all && cd ../tests/ && python3 test_interface.py && cd ..
|
|
|
|
cd /RapidPoseTriangulation/scripts/ && \
|
|
g++ -std=c++2a -fPIC -O3 -march=native -Wall -Werror -flto=auto -fopenmp -fopenmp-simd \
|
|
-I /RapidPoseTriangulation/rpt/ \
|
|
-isystem /usr/include/opencv4/ \
|
|
-isystem /usr/local/include/onnxruntime/ \
|
|
-L /usr/local/lib/ \
|
|
test_skelda_dataset.cpp \
|
|
/RapidPoseTriangulation/rpt/*.cpp \
|
|
-o test_skelda_dataset.bin \
|
|
-Wl,--start-group \
|
|
-lonnxruntime_providers_tensorrt \
|
|
-lonnxruntime_providers_shared \
|
|
-lonnxruntime_providers_cuda \
|
|
-lonnxruntime \
|
|
-Wl,--end-group \
|
|
$(pkg-config --libs opencv4) \
|
|
-Wl,-rpath,/onnxruntime/build/Linux/Release/ \
|
|
&& cd ..
|
|
```
|
|
|
|
- Test with samples:
|
|
|
|
```bash
|
|
python3 /RapidPoseTriangulation/scripts/test_triangulate.py
|
|
```
|
|
|
|
- Evaluate datasets:
|
|
|
|
```bash
|
|
python3 /RapidPoseTriangulation/scripts/test_skelda_dataset.py
|
|
```
|
|
|
|
<br>
|
|
|
|
## ROS interface
|
|
|
|
- Build docker container:
|
|
|
|
```bash
|
|
docker build --progress=plain -f extras/jetson/dockerfile_ros -t rapidposetriangulation_ros .
|
|
./run_container.sh
|
|
```
|
|
|
|
- Run and test:
|
|
```bash
|
|
xhost +; docker compose -f extras/jetson/docker-compose.yml up
|
|
|
|
docker exec -it ros-test_node-1 bash
|
|
export ROS_DOMAIN_ID=18
|
|
```
|