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

apriltag_tracking package doesn't work #4

Open
wangzizhe opened this issue Jan 18, 2024 · 0 comments
Open

apriltag_tracking package doesn't work #4

wangzizhe opened this issue Jan 18, 2024 · 0 comments

Comments

@wangzizhe
Copy link

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!



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

1 participant