Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release ar_track_alvar into ROS Noetic? #82

Open
sloretz opened this issue Apr 23, 2020 · 27 comments
Open

Release ar_track_alvar into ROS Noetic? #82

sloretz opened this issue Apr 23, 2020 · 27 comments

Comments

@sloretz
Copy link

sloretz commented Apr 23, 2020

Would you mind releasing ar_track_alvar to ROS Noetic? It looks like all of its dependencies have been released, and recursively 14 repos need it.

I'm not sure how much work it will need. The Noetic Migration Guide or the guide about transitioning ROS packages to Python 3 may be useful.

@machinekoder
Copy link

+1

@machinekoder
Copy link

ar_track_alvar doesn't use Python, so it's only a matter of publishing the package.

@jspricke
Copy link

ar_track_alvar doesn't use Python, so it's only a matter of publishing the package.

modulo the port to OpenCV4..

@machinekoder
Copy link

machinekoder commented Aug 24, 2020

@jspricke The API changes between OpenCV3 and 4 seem trivial. Once I have noetic running here I can give it a shot.

@wmmc88
Copy link

wmmc88 commented Sep 7, 2020

@machinekoder are you still working on this?

@machinekoder
Copy link

@wmmc88 I'm going for it next week as we finally moved to noetic.

@machinekoder
Copy link

Turns out porting is not as easy as first thought. ar_track_alvar uses the long dead C API for OpenCV. So conversion to the C++ is needed along the CV3→CV4 port which is small. Moreover, there has been a deprecation of some Eigen types in noetic, which we have to keep in mind, but nothing significant either. So the core effort of porting ar_track_alvar lies in converting the OpenCV C API calls with their C++ API equivalents. Easier said than done, I couldn't find nice porting guide, so this will require some manual lookup old API and replace procedure.

@ajithcodesit
Copy link

Turns out porting is not as easy as first thought. ar_track_alvar uses the long dead C API for OpenCV. So conversion to the C++ is needed along the CV3→CV4 port which is small. Moreover, there has been a deprecation of some Eigen types in noetic, which we have to keep in mind, but nothing significant either. So the core effort of porting ar_track_alvar lies in converting the OpenCV C API calls with their C++ API equivalents. Easier said than done, I couldn't find nice porting guide, so this will require some manual lookup old API and replace procedure.

Thanks for looking into this. Have you been able to make some progress?

@machinekoder
Copy link

@ajithcodesit I'm at it. There is quite a lot cv code in there that needs to be translated.

@machinekoder
Copy link

machinekoder commented Nov 11, 2020

Here is my WIP, I already have it working: https://github.com/machinekoder/ar_track_alvar/tree/noetic-devel

There is quite some potential of reworking parts of the code aside from the port.

@wmmc88
Copy link

wmmc88 commented Dec 29, 2020

any chance this is going to get merged in and released?

@fmessmer
Copy link

fmessmer commented Jan 12, 2021

looking at the Network of this repo ros-perception/ar_track_alvar, it looks like development of this repos has diverged onto forks
is this repo still actively maintained?

@130s you have the last commit to this repo
@sniekum are you still involved?
@sloretz do you know who maintains ros-perception?

@fmessmer
Copy link

I also see that Intermodalics has a noetic-devel branch, which sees recent contributions, e.g. Intermodalics@dcc8c40

@smits what is different between your version of Intermodalics/ar_track_alvar#noetic-devel and machinekoder/ar_track_alvar#noetic-devel

are you also experiencing the "nan"-issues mentioned in machinekoder#1 (comment)?

@smits
Copy link

smits commented Jan 18, 2021

@fmessmer , I did not know of the machinekoder/ar_track_alvar#noetic-devel when I started my attempt. We're definitely not close to something that works. So I might consider taking a look at what machinekoder is doing.

@ajithcodesit
Copy link

Here is my WIP, I already have it working: https://github.com/machinekoder/ar_track_alvar/tree/noetic-devel

There is quite some potential of reworking parts of the code aside from the port.

@machinekoder I tried your WIP but I am not able to compile it with catkin_make

@chriskeraly-rios
Copy link

The machinekoder repo almost works well, however, if you look at some comments on this (unrelated) issue machinekoder#1 , you will notice that there is a problem where nan is published for a lot of the results. I have tracked down the issue and fixed this locally for individual markers by changing a few lines of code in **nodes/InvididualMarkersNoKinect.cpp**. Here is the fix (roughly line 112). Essentially the way the quaternions were retrieved didn't work properly.


     // Get the pose relative to the camera
        int id = (*(marker_detector.markers))[i].GetId();
        Pose p = (*(marker_detector.markers))[i].pose;
        double px = p.translation[0] / 100.0;
        double py = p.translation[1] / 100.0;
        double pz = p.translation[2] / 100.0;

        cv::Mat quat =cv::Mat(4, 1, CV_64F);
        p.GetQuaternion(quat);
        double qx = quat.at<double>(1,0); //p.quaternion[1]; #leaving these comments for the record of what was not working properly in machinekoder's version
        double qy = quat.at<double>(2,0); //p.quaternion[2];
        double qz = quat.at<double>(3,0); //p.quaternion[3];
        double qw = quat.at<double>(0,0); //p.quaternion[0];

I also modified the catch at the end of the callback to catch all exceptions, because I was randomly getting cv errors that would shut down the node, which was annoying.

    catch (const std::exception& e)
    {
      ROS_ERROR("Error in ar_track_alvar callback");
    }

Now the node works well (albeit it seems slower than the melodic version)

Anyways, I don't have the time to go and dig deeper at the root cause of why the quaternion retrieval failed and propose a proper pull request, but this should help anyone trying to debug it, or get it running.

@fmessmer
Copy link

@chriskeraly-rios
could you point us to proper commit/branch which contains your fix? or provide and link a pr, please - so people can build on top of your work and test it...

@chriskeraly-rios
Copy link

https://github.com/rios-ai/ar_track_alvar/tree/feature/rios_bug_fix

Here you go. As I said, this is probably not the "proper" way to fix it, but it gets the job done for what I need.

@12tbuchman
Copy link

@chriskeraly-rios @machinekoder are either of you planning to make a noetic-devel PR? I see @haraisao also has a PR for a noetic devel branch.

@cybernetchi
Copy link

Sorry for beginner question,
How to install @machinekoder 's ar_track_alvar?
Thank you

@pmusau17
Copy link

pmusau17 commented Aug 5, 2021

@cybernetchi

You can build his repo from source.

In your workspace:

$ git clone https://github.com/machinekoder/ar_track_alvar.git -b noetic-devel

Build with colcon

$ colcon build

This was referenced Aug 26, 2021
@robogeekcanada
Copy link

Thank you @pmusau17 I successfully built in ROS noetic as well.

@mysablehats
Copy link

@cybernetchi

You can build his repo from source.

In your workspace:

$ git clone https://github.com/machinekoder/ar_track_alvar.git -b noetic-devel

Build with colcon

$ colcon build

you can also just use catkin_make

@NHirose
Copy link

NHirose commented Nov 18, 2022

@machinekoder Thank you for releasing your code.
I tried your code on Ubuntu 20.04. However, I had a following error.

[ERROR] [1668810254.584122576]: Error in ar_track_alvar callback: OpenCV(4.5.4) /home/ubuntu/build_opencv/opencv/modules/core/src/matrix.cpp:250: error: (-215:Assertion failed) s >= 0 in function 'setSize'

How can I solve this issue??

@ladrians
Copy link

ladrians commented Dec 3, 2022

@NHirose I got the same error on a Jetson Xavier NX/Jetpack 5.0.2. Fore some reason I got installed OpenCV 4.5.4 and 4.2.0. Uninstalled and reinstalled noetic-desktop-full but got the same problem. In my case I added the following to force 4.2.0 usage for libopencv_core.

export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libopencv_core.so.4.2.0

Switched to this branch. There should be a better way to do it, at least this way got the job done, hope it helps on your environment, regards

@robot-WT
Copy link

robot-WT commented Jan 2, 2024

I cannot recognize the string type QR code when using ar_track_alvar, I have completed the camera calibration, and it can recognize the QR code with ID 0.

@robot-WT
Copy link

robot-WT commented Jan 2, 2024

I don’t know why this is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests