Ask Your Question
0

How to remap in launch file[error]

asked 2017-11-12 06:46:46 -0600

alienmonster gravatar image

updated 2017-11-12 06:53:20 -0600

Hi, I am running Ubuntu 14.04. I've successfully installed ROS Indigo. I have also set up the catkin workspace from ROS tutorials successfully. I have installed two packages from package 1 and whycon from https://github.com/lrse/whycon.git and https://github.com/simmubhangu/task_1... 1). Then i run commands roslaunch task_1 task_1_1.launch. It launches the gazebo world. Then I had to remap a topic /main/image_raw to whycon. There is a whycon.launch file I have to remap the /whycon/image_out topic /main/image_raw but when i add the following code

<node name="image_view" pkg="gazebo" type="/main/image_raw" respawn="false" output="screen">
<remap from="image" to="/whycon/image_out"/>
<param name="autosize" value="true" />
</node>

Topic /main/image_raw is published by node /gazebo.When I run roslaunch whycon whycon.launch the error says cant find node gazebo. But in rosnode list there is a node /gazebo. I am new to ros , so any help is appreciated.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
4

answered 2017-11-13 19:50:04 -0600

jayess gravatar image

updated 2017-11-14 21:49:55 -0600

Rather than editing someone else's package that's under source control, why not just edit your own package? When the whycon package gets updated (and it probably will because it looks active) anything that you changed in there will be gone when you update (pull) it. If you change files in your own package then you don't have to worry about that because you're in control.

Now, on to the solution. The topic names get defined in your task_1_1.world file. You have two options:

  1. add a remap tag to your task_1.launch (easiest/best)
  2. change your world file (still easy).

Option 1: add a remap tag

Because the topic names are defined in your world file you should add the remap tag before the include of the gazebo node:

<launch>
    <remap from="/main/image_raw" to="/camera/image_raw"/> <!-- Add this line -->
    <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <arg name="world_name" value="$(find task_1)/world/task_1_1.world"/>
        <arg name="headless" value="true"/>
        <arg name="gui" value="true"/>
        <arg name="verbose" value="true"/>
    </include>
</launch>

More information about launch files and remapping can be found in the wiki.

Option 2: modify world file

The topic names get defined in your task_1_1.world file on line 113:

<plugin name='camera_control' filename='libgazebo_ros_camera.so'>
  <cameraName>/main_camera</cameraName>
  <alwaysOn>true</alwaysOn>
  <updateRate>60</updateRate>
  <imageTopicName>/main/image_raw</imageTopicName>
  <cameraInfoTopicName>/main/camera_info</cameraInfoTopicName>
  <frameName>main_camera</frameName>
</plugin>

change

<imageTopicName>/main/image_raw</imageTopicName>
<cameraInfoTopicName>/main/camera_info</cameraInfoTopicName>

to

<imageTopicName>/camera/image_raw</imageTopicName>
<cameraInfoTopicName>/camera/camera_info</cameraInfoTopicName>

Now run rostopic list and you'll see that you have

/camera/camera_info
/camera/image_raw
/camera/image_raw/compressed
/camera/image_raw/compressed/parameter_descriptions
/camera/image_raw/compressed/parameter_updates
/camera/image_raw/compressedDepth
/camera/image_raw/compressedDepth/parameter_descriptions
/camera/image_raw/compressedDepth/parameter_updates
/camera/image_raw/theora
/camera/image_raw/theora/parameter_descriptions
/camera/image_raw/theora/parameter_updates

and you can save two versions of your world file and you can pick and choose which one you want to use. However, option 1 is (in my opinion) better.

edit flag offensive delete link more
-1

answered 2017-11-13 05:15:11 -0600

Hi @alienmonster!

If you check the whycon code, whycon is subscribing to the /camera/image_rect_color topic.

I think the best way to achieve your goal in this case is to change the files set_axis.cpp and whycon_ros.cpp directly to subscribe to the /main/image_raw Topic (instead of to /camera/image_rect_color) and recompile the whycon package by running the following command on your ~/catkin_ws (Catkin Workspace).

catkin_make --pkg whycon

After that, just run your roslaunch whycon whycon.launch again ;)

edit flag offensive delete link more

Comments

1

change the files [..] to subscribe to the /main/image_raw Topic (instead of to /camera/image_rect_color)

A rectified image can be significantly different from a raw one. Are you sure that the rest of whycon will keep working if you do this?

gvdhoorn gravatar imagegvdhoorn ( 2017-11-13 05:19:13 -0600 )edit

There are only 3 references to /camera/image_rect_color on the whycon code. One reference is a publisher and two are subscribers. If the user wants to ignore /camera/image_rect_color and subscribe to /main/image_raw that is published by another node on another pkg, then yes, it should work

Ruben Alves gravatar imageRuben Alves ( 2017-11-13 05:37:19 -0600 )edit
1

I'm trying to get across that if a node specifically asks for a rectified image, feeding it a non-pre-processed one can make it do strange things. They're both going to be images, yes, but there might be a reason that it wants rectified images.

gvdhoorn gravatar imagegvdhoorn ( 2017-11-13 05:39:04 -0600 )edit
1

Also: if it's just a change of topic names then a remap might seem like a better approach. No need to change the sources for that.

gvdhoorn gravatar imagegvdhoorn ( 2017-11-13 05:39:35 -0600 )edit
1

From the readme of whycon:

WhyCon is a vision-based localization system

not taking camera intrinsics into account (ie: using undistorted images) can really degrade a visual odometry system. That is what I was referring to.

gvdhoorn gravatar imagegvdhoorn ( 2017-11-13 05:42:06 -0600 )edit

When you say I'm trying to get across that if a node specifically asks for a rectified image, feeding it a non-pre-processed one can make it do strange things, the images of /main/image_raw are already "rectified".

I didn't understand the vote -1 if the answer was accepted :)

Ruben Alves gravatar imageRuben Alves ( 2017-11-13 12:58:51 -0600 )edit

Before answering the question I have downloaded both packages and the way the packages are created the remap didn't work.

This also can be confirmed if we check the first question where remap was suggested.

Ruben Alves gravatar imageRuben Alves ( 2017-11-13 13:13:56 -0600 )edit
1

I didn't understand the vote -1 if the answer was accepted :)

I haven't downvoted your answer, but even accepted answers can be downvoted: if you're suggesting something to the OP that is incorrect, or does not make sense for instance. In this case you suggest editing source code unnecessarily.

gvdhoorn gravatar imagegvdhoorn ( 2017-11-13 13:28:01 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-11-12 06:41:08 -0600

Seen: 2,362 times

Last updated: Nov 14 '17