Giter VIP home page Giter VIP logo

apriltag_ros's People

Contributors

23pointsnorth avatar brennand avatar christianrauch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

apriltag_ros's Issues

When launching with include from other launch file the tf topic gets published to /apriltag/tf instead of /tf

Hello @christianrauch

I am having issues when launching the node from other launch file using IncludeLaunchDescription. (Using Foxy). On launch the /tf topic is somehow published to /apriltag/tf and setting remappings does nothing to it. (Tried remapping /apriltag/tf, /tf and tf. None of those does it.) But when I launch it from command line with ros2 launch ... the /tf topic is correctly published from the node.

Something I found was that when the topic name in AprilTagNode.cpp at line 55 was changed to tf instead of /tf the remapping started to work as it should but then without remapping the tf was published to /apriltag/tf regardless of launching method.

Also one interesting thing is that I tried adding /detections as topic name in detections publisher and I was able to remap it without any problems again regardless of launching method...

Wondering why does this happen and why /tf seems to behave differently than other topics?

Below you can find snippet of the launch I do and the apriltag launch file I use.

apriltag_detector = IncludeLaunchDescription(
    PythonLaunchDescriptionSource(
        os.path.join(get_package_share_directory('tag_detection'), 'launch', 'apriltag_detection.launch.py'),
    ),
    launch_arguments={'camera_topic': '/camera_1/image_raw',
                      'camera_info_topic': '/camera_1/camera_info',
                      'params_file': tag_param_path,
                      }.items()
)

apriltag_detection.launch.py

from ament_index_python import get_package_share_directory
from os import path
import yaml

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, OpaqueFunction
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode


def launch_setup(context):
    emulate_tty = LaunchConfiguration('emulate_tty')
    params_file = LaunchConfiguration('params_file').perform(context)
    camera_topic = LaunchConfiguration('camera_topic')
    camera_info_topic = LaunchConfiguration('camera_info_topic')

    params = yaml.load(open(params_file), Loader=yaml.FullLoader)

    composable_node = ComposableNode(
        name='apriltag',
        package='apriltag_ros',
        plugin='AprilTagNode',
        remappings=[("/apriltag/image", camera_topic),
                    ("/apriltag/camera_info", camera_info_topic),
                    ("detections", "/tag_detections"),
                    ],
        parameters=[params['apriltag']['apriltag']['ros__parameters']])

    apriltag_container = ComposableNodeContainer(
        name='tag_container',
        namespace='apriltag',
        package='rclcpp_components',
        executable='component_container',
        emulate_tty=emulate_tty,
        composable_node_descriptions=[composable_node],
        output='screen',
    )

    return [
        apriltag_container,
    ]


def generate_launch_description():
    params_path = path.join(get_package_share_directory('tag_detection'), 'params', 'tag_params.yaml')
    params_file_argument = DeclareLaunchArgument(
        'params_file',
        default_value=params_path,
        description='Full path to apriltag parameters yaml'
    )

    tty_argument = DeclareLaunchArgument(
        'emulate_tty',
        default_value='true',
        description='Emulate tty to show python prints for Nodes and to show log colors correctly'
    )

    camera_argument = DeclareLaunchArgument(
        'camera_topic',
        default_value='/camera_1/image_raw',
        description='Camera image topic'
    )

    camera_info_argument = DeclareLaunchArgument(
        'camera_info_topic',
        default_value='/camera_1/camera_info',
        description='Camera info topic'
    )

    return LaunchDescription([
        params_file_argument,
        tty_argument,
        camera_argument,
        camera_info_argument,
        OpaqueFunction(function=launch_setup)
    ])

No detection

Hi .. I tried to use the apriltag_ros in ros humble with the input is mono camera. when the package is launched there is no detection. Correct me if iam wrong, therefore, this package can be used on mono image ?

Multiple cameras

I am have trouble using the apriltag ros node when using more than one camera. The problem stems from having too many parents in the transformation tree for one child.
Right now, we have a transformation from world->tag and a transformation that your node provides from 'camera->tag1'.

These to transformation have to be inverted to retain tree structure, so camera->tag becomes
tag->camera

From this data, we create a tree that looks like this:

world -> tag -> camera.

From this, we can then get the transformation between the world and the camera. Then, we offset that pose by the distance from the camera to the center of the robot (the camera does not move). Ideally, this would be done with base_link. However, at the time, we only had one camera, and this solution was simpler.

This is already a weird tf tree, but I worked for our original design.

However, if we want to have two cameras and we invert the transformation, base_link would have two parents. Moreover, if we did not invert the transformation, the tag would have three parents. Either way, we end up breaking the tree structure.

Screenshot_20240425_191128_GitHub.jpg

Thank you for your help.

ros2 echo, message is invalid

$ ros2 topic list
/apriltag/detections
/clicked_point
/color/camera_info
/color/image_raw
/color/metadata
/depth/camera_info
/depth/image_rect_raw
/depth/metadata
/extrinsics/depth_to_color
/extrinsics/depth_to_infra1
/extrinsics/depth_to_infra2
/goal_pose
/imu
/infra1/camera_info
/infra1/image_rect_raw
/infra1/metadata
/infra2/camera_info
/infra2/image_rect_raw
/infra2/metadata
/initialpose
/parameter_events
/rosout
/tf
/tf_static
$ ros2 topic echo /apriltag/detections 
The message type 'apriltag_msgs/msg/AprilTagDetectionArray' is invalid

Synchronization issues between image_raw and camera_info in ROS2 AprilTag with RealSense D435

Hello,
I am experiencing a synchronization issue when using the ROS2 AprilTag package with a RealSense camera. The warning suggests that the image messages and CameraInfo messages are not properly synchronized.

kai@4070:~/ros2_ws$ ros2 run apriltag_ros apriltag_node --ros-args     -r image_rect:=/camera/camera/color/image_raw     -r camera_info:=/camera/camera/color/camera_info     --params-file `ros2 pkg prefix apriltag_ros`/share/apriltag_ros/cfg/tags_36h11.yaml
[WARN] [1715749104.420966646] [apriltag]: [image_transport] Topics '/camera/camera/color/image_raw' and '/camera/camera/color/camera_info' do not appear to be synchronized. In the last 10s:
	Image messages received:      7
	CameraInfo messages received: 30
	Synchronized pairs:           7
[WARN] [1715749121.421794903] [apriltag]: [image_transport] Topics '/camera/camera/color/image_raw' and '/camera/camera/color/camera_info' do not appear to be synchronized. In the last 10s:
	Image messages received:      5
	CameraInfo messages received: 30
	Synchronized pairs:           5
^C[INFO] [1715749288.887109937] [rclcpp]: signal_handler(signum=2)

This is my video.

simplescreenrecorder-2024-05-15_12.58.11.mp4

This is my yaml file.

/**:
    ros__parameters:
        image_transport: raw    # image format
        family: 36h11           # tag family name
        size: 0.173             # 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: False        # write additional debugging images to current working directory

        # optional list of tags
        # tag:
        #     ids: [9, 14]            # tag ID
        #     frames: [base, object]  # optional frame name
        #     sizes: [0.162, 0.162]   # optional tag-specific edge size

This is my bag file.
https://drive.google.com/file/d/157_6F8xu8NOlGZZjppNdDwQOWVVKNb27/view?usp=sharing

Feature request: Adding /tag_detections_image topic

Thanks for the nice work on this package! I was able to get everything working, but I noticed that the running node doesn't publish to a /tag_detections_image topic like the ROS1 version (from AprilRobotics/apriltag_ros) does for helpful visualization. Any plans to add that?

Apriltag ROS2 package can not be found

Hi Christian,

I found Apriltag for ROS2 could be installed using sudo apt-get install ros-humble-apriltag (my ROS2 version is humble), it will display that the installation is successful, but you can’t find this package using ros2 pkg list, under opt/ros/humble/share you can see the apriltag folder, but when you go into it, you find it is actually not a package, inside there is only a cmake folder.

It is somehow strange, or I did something wrong?

Thanks in advance!

some questions about cpp libraries configuration

Hi, thanks for this awesome work first!
But I'm very new to the AprilTag things, could you provide some information about how to fetch the necessary cpp libraries for this project? I mean, I'm confused where to download them, the version requirements etc.
I've tried to colcon build this project but got the CMake Error like this:

-- Found sensor_msgs: 2.2.4 (/opt/ros/galactic/share/sensor_msgs/cmake)
CMake Error at CMakeLists.txt:15 (find_package):
  By not providing "Findapriltag_msgs.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "apriltag_msgs", but CMake did not find one.

  Could not find a package configuration file provided by "apriltag_msgs"
  with any of the following names:

    apriltag_msgsConfig.cmake
    apriltag_msgs-config.cmake

  Add the installation prefix of "apriltag_msgs" to CMAKE_PREFIX_PATH or set
  "apriltag_msgs_DIR" to a directory containing one of the above files.  If
  "apriltag_msgs" provides a separate development package or SDK, be sure it
  has been installed.


-- Configuring incomplete, errors occurred!

Thanks!

Failed to load library libapriltag.so.3

Hi,

Everything compiled fine with colcon build. However, when I tried to ros2 launch apriltag_ros tag_16h5_all.launch.py:

[INFO] [component_container-1]: process started with pid [180093]
[component_container-1] [INFO] [1619718701.105940189] [apriltag.tag_container]: Load Library: /home/josh/dev_ws/install/apriltag_ros/lib/libAprilTagNode.so
[component_container-1] [ERROR] [1619718701.109247249] [apriltag.tag_container]: Failed to load library: Could not load library LoadLibrary error: libapriltag.so.3: cannot open shared object file: No such file or directory, at /tmp/binarydeb/ros-foxy-rcutils-1.1.3/src/shared_library.c:84
[ERROR] [launch_ros.actions.load_composable_nodes]: Failed to load node 'apriltag' of type 'AprilTagNode' in container '/apriltag/tag_container': Failed to load library: Could not load library LoadLibrary error: libapriltag.so.3: cannot open shared object file: No such file or directory, at /tmp/binarydeb/ros-foxy-rcutils-1.1.3/src/shared_library.c:84

I have installed Apritag to the system, and I have /usr/local/lib/libapriltag.so.3
Would you know where I may have done wrong?
Thanks,
Joshua

image transport hint is not applied to the remapped topic

Setting image_transport to compressed will result in a subscription to the topic image_rect/compressed regardless of how image_rect is remapped. The expected behaviour is that the node should subscribe to {remapped_topic}/compressed.

cfg/tags_36h11.yaml

Hey Christian,

It seems that the tag YAML was updated in the readme file, to mirror the change from bool to int in the latest change,
however the actual tags_36h11.yaml still contains the boolean version of refine and debug for the detector.
Thank you.

Node does not work with galactic?

First of all, thanks for the ROS2 port!

I've pulled today the current version and noticed, that apriltag_ros cannot be build any more. I'm using ROS2 Galactic on Ubuntu 20.04.5 LTS on virtual machine and I got the following error:

--- stderr: apriltag_ros                         
CMake Error at CMakeLists.txt:25 (find_package):
  Could not find a configuration file for package "apriltag" that is
  compatible with requested version "3.3".

  The following configuration files were considered but not accepted:

    /opt/ros/galactic/share/apriltag/cmake/apriltagConfig.cmake, version: 3.2.0

In the Galactic central index there isn't still apriltag 3.3:
https://github.com/ros/rosdistro/blob/master/galactic/distribution.yaml
so I wonder where can I get it?

Until then, I found out, that I can remove the version from CMakeLists.txt line 25 like that:
find_package(apriltag REQUIRED)

Only then I got other errors on launch. The initialization of the ROS2 parameters "detector.refine" and "detector.debug" fails even when I do not set the parameters and wrong parameter type error appears. Here the one for "detector.refine", they are both identical:

[INFO] [launch]: All log files can be found below /home/mihail/.ros/log/2022-09-27-22-53-49-985567-myVB-20693
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [component_container-1]: process started with pid [20705]
[component_container-1] [INFO] [1664312030.711422719] [apriltag.tag_container]: Load Library: /home/mihail/thermalcamerafaultdetection/ROS2_Workspace/install/apriltag_ros/lib/libAprilTagNode.so
[component_container-1] [INFO] [1664312030.884578613] [apriltag.tag_container]: Found class: rclcpp_components::NodeFactoryTemplate<AprilTagNode>
[component_container-1] [INFO] [1664312030.884656263] [apriltag.tag_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<AprilTagNode>
[component_container-1] [ERROR] [1664312030.917002066] [apriltag.tag_container]: Component constructor threw an exception: parameter 'detector.refine' has invalid type: Wrong parameter type, parameter {detector.refine} is of type {bool}, setting it to {integer} is not allowed.
[ERROR] [launch_ros.actions.load_composable_nodes]: Failed to load node 'apriltag' of type 'AprilTagNode' in container '/apriltag/tag_container': Component constructor threw an exception: parameter 'detector.refine' has invalid type: Wrong parameter type, parameter {detector.refine} is of type {bool}, setting it to {integer} is not allowed.
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[component_container-1] [INFO] [1664312600.778612133] [rclcpp]: signal_handler(signal_value=2)
[INFO] [component_container-1]: process has finished cleanly [pid 20705]

I managed to fix the error by reverting the data type back to int, as it was before commits on Aug 28, 2022. Does this has something to do with the fact, that I'm not using the newest version 3.3? The parameters are being initialized from the "apriltag_detector_t* const td".

Then as a side question, I was wondering why the more precise pose estimation from the apriltag library is not implemented. The pose estimation from the homography has very low precision that is almost unusable, isn't? I've took the time to implement it as an optional setting that is turned off by default and I think it could be useful to others as well. I can gladly contribute it if you want:
https://github.com/MihailV1989/apriltag_ros

Only I cannot guarantee there aren't any hidden bugs and that the code is optimized well as I have no experience with C++. The more precise pose estimation can be turned on by the "refine-pose" parameter that I saw in a very old launch.py file few months ago.

v4l2_36h11.launch.yml | Error “Rectified topic ‘/v4l2/image_rect’ requested but camera publishing ‘/v4l2/camera_info’ is uncalibrated”

Hi Christian,

Background

Camera was calibrated and run

ros2 run v4l2_camera v4l2_camera_node

is no problem.


Issue

Now I'm trying to run the apriltag node with the example launch file:

ros2 launch apriltag_ros v4l2_36h11.launch.yml

The command uses .yml to configure, this .yml concludes:

launch:
- arg:
    name: device
    default: "0"

- node_container:
    pkg: rclcpp_components
    exec: component_container
    name: apriltag_container
    namespace: ""
    composable_node:
    - pkg: v4l2_camera
      plugin: v4l2_camera::V4L2Camera
      name: camera
      namespace: v4l2
      param:
      - name: video_device
        value: /dev/video$(var device)
      extra_arg:
      - name: use_intra_process_comms
        value: "True"

    - pkg: image_proc
      plugin: image_proc::RectifyNode
      name: rectify
      namespace: v4l2
      remap:
      - from: image
        to: image_raw
      extra_arg:
      - name: use_intra_process_comms
        value: "True"

    - 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"

After running the command, error occurs:

  • Rectified topic ‘/v4l2/image_rect’ requested but camera publishing ‘/v4l2/camera_info’ is uncalibrated

See the detailed messages:

st@ST:~/apriltag_ros2_ws$ ros2 launch apriltag_ros v4l2_36h11.launch.yml
[INFO] [launch]: All log files can be found below /home/st/.ros/log/2023-06-02-18-01-16-547398-ST-1710
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [component_container-1]: process started with pid [1723]
[component_container-1] [INFO] [1685721677.737034984] [apriltag_container]: Load Library: /opt/ros/humble/lib/libv4l2_camera.so
[component_container-1] [INFO] [1685721677.965495429] [apriltag_container]: Found class: rclcpp_components::NodeFactoryTemplate<v4l2_camera::V4L2Camera>
[component_container-1] [INFO] [1685721677.965663262] [apriltag_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<v4l2_camera::V4L2Camera>
[component_container-1] [INFO] [1685721677.987020280] [v4l2_camera]: Driver: bm2835 mmal
[component_container-1] [INFO] [1685721677.987095355] [v4l2_camera]: Version: 331618
[component_container-1] [INFO] [1685721677.987119410] [v4l2_camera]: Device: mmal service 16.1
[component_container-1] [INFO] [1685721677.987139410] [v4l2_camera]: Location: platform:bcm2835-v4l2-0
[component_container-1] [INFO] [1685721677.987158299] [v4l2_camera]: Capabilities:
[component_container-1] [INFO] [1685721677.987177040] [v4l2_camera]:   Read/write: YES
[component_container-1] [INFO] [1685721677.987196317] [v4l2_camera]:   Streaming: YES
[component_container-1] [INFO] [1685721677.987231725] [v4l2_camera]: Current pixel format: YUYV @ 1648x1232
[component_container-1] [INFO] [1685721677.988268262] [v4l2_camera]: Available pixel formats: 
[component_container-1] [INFO] [1685721677.988321132] [v4l2_camera]:   YU12 - Planar YUV 4:2:0
[component_container-1] [INFO] [1685721677.988341392] [v4l2_camera]:   YUYV - YUYV 4:2:2
[component_container-1] [INFO] [1685721677.988359614] [v4l2_camera]:   RGB3 - 24-bit RGB 8-8-8
[component_container-1] [INFO] [1685721677.988377910] [v4l2_camera]:   JPEG - JFIF JPEG
[component_container-1] [INFO] [1685721677.988396169] [v4l2_camera]:   H264 - H.264
[component_container-1] [INFO] [1685721677.988414762] [v4l2_camera]:   MJPG - Motion-JPEG
[component_container-1] [INFO] [1685721677.988432836] [v4l2_camera]:   YVYU - YVYU 4:2:2
[component_container-1] [INFO] [1685721677.988450910] [v4l2_camera]:   VYUY - VYUY 4:2:2
[component_container-1] [INFO] [1685721677.988469077] [v4l2_camera]:   UYVY - UYVY 4:2:2
[component_container-1] [INFO] [1685721677.988487262] [v4l2_camera]:   NV12 - Y/CbCr 4:2:0
[component_container-1] [INFO] [1685721677.988505743] [v4l2_camera]:   BGR3 - 24-bit BGR 8-8-8
[component_container-1] [INFO] [1685721677.988524095] [v4l2_camera]:   YV12 - Planar YVU 4:2:0
[component_container-1] [INFO] [1685721677.988542503] [v4l2_camera]:   NV21 - Y/CrCb 4:2:0
[component_container-1] [INFO] [1685721677.988561188] [v4l2_camera]:   RX24 - 32-bit XBGR 8-8-8-8
[component_container-1] [INFO] [1685721677.988579725] [v4l2_camera]: Available controls: 
[component_container-1] [INFO] [1685721677.988626595] [v4l2_camera]:   Brightness (1) = 50
[component_container-1] [INFO] [1685721677.988660466] [v4l2_camera]:   Contrast (1) = 0
[component_container-1] [INFO] [1685721677.988690262] [v4l2_camera]:   Saturation (1) = 0
[component_container-1] [INFO] [1685721677.988719336] [v4l2_camera]:   Red Balance (1) = 1000
[component_container-1] [INFO] [1685721677.988747373] [v4l2_camera]:   Blue Balance (1) = 1000
[component_container-1] [INFO] [1685721677.988773966] [v4l2_camera]:   Horizontal Flip (2) = 0
[component_container-1] [INFO] [1685721677.988800355] [v4l2_camera]:   Vertical Flip (2) = 0
[component_container-1] [INFO] [1685721677.988826503] [v4l2_camera]:   Power Line Frequency (3) = 1
[component_container-1] [INFO] [1685721677.988854040] [v4l2_camera]:   Sharpness (1) = 0
[component_container-1] [INFO] [1685721677.988880966] [v4l2_camera]:   Color Effects (3) = 0
[component_container-1] [INFO] [1685721677.988907410] [v4l2_camera]:   Rotate (1) = 0
[component_container-1] [INFO] [1685721677.988933614] [v4l2_camera]:   Color Effects, CbCr (1) = 32896
[component_container-1] [ERROR] [1685721677.988975003] [v4l2_camera]: Failed getting value for control 10027009: Permission denied (13); returning 0!
[component_container-1] [INFO] [1685721677.988999966] [v4l2_camera]:   Codec Controls (6) = 0
[component_container-1] [INFO] [1685721677.989027447] [v4l2_camera]:   Video Bitrate Mode (3) = 0
[component_container-1] [INFO] [1685721677.989053743] [v4l2_camera]:   Video Bitrate (1) = 10000000
[component_container-1] [INFO] [1685721677.989080243] [v4l2_camera]:   Repeat Sequence Header (2) = 0
[component_container-1] [ERROR] [1685721677.989107558] [v4l2_camera]: Failed getting value for control 10029541: Permission denied (13); returning 0!
[component_container-1] [INFO] [1685721677.989127540] [v4l2_camera]:   Force Key Frame (4) = 0
[component_container-1] [INFO] [1685721677.989154392] [v4l2_camera]:   H264 Minimum QP Value (1) = 0
[component_container-1] [INFO] [1685721677.989180817] [v4l2_camera]:   H264 Maximum QP Value (1) = 0
[component_container-1] [INFO] [1685721677.989207114] [v4l2_camera]:   H264 I-Frame Period (1) = 60
[component_container-1] [INFO] [1685721677.989233669] [v4l2_camera]:   H264 Level (3) = 11
[component_container-1] [INFO] [1685721677.989275132] [v4l2_camera]:   H264 Profile (3) = 4
[component_container-1] [ERROR] [1685721677.989301817] [v4l2_camera]: Failed getting value for control 10092545: Permission denied (13); returning 0!
[component_container-1] [INFO] [1685721677.989321521] [v4l2_camera]:   Camera Controls (6) = 0
[component_container-1] [INFO] [1685721677.989347836] [v4l2_camera]:   Auto Exposure (3) = 0
[component_container-1] [INFO] [1685721677.989410669] [v4l2_camera]:   Exposure Time, Absolute (1) = 1000
[component_container-1] [INFO] [1685721677.989552373] [v4l2_camera]:   Exposure, Dynamic Framerate (2) = 0
[component_container-1] [INFO] [1685721677.989592558] [v4l2_camera]:   Auto Exposure, Bias (9) = 12
[component_container-1] [INFO] [1685721677.989620317] [v4l2_camera]:   White Balance, Auto & Preset (3) = 1
[component_container-1] [INFO] [1685721677.989647429] [v4l2_camera]:   Image Stabilization (2) = 0
[component_container-1] [INFO] [1685721677.989673855] [v4l2_camera]:   ISO Sensitivity (9) = 0
[component_container-1] [INFO] [1685721677.989700206] [v4l2_camera]:   ISO Sensitivity, Auto (3) = 1
[component_container-1] [INFO] [1685721677.989727706] [v4l2_camera]:   Exposure, Metering Mode (3) = 0
[component_container-1] [INFO] [1685721677.989755688] [v4l2_camera]:   Scene Mode (3) = 0
[component_container-1] [ERROR] [1685721677.989784355] [v4l2_camera]: Failed getting value for control 10289153: Permission denied (13); returning 0!
[component_container-1] [INFO] [1685721677.989805262] [v4l2_camera]:   JPEG Compression Controls (6) = 0
[component_container-1] [INFO] [1685721677.989831780] [v4l2_camera]:   Compression Quality (1) = 30
[component_container-1] [INFO] [1685721677.992281503] [v4l2_camera]: Requesting format: 640x480 YUYV
[component_container-1] [INFO] [1685721677.992859855] [v4l2_camera]: Success
[component_container-1] [WARN] [1685721677.994312262] [v4l2.camera]: Control type not currently supported: 6, for control: Codec Controls
[component_container-1] [WARN] [1685721677.994752669] [v4l2.camera]: Control type not currently supported: 4, for control: Force Key Frame
[component_container-1] [WARN] [1685721677.995318762] [v4l2.camera]: Control type not currently supported: 6, for control: Camera Controls
[component_container-1] [WARN] [1685721677.995692077] [v4l2.camera]: Control type not currently supported: 9, for control: Auto Exposure, Bias
[component_container-1] [WARN] [1685721677.995979780] [v4l2.camera]: Control type not currently supported: 9, for control: ISO Sensitivity
[component_container-1] [WARN] [1685721677.996321262] [v4l2.camera]: Control type not currently supported: 6, for control: JPEG Compression Controls
[component_container-1] [INFO] [1685721677.996537132] [v4l2_camera]: Starting camera
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/v4l2/camera' in container '/apriltag_container'
[component_container-1] [INFO] [1685721678.404845502] [apriltag_container]: Load Library: /opt/ros/humble/lib/librectify.so
[component_container-1] [WARN] [1685721678.417578558] [v4l2.camera]: Image encoding not the same as requested output, performing possibly slow conversion: yuv422_yuy2 => rgb8
[component_container-1] [INFO] [1685721678.418626910] [apriltag_container]: Found class: rclcpp_components::NodeFactoryTemplate<image_proc::RectifyNode>
[component_container-1] [INFO] [1685721678.418776039] [apriltag_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<image_proc::RectifyNode>
[component_container-1] [INFO] [1685721678.428634021] [v4l2.camera]: using default calibration URL
[component_container-1] [INFO] [1685721678.428851169] [v4l2.camera]: camera calibration URL: file:///home/st/.ros/camera_info/mmal_service_16.1.yaml
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/v4l2/rectify' in container '/apriltag_container'
[component_container-1] [INFO] [1685721678.456159336] [apriltag_container]: Load Library: /home/st/apriltag_ros2_ws/install/apriltag_ros/lib/libAprilTagNode.so
[component_container-1] [INFO] [1685721678.477689021] [apriltag_container]: Found class: rclcpp_components::NodeFactoryTemplate<AprilTagNode>
[component_container-1] [INFO] [1685721678.477843039] [apriltag_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<AprilTagNode>
[component_container-1] [ERROR] [1685721678.664611317] [v4l2.rectify]: Rectified topic '/v4l2/image_rect' requested but camera publishing '/v4l2/camera_info' is uncalibrated
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/apriltag/apriltag' in container '/apriltag_container'
[component_container-1] [ERROR] [1685721678.665294095] [v4l2.rectify]: Rectified topic '/v4l2/image_rect' requested but camera publishing '/v4l2/camera_info' is uncalibrated
[component_container-1] [ERROR] [1685721678.665885428] [v4l2.rectify]: Rectified topic '/v4l2/image_rect' requested but camera publishing '/v4l2/camera_info' is uncalibrated

This error message will then repeat.

Using ros2 topic list the image_rect can be seen:

st@ST:~$ ros2 topic list
/apriltag/detections
/parameter_events
/rosout
/tf
/v4l2/camera_info
/v4l2/image_raw
/v4l2/image_rect

Any solution for this issue?
Or did I do something wrong?

Thanks!

License

Hello,
Thanks for this amazing port of apriltag to ros2.
I am just worried by one issue: this repo has no disclosed license.
I just want to be sure what is the author idea
before I start using it more extensively on my projects.

[Feature Request]: Tag Pose as Topic

Hello, it's me again.

I miss getting the pose of the tags as a message. In ROS1 the Pose is included in the AprilTagDetection message. Here is only a TF available. What do you think about adding this here as well?

For me it is easier to create a callback to a Topic than to look for the TFs (in the subscriber node in matlab).

We could still discuss which message type is useful. Originally a geometry_msgs/PoseWithCovarianceStamped is used. But there is no coraiance and the stamp is already in the general msg header. Apart from compatibility reasons I think a geometry_msgs/Transform would make sense.

Thanks,
Andreas

Jetson OpenCV issue

Hi There, I am currently going around in circles. I am trying to run your package on Jetson Xavier NX. The package launches but as soon its it receives and image the following error is thrown:

[component_container-1] terminate called after throwing an instance of 'cv::Exception'
[component_container-1]   what():  OpenCV(4.5.4) /home/ubuntu/build_opencv/opencv/modules/core/src/matrix.cpp:250: error: (-215:Assertion failed) s >= 0 in function 'setSize'
[component_container-1] 
[ERROR] [component_container-1]: process has died [pid 37461, exit code -6, cmd '/opt/ros/foxy/lib/rclcpp_components/component_container --ros-args -r __node:=tag_container -r __ns:=/apriltag'].

I think it is something do with the OpenCV version, where the Jetson Xavier has 4.5 inbuild. I have tried to install Jetson OS without OpenCV and install OpenCV with (sudo apt install libopencv-dev python3-opencv).

I have been on this for 3 day, please could you help me out :D

Last things, when I build I get the following warning:

/usr/bin/ld: warning: libopencv_calib3d.so.4.2, needed by /opt/ros/foxy/lib/libimage_geometry.so, may conflict with libopencv_calib3d.so.4.5
/usr/bin/ld: warning: libopencv_core.so.4.2, needed by /opt/ros/foxy/lib/libimage_geometry.so, may conflict with libopencv_core.so.4.5
/usr/bin/ld: warning: libopencv_imgcodecs.so.4.2, needed by /opt/ros/foxy/lib/libcv_bridge.so, may conflict with libopencv_imgcodecs.so.4.5

Inaccurate Pose/TF Calculation

While converting my system to ROS2 I was glad to find this port, thanks.

However, I noticed that the pose/TF accuracy is not as good as in ROS1. After digging into the code, I saw that a different approach is used here to calculate the pose from the detections. I have tried the solution with pnp-solver (as in the ROS1) and the suggested library function (https://github.com/AprilRobotics/apriltag/wiki/AprilTag-User-Guide#pose-estimation). Both perform much better for my task. See small example (moving the camera on a smooth path).

I am curious if anyone else has experienced this issue, and if there is a particular reason for using the current method?

example

publish debug image?

Hi!
Nice work with the apriltag detector node for ROS2!
I'd love to ditch my duplication-of-effort here in favor of your node, in particular since yours is already in rosdistro.
The one feature I'm missing though is a debug image. I find that very helpful so I was wondering if you were open to a PR that implements something like the picture below? The drawing is fairly lightweight and happens only when there is a subscription to the debug image.

image

use realsense d435i, but did not detect anything

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

OutOfMemoryError with pose branch

Using the pose branch, when the image stream begins, I receive this error;

[INFO] [launch]: All log files can be found below /home/user/.ros/log/2023-06-26-11-15-48-213828-node1-orin-2340600
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [component_container_mt-1]: process started with pid [2340628]
[component_container_mt-1] [INFO] [1687734948.719613070] [apriltag_container_detect]: Load Library: /home/user/workspaces/april_ws/install/apriltag_ros/lib/libAprilTagNode.so
[component_container_mt-1] [INFO] [1687734948.831306213] [apriltag_container_detect]: Found class: rclcpp_components::NodeFactoryTemplate<AprilTagNode>
[component_container_mt-1] [INFO] [1687734948.831585384] [apriltag_container_detect]: Instantiate class: rclcpp_components::NodeFactoryTemplate<AprilTagNode>
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/apriltag' in container '/apriltag_container_detect'
[component_container_mt-1] terminate called after throwing an instance of 'cv::Exception'
[component_container_mt-1]   what():  OpenCV(4.5.4) /home/ubuntu/build_opencv/opencv/modules/core/src/alloc.cpp:73: error: (-4:Insufficient memory) Failed to allocate 117094104464640 bytes in function 'OutOfMemoryError'
[component_container_mt-1] 
[ERROR] [component_container_mt-1]: process has died [pid 2340628, exit code -6, cmd '/opt/ros/galactic/lib/rclcpp_components/component_container_mt --ros-args -r __node:=apriltag_container_detect -r __ns:=/'].

I am using an Nvidia Orin with OpenCV 4.5.4, ROS Galactic.
If you need any further information let me know.

building on Foxy Fitzroy, Ubuntu 20.04

In order to build the node on Foxy i had to change CMakeLists.txt, line 26:

-target_link_libraries(AprilTagNode apriltag::apriltag)
+target_link_libraries(AprilTagNode apriltag)

works fine afterwards. Thank you for your work

run detector without calibration?

I was planning on using the detector for calibration purposes, meaning there is no calibration available yet. I would only be using the corner positions and ID from the detection messages.
Any suggestions how to do this? The only way I see is to add another configuration parameter that would trigger the use of a regular image transport subscription rather than a camera subscription.

Decouple AprilTag detection & pose/tf calculation.

I have an application where the AprilTag detection has already happened, and I can post the AprilTagDetectionArray without the video stream (as an optimization, to save on constrained bandwidth). I do have access to the camera camera calibration, as well. Since this node does everything sequentially, I can't take the detections and turn them into poses.... but I think that's something I should be able to do.

Is this something anyone else cares about? If not, I'd be happy to just hack my own together (as its a small part of the node), but I'd also be happy to "do it right" (IMHO) and contribute it back.

Proposals (in order of invasiveness):

A) As mentioned above, the application is too niche for anyone to care, so I hack my own... and we go our separate ways. :)

B) Add a boolean parameter which toggles between taking a video stream in and performing the AprilTag processing (default) , or just subscribing to an AprilTagDetectionArray, but always doing the pose estimation (or make that optional too? )

C) Split AprilTagDetection & AprilTagPoseEstimation into 2 different composable nodes, connected by an AprilTagDetectionArray topic. Example launch file could have a container with both. Maybe keep the exiting one around too (but mark it as deprecated) so as to not break peoples' existing setups.

D) Do "C" above, but also split these into different packages, because they would now have totally different dependencies, with a 3rd "bringup" package depending on both. (footnote: I package my nodes into containers and pay a lot of attention to image size, so I'm always trying to comb out unnecessary dependencies).

Thoughts?

Plan to incorporate Tag-bundles

Hi guys, great work on the ros2 port. Not exactly an issue, but are you considering incorporating tag bundles as in the original apriltag-ros for more accurate tag poses.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.