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

Can I change which topic usb_cam is publishing? [closed]

asked 2020-06-18 08:51:07 -0600

サイトダニエロ gravatar image

Can I change the topic which each node publishes? I'm using usb_cam with multiple nodes and each node will run in different devices, I need them to publish on different topics so the server can send them instructions individually.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by サイトダニエロ
close date 2020-08-06 12:57:58.082088

Comments

Have you tried to remap the topics ?

Delb gravatar image Delb  ( 2020-06-18 09:15:59 -0600 )edit

oh, hello! thanks for commenting. Yes, I've tried to change the <remap from="image" to="/usb_cam/image_raw"/> to <remap from="image" to="/raspImages"/> but it just throw a error on image_view, saying that it couldn't read from that topic, so the remap worked for changing what topic a node should subscribe but I don't know how to make it change a publisher's topic.

サイトダニエロ gravatar image サイトダニエロ  ( 2020-06-18 09:55:04 -0600 )edit

Can you show the full launch file please ? There might be more remapping required.

Delb gravatar image Delb  ( 2020-06-18 10:14:23 -0600 )edit

<launch> <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" > <param name="video_device" value="/dev/video0" /> <param name="image_width" value="640" /> <param name="image_height" value="480" /> <param name="pixel_format" value="yuyv" /> <param name="camera_frame_id" value="usb_cam" /> <param name="io_method" value="mmap"/> </node> <node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen"> <remap from="image" to="/usb_cam/image_raw"/> <param name="autosize" value="true" /> </node> </launch>

from link text

I just switched the image_view remap. Which... thinking about it now, the image_view is just the visualization node, I think, it's supposed to not be able to subscribe to a different node that the node called usb_cam is publishing...but the problem remains.

サイトダニエロ gravatar image サイトダニエロ  ( 2020-06-18 10:29:07 -0600 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2020-06-18 09:49:14 -0600

Remap will do what you're wanting: http://wiki.ros.org/roslaunch/XML/remap

ex.

<node pkg="nodelet" type="nodelet" args="load image_proc/crop_decimate realsense2_camera_manager"
      name="$(arg camera)_depth_image_decimator" respawn="true"  output="screen">
  <remap from="points"     to="/$(arg camera)/depth/points" /> 
</node>
edit flag offensive delete link more

Comments

I'm gonna try here! thanks for help!

サイトダニエロ gravatar image サイトダニエロ  ( 2020-06-18 13:21:13 -0600 )edit

Ok, I tested here. It worked!! thanks a lot, I'm newbie in ROS haha.

サイトダニエロ gravatar image サイトダニエロ  ( 2020-06-18 13:24:21 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-06-18 08:51:07 -0600

Seen: 705 times

Last updated: Jun 18 '20