Adding a static camera to a world in gazebo ros hydro [closed]

asked 2014-05-23 15:33:33 -0600

dbcooper gravatar image

updated 2014-05-23 20:16:15 -0600

I am trying to include a static camera model to a kitchen world and save them using rosbag. However when i launch the world file, the camera doesn't seem to be loaded as there are no rostopics for that camera nor I can see the camera in gazebo simulator. I am using ROS hydro on Ubuntu 12.04.

<?xml version="1.0" ?>
<sdf version="1.4">
  <world name="default">
    <!-- A global light source -->
    <include>
      <uri>model://sun</uri>
    </include>
    <!-- A ground plane -->
    <include>
      <uri>model://ground_plane</uri>
    </include>
    <!-- Kitchen environment -->
    <include>
      <uri>model://kitchen_dining</uri>
    </include> 
    <!--Camera -->
    <model name="camera_box">
      <link name="camera_link">
        <gravity>false</false>
        <pose>0.05 0.05 0.05 0 0 0</pose>
        <inertial>
          <mass>0.1</mass>
        </inertial>
        <visual name="camera_visual">
          <geometry>
            <box>
              <size>1 1 1</size>
            </box>
          </geometry>
        </visual>
        <sensor name="wall_camera" type="camera">
          <camera>
            <horizontal_fov>1.047</horizontal_fov>
            <image>
              <width>640</width>
              <height>480</height>
              <format>R8G8B8</format>
            </image>
            <clip>
              <near>0.1</near>
              <far>100</far>
            </clip>
          </camera>
          <always_on>1</always_on>
          <update_rate>30</update_rate>
          <visualize>true</visualize>
          <plugin filename="libgazebo_ros_camera.so" name="camera_en_ros">
            <robotNamespace>wall</robotNamespace>
            <cameraName>wall_camera</cameraName>
            <imageTopicName>raw_image</imageTopicName>
            <cameraInfoTopicName>info_image</cameraInfoTopicName>
            <FrameName>cameraImage</FrameName>
            <Cy>0</Cy>
            <Cx>0</Cx>
            <updateRate>30.0</updateRate>
          </plugin>
        </sensor>
      </link>
    </model>

    <!-- Own physics settings to speed up simulation -->
    <physics type='ode'>
      <max_step_size>0.01</max_step_size>
      <real_time_factor>1</real_time_factor>
      <real_time_update_rate>100</real_time_update_rate>
      <gravity>0 0 -9.8</gravity>
    </physics>
  </world>
</sdf>

I also looked at the camera available in the gui tag, but I don't if there is any way to save those images. What am I doing wrong, please help me with it.

I also tried adding camera model using the include tag, but if i put a tutlebot_gazebo in it too, an error comes that "Sensors failed to initialize when loading model[mobile_base]." Is it that the cameras are generated to the same rostopic /camera/rgb/image_raw ?? If so, how can i get the images of the camera into a new rostopic ?

<include>
    <uri>model://camera</uri>
    <pose>-21 -11 12 0 0.44 0.35</pose>
    <name>camera2</name>
</include>

So how do i get a rostopic for the include camera part ?? I think this will solve all my problems

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2018-01-30 20:57:51.380598