AprilTag Library Without the Use of Isaac SDK

Hello,

We are trying to use the c api as part of a larger application running in c/c++. We do not want to use the full sdk, as our repo is already on ROS and its build system.

One of the first goals is to integrate the AprilTag library as part of our c++ application. We found this header and library april_tag_v5.tar.gz (349.9 KB) , but wanted to confirm that this is the official library to use and import to use the AprilTag library. (Note: This libary was found at the bottom of this forum post: how to use the AprilTag GPU C/C++API outside of ISAAC - #12 by jsysteam)

Thanks for your help!

@dverstandig I am trying to use the same library on Ubuntu-20.04 CUDA-11.1 but it is crashing. Are you able to extract tags with this library? If so can you please share the sample code?

Thanks,
Sarath

The AprilTag library used by the Isaac GEM 2020.1NX can be found in //third_party/packages.bzl which is:
https://developer.nvidia.com/isaac/download/third_party/april_tags_v5_jp44_nano-tar-xz which is optimized for CUDA. Isaac 2020.1NX is intended to run on Jetpack 4.4 which contains CUDA 10.2, so it is possible that there is an issue with CUDA 11.1 perhaps. Do you happen to have any information about the crash you could post?

hi @hermals thanks for the reply. This is sample code I am trying to use with the apriltags library

#define IMG_WIDTH 300
#define IMG_HEIGHT 300
int main() {
    printf("cuda main");
    nvAprilTagsHandle handle;
    nvAprilTagsCameraIntrinsics_t cam = {647.5521240234375,  647.5521240234375,  644.7271118164062,  356.999267578125};
    int status = nvCreateAprilTagsDetector(&handle, IMG_WIDTH, IMG_HEIGHT,NVAT_TAG36H11, &cam, 0.18);
    printf("nvAprilTags created %d",status);
    nvAprilTagsDestroy(handle);
    return 0;
}

When I run this code, I get “Segmentation fault (core dumped)” with out any further error. Even the printf statements are not shown in the console. Is there a way I can get a detailed stack trace?

Also from the link you have provided looks like the library target architecture is not x86_64. Can you provide me the apriltags library which is built for x86_64 (ubuntu) ?

Your code snippet seems like it should work fine, so I am really reaching here with the following which may not help.

  1. For the initialization of nvAprilTagsCameraInstrinsics_t, make the literals explicitly floats by appending “f” to each just to be sure the compiler isn’t being induced to odd casting or sizing issues.

  2. We allocate the handle and intrinsics in a struct on the heap, not as local stack variables. This shouldn’t make a difference since the lifetime is fine, but just a difference.

The printf is getting buffered and the stream isn’t getting flushed before the crash. You can add fflush(stdout); or setbuf(stdout, NULL);" to stop buffering on stdout altogether, or fprintf to stderr instead which shouldn’t be getting buffered.

The lib_x86_64/ directory within the tar.xz file should include the proper archive for you.