Gazebo | Ignition | Community
Ask Your Question

ROS Pluging in model.sdf (Not Working)

asked 2020-12-29 01:26:11 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi everyone,

I am trying to add ROS camera model to the gazebo model.Camera and mymodel are different models. Camera model sdf like below: image description

I start empty_world.launch with a roslaunch gazebo_ros empty_world.launch command.After that instert the camera model to the world.When I enter the rostopic list to the console ,I can see the topics about the camera. Also I can see the image in the Topic Visualization in Gazebo. Shortly everything is fine.

I added camera model to the mymodel like below;

  <pose>0.2 0 0.2 0 0 0</pose>
<joint name="camera_joint" type="fixed">

and I start the empty_world like above and then instert my model to the world.I do not get a any error during this operations.When I enter the rostopic list to the console also ı can see the topics.I do not see any image in the Topic Visualization.When I try to rostopic echo /image_raw I didn't see any message on the topic.When I add only camera model I saw.

What I am doing wrong!!! Thanks.

edit retag flag offensive close merge delete


Kindly post the camera model.sdf as formatted text and the full mymodel. It would be easier for us to help

wongrufus gravatar imagewongrufus ( 2020-12-29 20:22:35 -0600 )edit

I added,I found something else. When I removed the imu sensor I saw the camera was working. but i can't fly without imu sensor. what could be the reason?

mertaskin gravatar imagemertaskin ( 2020-12-30 01:38:58 -0600 )edit

I think my issue about the update rate of the sensor. When I deleted updated rate of imu sensor, camera started publish message.It stops after few minutes later.What ı am missing?

mertaskin gravatar imagemertaskin ( 2020-12-30 03:36:26 -0600 )edit

Might want to check your CPU load if that's the case. Simulating certain sensors can take a toll on CPU. I have cases where simulating lidars makes lidar readings come in once every 10+ seconds. In your case, your imu sensor update rate of 1000 is prolly too high.

wongrufus gravatar imagewongrufus ( 2020-12-30 21:09:57 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2020-12-29 23:36:14 -0600

mertaskin gravatar image
<?xml version="1.0"?>
<sdf version='1.5' xmlns:xacro=''>
  <model name='plane'><!--The model element defines a complete robot or any other physical object-->
    <pose>0 0 0.246 0 0 0</pose> <!--A position (x,y,z) and oriantation(roll,pitch yaw) with respect to the specified frame -->
    <!-- -->
    <link name='base_link'> <!--A physical link with inertia,collision and visual properties.A link must be a child of model,and any number of links may exist in a model-->        
      <pose>0 0 0 0 0 0</pose><!--A position (x,y,z) and oriantation(roll,pitch yaw) with respect to the specified frame -->
      <inertial><!-- inertial properties of the links -->
        <pose>0 0 0 0 0 0</pose> <!--this is the pose of the inertial reference frame,relative to the specified reference frame.The origin of the inertial reference frame needs to be at the center of gravity.The axes of the inertial reference frame do not need to be aligned with the principal axes of the inertia -->
        <mass>1.5</mass> <!--the mass of the link -->
        <inertia> <!--3*3 rotational inertia matrix.Because the rotational inertia matrix is symmetric only 6 above diagonal elements of this matrix are specified here,using the attributes below -->
      <collision name='base_link_collision'> <!--The collision properties of a link .Note that this can be different from the visual properties of a likn,for example simpler collision models are often used to reduce computation time -->
        <pose>0 0 -0.07 0 0 0</pose> <!-- A position (x,y,z) and oriantation(roll,pitch,yaw) with respect to the specified frame -->
        <geometry><!-- the shape of the visual or collision object -->
          <box> <!--box shape -->
            <size>0.47 0.47 0.11</size> <!-- the three side lengths of the box.The origin of the box is in its geometric center(inside the center of the box) type vector3 -->
        <surface><!-- the surface parameters -->
            <ode> <!--ODE contact parameters -->
              <max_vel>10</max_vel> <!--maximum contact correction velocity truncation term -->
              <min_depth>0.01</min_depth> <!-- min allowable depth before contact correction impulse is applied -->
      <visual name='base_link_visual'><!-- The visual properties of the link.This element specifies the shape of the object for visualization purposes-->
        <pose>0.07 0 -0.08 0 0 0</pose><!-- a position and orientation with respect to the specified frame-->
        <geometry> <!-- The shape of the visual or collision object -->
          <mesh> <!--  mesh shape-->
            <scale>0.1 0.1 0.1</scale> <!--  scaling factor applied to the mesh -->
            <uri>model://plane/meshes/body.dae</uri> <!--mesh uri -->
        <material><!-- the materail of the visual element -->
          <script> <!--name of material from an installed script file This will override the color element if the script exists -->
            <name>Gazebo/Red</name> <!-- Name of the script within the script file -->
            <uri>__default__</uri><!-- uri of the material script ...
edit flag offensive delete link more


Pertaining to common FAQ etiquette, it is preferrable to edit the original question to provide additional information, instead of posting the additional information as an answer

wongrufus gravatar imagewongrufus ( 2020-12-30 21:10:50 -0600 )edit
Login/Signup to Answer

Question Tools



Asked: 2020-12-29 01:26:11 -0600

Seen: 28 times

Last updated: Dec 29 '20