Change ZED Mini Camera focal length in zed_component

The specification says ZED-Mini has a focal length of 2.8 mm. However the when I launch the ZedCamera node, the print out on the terminal shows the focal length is 3.08366 mm.

... [zed_node]:  * Focal Lenght	-> 3.08366 mm

The distance on the apriltag detection is also off by like 20~30%. I wonder if its affected by the incorrect focal length. If not what might the cause of the error in apriltag distance?

I launched zed_component by

    zed_camera_node = ComposableNode(
        package='zed_components',
        plugin='stereolabs::ZedCamera',
        name='zed_node',
        parameters=[zed_config],
        extra_arguments=[{'use_intra_process_comms': True}]
    )

The config file:

# Parameters for testing ZED mini camera for SLAM
/**:
    ros__parameters:
        general:
            camera_model: 'zedm'
            camera_name: 'zedm'
            grab_resolution: 'HD1080'
            grab_frame_rate: 15
            pub_resolution: 'NATIVE' # same resolution as grab_resolution
            pub_frame_rate: 15.0
        depth:
            depth_mode: 'NONE'
        object_detection:
            od_enabled: false
        advanced: # WARNING: do not modify unless you are confident of what you are doing
            # Reference documentation: https://man7.org/linux/man-pages/man7/sched.7.html
            thread_sched_policy: "SCHED_BATCH" # 'SCHED_OTHER', 'SCHED_BATCH', 'SCHED_FIFO', 'SCHED_RR' - NOTE: 'SCHED_FIFO' and 'SCHED_RR' require 'sudo'
            thread_grab_priority: 50 # ONLY with 'SCHED_FIFO' and 'SCHED_RR' - [1 (LOW) z-> 99 (HIGH)] - NOTE: 'sudo' required
            thread_sensor_priority: 70 # ONLY with 'SCHED_FIFO' and 'SCHED_RR' - [1 (LOW) z-> 99 (HIGH)] - NOTE: 'sudo' required

The entire launch file if it was helpful:

import launch
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode
from ament_index_python.packages import get_package_share_directory
import os

def generate_launch_description():
    apriltag_node = ComposableNode(
        package='isaac_ros_apriltag',
        plugin='nvidia::isaac_ros::apriltag::AprilTagNode',
        name='apriltag',
        namespace='',
        remappings=[
            ('image', 'left_rgb8'),
            ('camera_info', '/zed_node/left/camera_info'),  # already rectified
        ],
    )

    format_conversion_node = ComposableNode(
        package='isaac_ros_image_proc',
        plugin='nvidia::isaac_ros::image_proc::ImageFormatConverterNode',
        name='format_conversion',
        namespace='',
        parameters=[{
            'encoding_desired': 'rgb8', 
            'image_width': 1920,
            'image_height': 1080,
        }],
        remappings=[
            ('image_raw', '/zed_node/left/image_rect_color'), # input
            ('image', 'left_rgb8')                            # output
        ]
    )

    zed_config = os.path.join(
        get_package_share_directory('drone_bringup'),
        'config',
        'zedm.yaml'
    )

    zed_camera_node = ComposableNode(
        package='zed_components',
        plugin='stereolabs::ZedCamera',
        name='zed_node',
        parameters=[zed_config],
        extra_arguments=[{'use_intra_process_comms': True}]
    )

    apriltag_container = ComposableNodeContainer(
        package='rclcpp_components',
        name='apriltag_container',
        namespace='',
        executable='component_container_mt',
        composable_node_descriptions=[zed_camera_node, format_conversion_node, apriltag_node],
        output='screen'
    )


    return launch.LaunchDescription([apriltag_container])

Thank you!

I suspect the cause is the detection algorithm was assuming the apriltag to be 30% bigger. A 30% bigger apriltag looks the same size on camera when 30% further away. A very silly mistake. I forgot to set the size of the apriltag. Thank you!

1 Like