ros-perception / ar_track_alvar

AR tag tracking library for ROS
www.ros.org/wiki/ar_track_alvar
139 stars 129 forks source link

Fix invalid transform use #79

Closed dandedrick closed 7 months ago

dandedrick commented 4 years ago

When a transform lookup fails it doesn't make sense to continue to operate on the specific image data because the any calculation made using the transform will be invalid and possibly very far off. In the specific case that I investigated we were getting massive values in the pose that were causing math errors.

gstrenge commented 4 years ago

Can you explain what this invalid transform use is? I've been running into issues where the transform of the marker is being published with axes swapped around and some inverted. Is this the issue that this is resolving?

dandedrick commented 4 years ago

@gstrenge, the invalid transform comes from looking up what the transform from the camera frame to the output frame is. Without my change if the transform lookup failed it would use an uninitialized transform instead of the real one. The result of this is that while we know what the locations of the tags are relative to the camera we don't know what the position of the tags are relative to the output frame. The uninitialized values causes the location in the output frame to essentially be random depending on what values happened to previously be in the memory that was used for the transform.

In my specific case this caused the locations in the output frame to be literal lightyears away from the correct location. However the nature of uninitialized values being basically random this could result in any location at all.

One good indicator that you are hitting this issue is if you see a ros error message indicating a transform issue. My fix simply throws out cases where we can't get a good transform because we can't generate an accurate pose in the output frame. If you are hitting this it's still probably good to understand why you are failing to get the transform to know if there is a deeper issue in need of addressing.

dandedrick commented 7 months ago

4 years on and I've given up on this PR going anywhere and don't need it sitting in my PR queue. We will simply maintain this in our fork.