Autonomy-Science-And-Systems
Autonomy-Science-And-Systems copied to clipboard
`apriltag_tracking` package doesn't work
Hi,
I struggled a lot, but the apriltag_tracking
package never worked...
(I want to enable my TurtleBot3 to track apriltags)
I think it is mainly because of the transform from the following lines of apriltag_tracking.py
:
if self.get_clock().now() - self.start_time > Duration(seconds=DELAY):
to_frame_rel = 'camera'
from_frame_rel = 'tag36h11_0'
try:
tf2_msg = self.tf_buffer.lookup_transform(to_frame_rel, from_frame_rel, rclpy.time.Time())
except TransformException as e:
# self.get_logger().info(f'Could not transform {to_frame_rel} to {from_frame_rel}: {e}')
print('No AprilTag marker found, looking for one...')
return
The value of the static transform between base_link and camera I already set them to the right values.
Node(
package='tf2_ros',
executable='static_transform_publisher',
name='base_link_to_camera_tf',
# https://navigation.ros.org/setup_guides/transformation/setup_transforms.html
# http://wiki.ros.org/tf#static_transform_publisher
# Static TF Publisher (relationship between base link and camera doesn't change in time)
# static_transform_publisher x y z yaw pitch roll frame_id child_frame_id
# Publish a static coordinate transform to tf2 using an x/y/z offset in meters and yaw/pitch/roll in radians.
# (yaw is rotation about Z, pitch is rotation about Y, and roll is rotation about X).
arguments = ['0.073', '-0.011', '0.084',
'0.000', '0.000', '0.000',
'base_link', 'camera']
However, i keep getting errors.
I'm pretty sure the apriltag_ros
detects the right AprilTag:
Also if I run ros2 topic echo /detections
I get the values constantly updating. So I'm sure AprilTag could be detected.
header:
stamp:
sec: 1705330141
nanosec: 981887783
frame_id: camera
detections:
- family: tag36h11
id: 4
hamming: 0
goodness: 0.0
decision_margin: 184.5729522705078
centre:
x: 855.1402853430145
y: 603.4324452437951
corners:
- x: 755.0858764648438
y: 706.0559692382812
- x: 955.772216796875
y: 703.2138061523438
- x: 954.2670288085938
y: 501.7604064941407
- x: 753.432373046875
y: 502.58419799804676
homography:
- 104.6427878042058
- 1.071645325037038
- 855.1402853430145
- 2.0928464181488255
- 101.42798848337623
- 603.4324452437951
- 0.004987543463421618
- 0.000330147913311962
- 1.0
---
I'm getting the same error message for a long time as the transformation never works rightly...
I'm very helpless now, tried every solutions which I can imagine and which I could find in the internet. But it never worked...
Do you have any ideas? Or you faced somehow similar issue during your development?
Much appreciated!