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

Remapping topics in gazebo, not working?

asked 2012-12-21 04:52:27 -0600

davinci gravatar image

updated 2012-12-24 07:52:15 -0600

I am trying to remap a camera stream from /camera to /camera1_ns in gazebo.

<launch>
  <!-- set use_sim_time flag -->
  <param name="/use_sim_time" value="true" />

  <!-- start gazebo with an empty plane -->
  <node name="gazebo" pkg="gazebo" type="gazebo" args="$(find gazebo_worlds)/worlds/empty.world" respawn="false" output="screen"/>

<!-- start gui -->
<node name="gazebo_gui" pkg="gazebo" type="gui" respawn="false" output="screen"/>

<!-- spawn model -->
 <node name="spawn_arm" pkg="gazebo" type="spawn_model" args="-file simple_arm.model -gazebo -model     simple_arm" respawn="false" output="screen" >

<!-- remapping topics -->

<remap from="/camera1_ns" to="/camera" />
</node>

</launch>

But there is no /camera1_ns listed with rostopic list. Is this approach correct or should it be done otherwise?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2012-12-22 04:59:35 -0600

joq gravatar image

updated 2012-12-31 07:59:49 -0600

Does it help to delete the leading '/' in the remapped names?

<remap from="camera" to="camera1_ns" />

EDIT: Maybe I got the names backwards from what you intended?

EDIT2: Move the remap from the arm_spawn node to the gazebo node.

edit flag offensive delete link more

Comments

Thanks for your response. But it does not work. I should be able to see a camera1_ns using rostopic list?

davinci gravatar image davinci  ( 2012-12-24 06:59:28 -0600 )edit

I am indeed remapping camera to camera1_ns But still not getting it to work...no camera1_ns is appearing in rostopic list. Tried it in several ways. Is the position of the remap argument okay?

davinci gravatar image davinci  ( 2012-12-29 02:20:40 -0600 )edit

It is inside the spawn_arm node. Maybe you should move it to the gazebo node?

joq gravatar image joq  ( 2012-12-29 04:42:23 -0600 )edit

Yes, that works! Thanks! Seemed illogical as the simulation doesn't know anything yet about camera's at that point, but it seems to be the correct way.

davinci gravatar image davinci  ( 2012-12-30 03:37:06 -0600 )edit
0

answered 2017-08-19 14:20:42 -0600

is better to change the topic in the urdf file, check this example, specifically in the "xxxTopicName" tags:

 <!-- ASUS Xtion PRO camera for simulation -->
  <gazebo reference="${name}_depth_frame">
    <sensor type="depth" name="${name}">
      <always_on>true</always_on>
      <update_rate>20.0</update_rate>
      <camera>
      <horizontal_fov>${60.0 * M_PI/180.0}</horizontal_fov>
      <image>
          <format>B8G8R8</format>
          <width>640</width>
          <height>480</height>
      </image>
      <clip>
          <near>0.05</near>
          <far>8.0</far>
      </clip>
      </camera>
      <plugin name="${name}_camera_controller" filename="libgazebo_ros_openni_kinect.so">
        <cameraName>${name}</cameraName>
        <alwaysOn>true</alwaysOn>
        <updateRate>10</updateRate>
        <imageTopicName>rgb/image_raw</imageTopicName>
        <depthImageTopicName>depth/image_raw</depthImageTopicName>
        <pointCloudTopicName>depth_registered/points</pointCloudTopicName>
        <cameraInfoTopicName>rgb/camera_info</cameraInfoTopicName>
        <depthImageCameraInfoTopicName>depth/camera_info</depthImageCameraInfoTopicName>
        <frameName>${name}_depth_optical_frame</frameName>
        <baseline>0.1</baseline>
        <distortion_k1>0.0</distortion_k1>
        <distortion_k2>0.0</distortion_k2>
        <distortion_k3>0.0</distortion_k3>
        <distortion_t1>0.0</distortion_t1>
        <distortion_t2>0.0</distortion_t2>
        <pointCloudCutoff>0.4</pointCloudCutoff>
      </plugin>
    </sensor>
  </gazebo>
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2012-12-21 04:52:27 -0600

Seen: 2,505 times

Last updated: Aug 19 '17