Foundationpose cpp
A TensorRT and C++ based deployment of FoundationPose, which makes integration lightweight and efficient. Supports Jetson Orin. Adapted from nvidia_isaac_pose_esitimation.
This project is adapted from [nvidia-issac-pose-estimation](https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_pose_estimation), with simplified dependencies. It enables inference using ONNX models exported from the [Python implementation](https://github.com/NVlabs/FoundationPose) of `FoundationPose`, making deployment and application highly convenient. The project is written primarily in C++, distributed under the Apache License 2.0 license, first published in 2025. Key topics include: 6d, 6dof-pose, cpp, foundationpose, pose-estimation.
Foundationpose-CPP
About this project
This project is adapted from nvidia-issac-pose-estimation, with simplified dependencies. It enables inference using ONNX models exported from the Python implementation of FoundationPose, making deployment and application highly convenient.
Notes: This repository only contains the code for the FoundationPose component. The complete 6D pose estimation pipeline also relies on object masks, which can be generated by algorithms like SAM. For reference implementations and optimized inference of MobileSAM and NanoSAM, please visit EasyDeploy.
Update LOG
[2025.04] Decoupled Register and Track processes; Output poses under mesh coordinates, providing mesh_loader interfaces for external extension. Related PR.
[2025.03] Aligned rendering process with the original Python implementation, supporting rendering without texture input. Related PR.
[2025.03] Added support for Jetson Orin platform with one-click Docker environment setup. See link.
Features
-
Removed complex environment setup and dependency issues from the original project, enabling easy integration with other projects.
-
Implemented encapsulation of the
FoundationPosealgorithm, supporting dynamic-sized image input for flexible usage.
Provided tutorial scripts for generating 3D object models using BundleSDF. -
:fire: Supports Jetson Orin development boards (Orin-NX-16GB).
Demo
Test results on public mustard dataset:
| <img src="./assets/test_foundationpose_register.png" alt="1" width="500"> |
|---|
| foundationpose(fp16) Register test result |
| <img src="./assets/test_foundationpose_track.gif" alt="1" width="500"> |
|---|
| foundationpose(fp16) Track test result |
Performance on nvidia-4060-8G and i5-12600kf:
| nvidia-4060-8G | fps | cpu | gpu |
|---|---|---|---|
| foundationpose(fp16)-Register | 2.8 | 100% | 6.5GB |
| foundationpose(fp16)-Track | 220 | 100% | 5.8GB |
Performance on jetson-orin-nx-16GB:
| jetson-orin-nx-16GB | fps | cpu | mem_total |
|---|---|---|---|
| foundationpose(fp16)-Register | 0.6 | 15% | 5.6GB(5.5GB on gpu) |
| foundationpose(fp16)-Track | 100 | 60% | 5.1GB(5.0GB on gpu) |
Usage
Environment Setup
-
Clone the repository:
bashgit clone git@github.com:zz990099/foundationpose_cpp.git cd foundationpose_cpp git submodule init git submodule update -
Build using Docker:
bashcd ${foundationpose_cpp} bash easy_deploy_tool/docker/easy_deploy_startup.sh # Select `jetson` -> `trt10_u2204`/`trt8_u2204` (`trt8_u2004` not supported) bash easy_deploy_tool/docker/into_docker.sh
Model Conversion
-
Download ONNX models from google drive and place them in
/workspace/models/. -
Convert models:
bashcd /workspace bash tools/cvt_onnx2trt.bash
Build Project
- Compile the project:
bashcd /workspace mkdir build && cd build cmake -DENABLE_TENSORRT=ON .. make -j
Run Demo
Use public Dataset Demo (mustard)
-
Download and extract the dataset to
/workspace/test_data/from here. -
Run tests:
bashcd /workspace/build ./bin/simple_tests --gtest_filter=foundationpose_test.test
Custom 3D Model Generation
-
Refer to Generating 3D Models with BundleSDF.
-
Modify paths in
/workspace/simple_tests/src/test_foundationpose.cppfor your data and rebuild. -
Run tests:
bashcd /workspace/build ./bin/simple_tests --gtest_filter=foundationpose_test.test -
Results for Register and Track processes will be saved in
/workspace/test_data/.
References
For any questions, feel free to raise a issue or contact 771647586@qq.com.
Contributors
Showing top 2 contributors by commit count.
