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

image_transport republish via LaunchDescription and remapping

asked 2020-12-03 09:32:00 -0500

anthares gravatar image

Hi there,

How can I start image_transport republish via Launch file?

I tried the following:

import launch
import launch.actions
import launch.substitutions
import launch_ros.actions

def generate_launch_description():

    return launch.LaunchDescription([
        launch_ros.actions.Node(package='image_tools', node_executable='cam2image', output='screen', node_name='cam2image'),
        launch_ros.actions.Node(package='image_transport', node_executable='republish', arguments=[ 
                'raw',
                '--ros-args',
                '-r in:=image',
                'raw', 
                '-r out:=/camera/image_raw'
            ],
            output='screen', node_name='republish')
    ])

But from the log I can see that no images are republished:

[INFO] [launch]: All log files can be found below /root/.ros/log/2020-12-03-15-29-26-520456-db7019ece524-5304
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [cam2image-1]: process started with pid [5315]
[INFO] [republish-2]: process started with pid [5316]
[cam2image-1] [INFO] [cam2image]: Publishing image #1
[cam2image-1] [INFO] [cam2image]: Publishing image #2
[cam2image-1] [INFO] [cam2image]: Publishing image #3
[cam2image-1] [INFO] [cam2image]: Publishing image #4
[cam2image-1] [INFO] [cam2image]: Publishing image #5
[cam2image-1] [INFO] [cam2image]: Publishing image #6
[cam2image-1] [INFO] [cam2image]: Publishing image #7
[cam2image-1] [INFO] [cam2image]: Publishing image #8
[cam2image-1] [INFO] [cam2image]: Publishing image #9

What is wrong with my setup? Any idea?

Thanks!

Cheers, Anthares

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2020-12-03 10:40:55 -0500

anthares gravatar image

I have changed the way that I define the params for image_transport:

def generate_launch_description():
    return launch.LaunchDescription([
        launch_ros.actions.Node(package='image_tools', node_executable='cam2image', output='screen', node_name='cam2image'),
        launch_ros.actions.Node(package='image_transport', node_executable='republish', output='screen', node_name='republish', remappings=[
            ('in', 'image'),
            ('out', '/camera/image_raw')
        ], arguments=['raw'])
    ])

It actually work. I checked with RQT and I can see source and target topics being created and populated: republish is doing his job, it just doesnt produce any log. I should have checked first, sorry!

Cheers.

edit flag offensive delete link more
0

answered 2022-08-25 13:25:51 -0500

CJLuo gravatar image

In my case, this setting works:

main_cam_image_transport_cmd = Node(
    package='image_transport',
    executable='republish',
    name='main_cam_image_transform_node',
    namespace='sensor',
    arguments=['compressed'],
    remappings=[
        ('in/compressed', '/sensor/main_camera/compressed'),
        ('out', '/sensor/main_camera/image_raw')]
)
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-12-03 09:32:00 -0500

Seen: 757 times

Last updated: Dec 03 '20