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

use realsense d435i, but did not detect anything #28

Closed
yuan-0816 opened this issue Feb 22, 2024 · 4 comments
Closed

use realsense d435i, but did not detect anything #28

yuan-0816 opened this issue Feb 22, 2024 · 4 comments

Comments

@yuan-0816
Copy link

I am using ubuntu 22.04 and ros2 Humble
I want to use infra camera from realsense d435i to detect apriltag (The AprilTag ID in the image is 42)
Screenshot from 2024-02-22 18-33-58

It is the grayscale image, I remap the image topic to the apriltag node

but I can not detect anything, did I do something wrong?

here is my launch file

import os

from launch import LaunchDescription, Substitution, LaunchContext
from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable, LogInfo, OpaqueFunction
from launch.substitutions import LaunchConfiguration, ThisLaunchFileDir, PythonExpression
from launch.conditions import IfCondition, UnlessCondition
from launch_ros.actions import Node
from launch_ros.actions import SetParameter
from typing import Text
from ament_index_python.packages import get_package_share_directory

def launch_setup(context, *args, **kwargs):     
    
    apriltag_yaml = os.path.join(
        get_package_share_directory('apriltag_ros'), 'apriltag_ros', 'cfg', 'tags_36h11.yaml')   

    return [

        
        Node(
            package='apriltag_ros', executable='apriltag_node', output='screen',
            remappings=[
                ('/apriltag/image_rect', '/camera/infra1/image_rect_raw'),
                ('/apriltag/camera_info', '/camera/infra1/camera_info')
            ],
            parameters=[{'from': apriltag_yaml}],
            # extra_arguments=['use_intra_process_comms:=True']
        )

          
    ]


def generate_launch_description():
    

    return LaunchDescription([
        OpaqueFunction(function=launch_setup)

    ])

and my yaml file

apriltag:
    ros__parameters:
        image_transport: raw    # image format
        family: 36h11           # tag family name
        size: 0.160             # tag edge size in meter
        max_hamming: 0          # maximum allowed hamming distance (corrected bits)

        # see "apriltag.h" 'struct apriltag_detector' for more documentation on these optional parameters
        detector:
            threads: 1          # number of threads
            decimate: 2.0       # decimate resolution for quad detection
            blur: 0.0           # sigma of Gaussian blur for quad detection
            refine: True        # snap to strong gradients
            sharpening: 0.25    # sharpening of decoded images
            debug: True        # write additional debugging images to current working directory

        # optional list of tags
        tag:
            ids: [42]               # tag ID
            frames: [base, object]  # optional frame name
            sizes: [0.160, 0.160]   # optional tag-specific edge size
@christianrauch
Copy link
Owner

Please check with the apriltag_demo from the apriltag library first before reporting such issues to the ROS node.

Looking at the image, my best guess is that your fingers are interfering with the edge detection.

@yuan-0816
Copy link
Author

I can detect using your launch file, but I want to use Python to write the launch file. However, I'm not sure how to implement the following parameters in Python

    - pkg: apriltag_ros
      plugin: AprilTagNode
      name: apriltag
      namespace: apriltag
      remap:
      - from: /apriltag/image_rect
        to: /v4l2/image_rect
      - from: /apriltag/camera_info
        to: /v4l2/camera_info
      param:
      - from: $(find-pkg-share apriltag_ros)/cfg/tags_36h11.yaml
      extra_arg:
      - name: use_intra_process_comms
        value: "True"

@christianrauch
Copy link
Owner

I can detect using your launch file, but I want to use Python to write the launch file.

That's a bit out of scope for this issue and this repo is not the best place to ask common ROS questions.

Just googling for "ros2 launch files parameters" gives me:

If this is still unclear or you have a very specific problem with launch files, then I suggest asking your question at https://robotics.stackexchange.com.

You mentioned that your original issue with the tag detection has been solved. I am going to close this issue.

@christianrauch christianrauch closed this as not planned Won't fix, can't repro, duplicate, stale Feb 28, 2024
@yuan-0816
Copy link
Author

ok, I will try another method.
thanks for your reply><

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

2 participants