opened
canberkgurel
username_0
The transformation from tag0 to map was defined, it gets preempted when `continuous_detection.launch` starts running. Why do I need to define the transformation from `/map` to `/camera`? That's the unknown in my equation, it needs to be estimated  fusing `/map` >> `/tag0` >> `/camera` transformations.
No transformation from <..> to <..> error when continuous_detection.launch is executed.
issue
created
Nosille
username_1
Hope I can explain this well.  

when using tf2, transforms have a defined direction from parent->child, and each child can only have one parent.  You have defined map->tag0 and are expecting AprilTags to define the transform from tag0->camera, but AprilTags is actually defining a transform from camera->tag0 which conflicts your definition of tag0's parent.  It would be necessary to go into the Apriltag code and reverse the direction of the transform to achieve what you are attempting.
comment
created
canberkgurel
username_0
this doesn't make sense to me, if a map-to-tag transformation is defined then the tag-to-map is also defined -- which happens to be the inverse of the original transformation. So are you telling me that I need to define two separate static_transform_publishers one from map-to-tag and another from tag-to-map ?
comment
created
Nosille
username_1
Just like the publisher that you setup, Apriltags_ros relies on the tf2_ros package (http://wiki.ros.org/tf2) for transforms.  This directionality in the parent->child definition comes from that package.  I suggest reading its documentation for the how and why.  I think it mostly comes down to making it impossible to create loops in the tf tree.  If there are multiple paths between frames in the tf tree, which one is right?  This one parent, multiple children rule prevents that problem.

Apriltags_ros's authors simply assumed that the camera was already in the tf tree and the tag was not.  Therefore, it is coded to generate the camera->tag transform.  If you want it the other way, I suggest finding the line of code that calls the tf_publisher and reversing the transform.  It is located in the block of code starting at line 390 in common_functions.cpp.  You will need to both invert the transform, and swap camera_tf_frame_ and detection_names[i] in the call to send_transform.
comment
closed
rgreid
username_2
issue
created
rgreid
username_2
Would you like to update the documentation here http://wiki.ros.org/apriltag_ros to clarify?

Feel free to reopen if you have other questions! Cheers.
comment
created
shawkontzu
username_3
I agree that the transformation /camera -> /apriltags can be a little confusing when we want to fuse the apriltag pose to robot_localization. Since tf only allows each frame to have a single parent frame, and a common tf tree is something similar to this

`/world -> /map -> /odom -> /base_link -> /camera_link -> /apriltags`

We have the ground truth /map -> /apriltags and we have the predicted transformation /camera_link -> /apriltags, but what we want is /map -> /base_link and fuse this pose information to robot_localization. One approach I could think of is since

`Tmap->apriltags = Tmap->base_link * Tbase_link->camera_link * Tcamera_link->apriltags`

so 

`Tmap->base_link = Tmap->apriltags * (Tcamera_link->apriltag)^-1 * (Tbase_link->camera_link)^-1`

We can name this calculated pose data to something like /landmark, and set a 0 transformation from /base_link -> /landmark, now tf tree knows that the new pose information /landmark has 0 transformation from /base_link, we just need to publish the calculated /landmark for fusing the apriltag data. This seems to be a workaround if we want to use apriltags for robot localization.
comment