ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Integration of realsense d435i camera and openvins

asked 2023-07-13 17:01:02 -0600

Robo_guy gravatar image

updated 2023-07-21 15:51:35 -0600

Hi everyone, I am updating my question, I am trying to integrate the realsense d435i camera and openvins nodes in one launch file in ROS2 Foxy. I have converted the openvins node into a composable node and am running it with the realsense composable node in a single container, the launch file runs and the opevins node subscribes to the camera and imu topics but still I don't see any output on /trackhist or /odomimu. If anybody has worked on this before and encountered this issue, please help me out. Here is the launch file -

import os
from ament_index_python.packages import get_package_share_directory, get_package_prefix
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, LogInfo, OpaqueFunction
from launch.conditions import IfCondition
from launch.substitutions import LaunchConfiguration, TextSubstitution
from launch_ros.actions import Node
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode

def generate_launch_description():

    # Define launch arguments
    launch_args = [
        DeclareLaunchArgument(name="namespace", default_value="ov_msckf", description="namespace"),
        DeclareLaunchArgument(name="ov_enable", default_value="true", description="enable OpenVINS node"),
        DeclareLaunchArgument(name="rviz_enable", default_value="false", description="enable rviz node"),
        DeclareLaunchArgument(name="config", default_value="rs435i", description="euroc_mav, tum_vi, rpng_aruco..."),
        DeclareLaunchArgument(name="config_path", default_value="", description="path to estimator_config.yaml. If not given, determined based on provided 'config' above"),
        DeclareLaunchArgument(name="verbosity", default_value="INFO", description="ALL, DEBUG, INFO, WARNING, ERROR, SILENT"),
        DeclareLaunchArgument(name="use_stereo", default_value="true", description="if we have more than 1 camera, if we should try to track stereo constraints between pairs"),
        DeclareLaunchArgument(name="max_cameras", default_value="2", description="how many cameras we have 1 = mono, 2 = stereo, >2 = binocular (all mono tracking)"),
        DeclareLaunchArgument(name="save_total_state", default_value="false", description="record the total state with calibration and features to a txt file"),
    ]

    config_path = os.path.join(
        get_package_share_directory('ov_msckf'),
        'config', 'rs_d435', 'estimator_config.yaml')

    # Config file
    config_file = os.path.join(
        get_package_share_directory('argos_launch'),
        'config', 'sensors', 'realsense_ov.yaml')

    realsense_node = ComposableNode(
        namespace="camera",
        package='realsense2_camera',
        plugin='realsense2_camera::RealSenseNodeFactory',
        parameters=[config_file],
        remappings = [("/camera/imu", "/imu0"),
                  ("/camera/infra1/image_rect_raw", "/cam1/image_raw"),
                  ("/camera/infra2/image_rect_raw", "/cam0/image_raw")]
    )

    open_vins_node = ComposableNode(     
        package='ov_msckf',
        plugin='ov_msckf::OpenVinsNode',
        parameters=[
        {"verbosity": LaunchConfiguration("verbosity")},
        {"use_stereo": LaunchConfiguration("use_stereo")},
        {"max_cameras": LaunchConfiguration("max_cameras")},
        {"save_total_state": LaunchConfiguration("save_total_state")},
        #{"config_path": config_path},
        ],
    )

    container = ComposableNodeContainer(
        name='my_container',
        namespace='',
        package='rclcpp_components',
        executable='component_container',
        composable_node_descriptions=[
            realsense_node,
            open_vins_node,
        ],
        output='screen',
    )

    ld = LaunchDescription(launch_args)
    ld.add_action(container)

    return ld
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-08-07 18:38:27 -0600

Robo_guy gravatar image

I solved this issue by myself, turns out there was issue with the correct use of namespace for the composable nodes and also how the parameters need to be read from the configuration yaml file.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2023-07-13 17:01:02 -0600

Seen: 460 times

Last updated: Aug 07 '23