Giter VIP home page Giter VIP logo

Comments (2)

christianrauch avatar christianrauch commented on July 29, 2024

The launch file launches three nodes: camera, rectification and the apriltag node. The apriltag node is not involved in the rectification, it just consumes the rectified images. The problem must either be in the package v4l2_camera or image_proc. If you remove the last section of the launch file with pkg: apriltag_ros, you will probably still get the same error.

Having said this, I cannot reproduce your issue. I am using an integrated webcam that I calibrated earlier, and it loads the calibration file without issues.

The message is coming from: https://github.com/ros-perception/image_pipeline/blob/3.0.1/image_proc/src/rectify.cpp#L98-L109 so you might want to check that the intrinsics that are published on /v4l2/camera_info actually contain valid values for matrix k.

If you still have issues with the calibration, I suggest checking out the repos for the camera and rectification node.

from apriltag_ros.

wangzizhe avatar wangzizhe commented on July 29, 2024

I've written a new launch file then this problem disappeared:

from launch import LaunchDescription # to write launch file in ROS2
from launch_ros.descriptions import ComposableNode
from launch_ros.actions import ComposableNodeContainer

from launch.actions import DeclareLaunchArgument
from launch.actions import IncludeLaunchDescription

from launch.substitutions import LaunchConfiguration
from launch_ros.substitutions import FindPackageShare
from launch.launch_description_sources import PythonLaunchDescriptionSource # to import other launch files

# detect all 36h11 tags
# original file is in the folder "./cfg/tags_36h11.yaml"
cfg_36h11 = {
    "image_transport": "raw",
    "family": "36h11",
    "size": 0.173,
    "max_hamming": 0,
}

def generate_launch_description():
    camera_resolution_value = LaunchConfiguration('image_size')
    
    camera_resolution_launch_arg = DeclareLaunchArgument(
        'image_size', 
        default_value='[1648,1232]'
    )
    
    image_proc_launch = IncludeLaunchDescription(
        PythonLaunchDescriptionSource([
            FindPackageShare("image_proc"), '/launch/', 'image_proc.launch.py'])
    )
    
    cam_node = ComposableNode(
    	name='camera',
    	namespace='v4l2',
        package='v4l2_camera',
        # executable='v4l2_camera_node',
        plugin='v4l2_camera::V4L2Camera',
        parameters=[{
            'image_size': LaunchConfiguration('image_size')
        }],
        extra_arguments=[{'use_intra_process_comms': True}],
    )
    
    tag_node = ComposableNode(
        name='apriltag_ros',
        namespace='apriltag',
        package='apriltag_ros', 
        plugin='AprilTagNode',
        remappings=[
                # http://wiki.ros.org/roslaunch/XML/remap
                # This maps the 'raw' images for simplicity of demonstration.
                # ("/apriltag/image_rect", "/camera/image_raw"),
                # In practice, this will have to be the rectified 'rect' images.
                ("/apriltag/image_rect", "/v4l2/image_raw"),
                ("/apriltag/camera_info", "/v4l2/camera_info"),
        ],
        parameters=[cfg_36h11],
        extra_arguments=[{'use_intra_process_comms': True}],
    )
        
    container = ComposableNodeContainer(
        name='tag_container',
        namespace='apriltag',
        package='rclcpp_components',
        executable='component_container',
        composable_node_descriptions=[cam_node, tag_node],
        output='screen'
    )

    return LaunchDescription([
    	camera_resolution_launch_arg,
    	container,
    	image_proc_launch,
    ])

Now after running:

ros2 launch apriltag_ros v4l2_36h11.launch.py

The following information appears:

[INFO] [launch]: All log files can be found below /home/st/.ros/log/2023-06-02-17-58-42-701821-ST-2004
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [component_container-1]: process started with pid [2018]
[INFO] [component_container-2]: process started with pid [2020]
[component_container-1] [INFO] [1685721523.644873502] [apriltag.tag_container]: Load Library: /opt/ros/humble/lib/libv4l2_camera.so
[component_container-2] [INFO] [1685721523.715224132] [image_proc_container]: Load Library: /opt/ros/humble/lib/libdebayer.so
[component_container-1] [INFO] [1685721523.882948520] [apriltag.tag_container]: Found class: rclcpp_components::NodeFactoryTemplate<v4l2_camera::V4L2Camera>
[component_container-1] [INFO] [1685721523.883093761] [apriltag.tag_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<v4l2_camera::V4L2Camera>
[component_container-1] [INFO] [1685721523.920445224] [v4l2_camera]: Driver: bm2835 mmal
[component_container-1] [INFO] [1685721523.920589354] [v4l2_camera]: Version: 331618
[component_container-1] [INFO] [1685721523.920630132] [v4l2_camera]: Device: mmal service 16.1
[component_container-1] [INFO] [1685721523.920667872] [v4l2_camera]: Location: platform:bcm2835-v4l2-0
[component_container-1] [INFO] [1685721523.920704557] [v4l2_camera]: Capabilities:
[component_container-1] [INFO] [1685721523.920738613] [v4l2_camera]:   Read/write: YES
[component_container-1] [INFO] [1685721523.920771502] [v4l2_camera]:   Streaming: YES
[component_container-1] [INFO] [1685721523.920826557] [v4l2_camera]: Current pixel format: YUYV @ 1648x1232
[component_container-1] [INFO] [1685721523.921984706] [v4l2_camera]: Available pixel formats: 
[component_container-1] [INFO] [1685721523.922121465] [v4l2_camera]:   YU12 - Planar YUV 4:2:0
[component_container-1] [INFO] [1685721523.922794057] [v4l2_camera]:   YUYV - YUYV 4:2:2
[component_container-1] [INFO] [1685721523.922898150] [v4l2_camera]:   RGB3 - 24-bit RGB 8-8-8
[component_container-1] [INFO] [1685721523.922940298] [v4l2_camera]:   JPEG - JFIF JPEG
[component_container-1] [INFO] [1685721523.922975539] [v4l2_camera]:   H264 - H.264
[component_container-1] [INFO] [1685721523.923009965] [v4l2_camera]:   MJPG - Motion-JPEG
[component_container-1] [INFO] [1685721523.923042891] [v4l2_camera]:   YVYU - YVYU 4:2:2
[component_container-1] [INFO] [1685721523.923075206] [v4l2_camera]:   VYUY - VYUY 4:2:2
[component_container-1] [INFO] [1685721523.923107428] [v4l2_camera]:   UYVY - UYVY 4:2:2
[component_container-1] [INFO] [1685721523.923142243] [v4l2_camera]:   NV12 - Y/CbCr 4:2:0
[component_container-1] [INFO] [1685721523.923175632] [v4l2_camera]:   BGR3 - 24-bit BGR 8-8-8
[component_container-1] [INFO] [1685721523.923208335] [v4l2_camera]:   YV12 - Planar YVU 4:2:0
[component_container-1] [INFO] [1685721523.923240780] [v4l2_camera]:   NV21 - Y/CrCb 4:2:0
[component_container-1] [INFO] [1685721523.923273446] [v4l2_camera]:   RX24 - 32-bit XBGR 8-8-8-8
[component_container-1] [INFO] [1685721523.923307150] [v4l2_camera]: Available controls: 
[component_container-1] [INFO] [1685721523.923383354] [v4l2_camera]:   Brightness (1) = 50
[component_container-1] [INFO] [1685721523.923444909] [v4l2_camera]:   Contrast (1) = 0
[component_container-1] [INFO] [1685721523.923490835] [v4l2_camera]:   Saturation (1) = 0
[component_container-1] [INFO] [1685721523.923535076] [v4l2_camera]:   Red Balance (1) = 1000
[component_container-1] [INFO] [1685721523.923582687] [v4l2_camera]:   Blue Balance (1) = 1000
[component_container-1] [INFO] [1685721523.923631039] [v4l2_camera]:   Horizontal Flip (2) = 0
[component_container-1] [INFO] [1685721523.923674206] [v4l2_camera]:   Vertical Flip (2) = 0
[component_container-1] [INFO] [1685721523.923716872] [v4l2_camera]:   Power Line Frequency (3) = 1
[component_container-1] [INFO] [1685721523.923759928] [v4l2_camera]:   Sharpness (1) = 0
[component_container-1] [INFO] [1685721523.923801465] [v4l2_camera]:   Color Effects (3) = 0
[component_container-1] [INFO] [1685721523.923844187] [v4l2_camera]:   Rotate (1) = 0
[component_container-1] [INFO] [1685721523.923893595] [v4l2_camera]:   Color Effects, CbCr (1) = 32896
[component_container-1] [ERROR] [1685721523.923960076] [v4l2_camera]: Failed getting value for control 10027009: Permission denied (13); returning 0!
[component_container-1] [INFO] [1685721523.924005169] [v4l2_camera]:   Codec Controls (6) = 0
[component_container-1] [INFO] [1685721523.924053132] [v4l2_camera]:   Video Bitrate Mode (3) = 0
[component_container-1] [INFO] [1685721523.924099539] [v4l2_camera]:   Video Bitrate (1) = 10000000
[component_container-1] [INFO] [1685721523.924142983] [v4l2_camera]:   Repeat Sequence Header (2) = 0
[component_container-1] [ERROR] [1685721523.924186891] [v4l2_camera]: Failed getting value for control 10029541: Permission denied (13); returning 0!
[component_container-1] [INFO] [1685721523.924253650] [v4l2_camera]:   Force Key Frame (4) = 0
[component_container-1] [INFO] [1685721523.924304465] [v4l2_camera]:   H264 Minimum QP Value (1) = 0
[component_container-1] [INFO] [1685721523.924350057] [v4l2_camera]:   H264 Maximum QP Value (1) = 0
[component_container-1] [INFO] [1685721523.924392391] [v4l2_camera]:   H264 I-Frame Period (1) = 60
[component_container-1] [INFO] [1685721523.924434817] [v4l2_camera]:   H264 Level (3) = 11
[component_container-1] [INFO] [1685721523.924476669] [v4l2_camera]:   H264 Profile (3) = 4
[component_container-1] [ERROR] [1685721523.924522187] [v4l2_camera]: Failed getting value for control 10092545: Permission denied (13); returning 0!
[component_container-1] [INFO] [1685721523.924557002] [v4l2_camera]:   Camera Controls (6) = 0
[component_container-1] [INFO] [1685721523.924603687] [v4l2_camera]:   Auto Exposure (3) = 0
[component_container-1] [INFO] [1685721523.924650020] [v4l2_camera]:   Exposure Time, Absolute (1) = 1000
[component_container-1] [INFO] [1685721523.924829891] [v4l2_camera]:   Exposure, Dynamic Framerate (2) = 0
[component_container-1] [INFO] [1685721523.924898113] [v4l2_camera]:   Auto Exposure, Bias (9) = 12
[component_container-1] [INFO] [1685721523.924942150] [v4l2_camera]:   White Balance, Auto & Preset (3) = 1
[component_container-1] [INFO] [1685721523.924984983] [v4l2_camera]:   Image Stabilization (2) = 0
[component_container-1] [INFO] [1685721523.925027613] [v4l2_camera]:   ISO Sensitivity (9) = 0
[component_container-1] [INFO] [1685721523.925069835] [v4l2_camera]:   ISO Sensitivity, Auto (3) = 1
[component_container-1] [INFO] [1685721523.925117298] [v4l2_camera]:   Exposure, Metering Mode (3) = 0
[component_container-1] [INFO] [1685721523.925161409] [v4l2_camera]:   Scene Mode (3) = 0
[component_container-1] [ERROR] [1685721523.925208076] [v4l2_camera]: Failed getting value for control 10289153: Permission denied (13); returning 0!
[component_container-1] [INFO] [1685721523.925242817] [v4l2_camera]:   JPEG Compression Controls (6) = 0
[component_container-1] [INFO] [1685721523.925288020] [v4l2_camera]:   Compression Quality (1) = 30
[component_container-1] [WARN] [1685721523.932186928] [v4l2_camera]: Control type not currently supported: 6, for control: Codec Controls
[component_container-1] [WARN] [1685721523.932752057] [v4l2_camera]: Control type not currently supported: 4, for control: Force Key Frame
[component_container-1] [WARN] [1685721523.933639909] [v4l2_camera]: Control type not currently supported: 6, for control: Camera Controls
[component_container-1] [WARN] [1685721523.934164798] [v4l2_camera]: Control type not currently supported: 9, for control: Auto Exposure, Bias
[component_container-1] [WARN] [1685721523.934636909] [v4l2_camera]: Control type not currently supported: 9, for control: ISO Sensitivity
[component_container-1] [WARN] [1685721523.935426002] [v4l2_camera]: Control type not currently supported: 6, for control: JPEG Compression Controls
[component_container-1] [INFO] [1685721523.935748409] [v4l2_camera]: Starting camera
[component_container-2] [INFO] [1685721523.963883132] [image_proc_container]: Found class: rclcpp_components::NodeFactoryTemplate<image_proc::DebayerNode>
[component_container-2] [INFO] [1685721523.964015261] [image_proc_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<image_proc::DebayerNode>
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/debayer_node' in container '/image_proc_container'
[component_container-2] [INFO] [1685721524.008961613] [image_proc_container]: Load Library: /opt/ros/humble/lib/librectify.so
[component_container-2] [INFO] [1685721524.019409076] [image_proc_container]: Found class: rclcpp_components::NodeFactoryTemplate<image_proc::RectifyNode>
[component_container-2] [INFO] [1685721524.019601057] [image_proc_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<image_proc::RectifyNode>
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/rectify_mono_node' in container '/image_proc_container'
[component_container-2] [INFO] [1685721524.051258872] [image_proc_container]: Found class: rclcpp_components::NodeFactoryTemplate<image_proc::RectifyNode>
[component_container-2] [INFO] [1685721524.051404446] [image_proc_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<image_proc::RectifyNode>
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/rectify_color_node' in container '/image_proc_container'
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/v4l2_camera' in container '/apriltag/tag_container'
[component_container-1] [INFO] [1685721524.404695002] [apriltag.tag_container]: Load Library: /home/st/apriltag_ros2_ws/install/apriltag_ros/lib/libAprilTagNode.so
[component_container-1] [INFO] [1685721524.425501131] [apriltag.tag_container]: Found class: rclcpp_components::NodeFactoryTemplate<AprilTagNode>
[component_container-1] [INFO] [1685721524.425705835] [apriltag.tag_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<AprilTagNode>
[component_container-1] [WARN] [1685721524.593323057] [v4l2_camera]: Image encoding not the same as requested output, performing possibly slow conversion: yuv422_yuy2 => rgb8
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/apriltag/apriltag_36h11' in container '/apriltag/tag_container'
[component_container-1] [INFO] [1685721524.639582668] [v4l2_camera]: using default calibration URL
[component_container-1] [INFO] [1685721524.639844946] [v4l2_camera]: camera calibration URL: file:///home/st/.ros/camera_info/mmal_service_16.1.yaml

Thanks a lot anyway!

from apriltag_ros.

Related Issues (20)

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.