Home | Tutorials | Wiki | Issues
Ask Your Question
0

Why are the sensors not publishing?

asked 2016-12-21 10:27:51 -0600

StevenCoral gravatar image

updated 2016-12-21 13:07:32 -0600

Hi all, I wish to start by saying that I have searched for hours for a solution but nothing seems to fit. I'm having trouble with some (actually every) sensor plugin in gazebo 7, along with ubuntu 16.04 and ROS kinetic. Every example that I'm trying to mimic is of urdf or xacro nature (including the tutorial and the turtlebot_description which i have scoured dozens of times), and its hard to follow when you got 4 files inter-included. I want to get to the bottom of things, trying to build a robot using pure SDF format, but I'll take the question to the simplest form. I took the "stock" kinect model, and added a depth plugin in the following manner:

<?xml version="1.0" ?>
<sdf version="1.5">
  <model name="kinect">
    <pose>0 0 0.036 0 0 0</pose>
    <link name="base">
      <inertial>
        <mass>0.1</mass>
      </inertial>
      <collision name="collision">
        <geometry>
          <box>
            <size>0.073000 0.276000 0.072000</size>
          </box>
        </geometry>
      </collision>
      <visual name="visual">
        <geometry>
          <mesh>
            <uri>model://kinect/meshes/kinect.dae</uri>
          </mesh>
        </geometry>
      </visual>
      <sensor name="camera" type="depth">
        <update_rate>20</update_rate>
        <camera>
          <horizontal_fov>1.047198</horizontal_fov>
          <image>
            <width>640</width>
            <height>480</height>
            <format>R8G8B8</format>
          </image>
          <clip>
            <near>0.05</near>
            <far>3</far>
          </clip>
        </camera>
        <plugin name="kinect_camera_controller" filename="libgazebo_ros_openni_kinect.so">
          <cameraName>camera</cameraName>
          <alwaysOn>true</alwaysOn>
          <updateRate>10</updateRate>
          <imageTopicName>rgb/image_raw</imageTopicName>
          <depthImageTopicName>depth/image_raw</depthImageTopicName>
          <pointCloudTopicName>depth/points</pointCloudTopicName>
          <cameraInfoTopicName>rgb/camera_info</cameraInfoTopicName>
          <depthImageCameraInfoTopicName>depth/camera_info</depthImageCameraInfoTopicName>
          <frameName>base</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>
    </link>
  </model>
</sdf>

I get no parsing errors while spawning, yet there is no topic being published neither using gz topic -l nor with rostopic list. I know I'm doing something wrong because there is no reference pose for the... lets say "image sensor location". i.e. to have the camera positioned at the kinect's lens rather than on its base. Furthermore, launching the turtlebot_sim does publish the kinect topic, readable in Rviz.

Same issue happens with the hokuyo - If I spawn the stock model I do see the "laser field" from the "libRayPlugin.so", but I get no topic published when adding the "libgazebo_ros_gpu_laser.so" plugin. I do have a "scan" topic, but that seem to originate from the "ray" sensor tag and not the plugins.

Its a bit long but I feel like i got it all wrong. Is there anyone that can save my soul? Many thanks in advance, Steve

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-01-01 18:35:57 -0600

hari1234 gravatar image

updated 2017-01-01 18:39:57 -0600

<robot name="robot"> <gazebo reference="camera_link"> <mu1>0.2</mu1> <mu2>0.2</mu2> <material>Gazebo/Yellow</material> </gazebo> <gazebo reference="camera_link"> <sensor type="depth" name="kinect"> <always_on>1</always_on> <visualize>true</visualize>
<camera> <horizontal_fov>1.047</horizontal_fov>
<image> <width>640</width> <height>480</height> <format>R8G8B8</format> </image> <depth_camera>

            </depth_camera>
            <clip>
                <near>0.1</near>
                <far>100</far>
            </clip>
        </camera>
             <plugin name="camera_controller" filename="libgazebo_ros_openni_kinect.so">
             <alwaysOn>true</alwaysOn>
                <updateRate>10.0</updateRate>
                <cameraName>camera</cameraName>
                <frameName>camera_link</frameName>                   
            <imageTopicName>rgb/image_raw</imageTopicName>
            <depthImageTopicName>depth/image_raw</depthImageTopicName>
            <pointCloudTopicName>depth/points</pointCloudTopicName>
            <cameraInfoTopicName>rgb/camera_info</cameraInfoTopicName>              
            <depthImageCameraInfoTopicName>depth/camera_info</depthImageCameraInfoTopicName>            
            <pointCloudCutoff>0.4</pointCloudCutoff>                
                <hackBaseline>0.07</hackBaseline>
                <distortionK1>0.0</distortionK1>
                <distortionK2>0.0</distortionK2>
                <distortionK3>0.0</distortionK3>
                <distortionT1>0.0</distortionT1>
                <distortionT2>0.0</distortionT2>
            <CxPrime>0.0</CxPrime>
            <Cx>0.0</Cx>
            <Cy>0.0</Cy>
            <focalLength>0.0</focalLength>
            </plugin>
    </sensor>
  </gazebo>  
</robot>

These is working for me, u can either launch this camera from launch file or directly by using ros spawn methode described in gazebo roslaunch tutorial.

edit flag offensive delete link more

Comments

Thank you for your answer. Appearantly I was launching gazebo through gazebo and not the ros_gazebo package, therefore topics were not published. silly me.

StevenCoral gravatar imageStevenCoral ( 2017-01-03 04:23:44 -0600 )edit

I am not able to see topics being published even after I launch the world using rosrun gazebo_ros gazebo and then adding the world. My sdf files is as following The kinect sdf is [https://gist.github.com/arpit15/a900bb0ed0a49cc610223c7097740fce] and my world file is [https://gist.github.com/arpit15/cdd0dfd7df206c07179481c7d3566d5a]

arpit159 gravatar imagearpit159 ( 2017-04-10 12:22:13 -0600 )edit

Hi @arpit, I am having the same issue. Have you found a solution ?

malhar gravatar imagemalhar ( 2018-02-25 15:45:25 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-12-21 10:27:51 -0600

Seen: 3,394 times

Last updated: Jan 01 '17