Robotics StackExchange | Archived questions

ros2 gazebo camera not publishing data

Currently, I have ROS2 Foxy-Fitzroy installed on Ubuntu 20.04. With a launch file I'm starting gazebo and loading a world. A python file then calls the service /spawnentity to place an robot into the world. The robot is given as an urdf file. The robot is correctly displayed in GAZEBO and rqt shows that some node is registered to publish data on the topic /customns/camera1/image_raw. Now, I could make the following observation:

[gzserver-1] [WARN] [1613167042.394499378] [rcl]: Found remap rule 'imageraw:=custom'. This syntax is deprecated. Use '--ros-args --remap imageraw:=custom' instead. [gzserver-1] [WARN] [1613167042.394738154] [rcl]: Found remap rule 'camerainfo:=custominfo'. This syntax is deprecated. Use '--ros-args --remap camerainfo:=custominfo' instead. [gzserver-1] [WARN] [1613167042.403082689] [rcl]: Found remap rule 'imageraw:=custom'. This syntax is deprecated. Use '--ros-args --remap imageraw:=custom' instead. [gzserver-1] [WARN] [1613167042.403119632] [rcl]: Found remap rule 'camerainfo:=custominfo'. This syntax is deprecated. Use '--ros-args --remap camerainfo:=custominfo' instead. [gzserver-1] [INFO] [1613167042.421325313] [customns.cameracontroller]: Publishing camera info to [/customns/camera1/camerainfo]

This is the code from the urdf:

  <gazebo reference="camera_link">
    <sensor type="camera" name="camera1">
      <update_rate>1</update_rate>
      <camera name="head">
        <horizontal_fov>1.2</horizontal_fov>
        <image>
          <width>420</width>
          <height>240</height>
          <format>R8G8B8</format>
        </image>
        <clip>
          <near>0.02</near>
          <far>300</far>
        </clip>
        <distortion>
          <k1>0.0</k1>
          <k2>0.0</k2>
          <k3>0.0</k3>
          <p1>0.0</p1>
          <p2>0.0</p2>
        </distortion>
      </camera>
      <plugin name="camera_controller" filename="libgazebo_ros_camera.so">
        <ros>
          <namespace>custom_ns</namespace>
          <argument>image_raw:=custom</argument>
          <argument>camera_info:=custom_info</argument>
        </ros>
        <camera_name>camera1</camera_name>
        <frame_name>camera_link</frame_name>
        <hack_baseline>0.07</hack_baseline>
      </plugin>
    </sensor>
  </gazebo>

I migrated this from ROS1 according to the following guide: https://github.com/ros-simulation/gazeborospkgs/wiki/ROS-2-Migration:-Camera It still recommends using the upper notation for passing custom topics despite the warning in the terminal.

I would appreciate any help as there is no solution in sight after several days of work!

Asked by simonsure on 2021-02-12 17:20:19 UTC

Comments

So, after some digging I found the reason. The plugin worked fine but the problem were the QoS settings within in RViz, which did not align by default. Just settings those to best efford solved the issue immediately.

Asked by simonsure on 2021-02-20 04:05:58 UTC

Thanks for the hint! I also can't display the pointcloud, but changing the setting didn't work. I don't receive any message on the camera topic (even though it is published). Is it normal that both image and point cloud are coming on the same topic?

Asked by francesco on 2021-05-09 07:09:00 UTC

Answers