0
$\begingroup$

Hello Robotics Community!

I'm trying to implement a ROS 2 topic to view the images from a camera I have added to the iRobot Create 3 simulation for classic Gazebo.

OS: ubuntu-desktop 22.04

ROS 2: Humble

Gazebo: classic 11 installed with apt

AWS small house world

I have the camera working in Gazebo, and in the Gazebo GUI I can see the projected image from the camera in the small house Gazebo world as the robot undocks and turns around. The projected image in Gazebo does look like what the camera should see.

Using libgazebo_ros_camera.so, I cannot see a ROS 2 topic (or images). I have followed this guide: https://github.com/ros-simulation/gazebo_ros_pkgs/wiki/ROS-2-Migration:-Camera

I cannot see any errors in the logs.

Here is the code I am using:

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" >

    <joint name="camera_joint" type="fixed">
        <parent link="base_link"/>
        <child link="camera_link"/>
        <origin xyz="0 0 0.2" rpy="0 0 0"/>
    </joint>

    <link name="camera_link">
        <visual>
            <geometry>
                <box size="0.010 0.03 0.03"/>
            </geometry>
            <material name="red"/>
        </visual>
   </link>
    <material name="red">
        <color rgba="1 0 0 1"/>
    </material>
    <joint name="camera_optical_joint" type="fixed">
        <parent link="camera_link"/>
        <child link="camera_link_optical"/>
        <origin xyz="0 0 0" rpy="${-pi/2} 0 ${-pi/2}"/>
    </joint>

    <link name="camera_link_optical"></link>

    <gazebo reference="camera_link">
        <sensor type="camera" name="camera1">
            <pose> 0 0 0 0 0 0 </pose>
            <always_on>1</always_on>
            <visualize>1</visualize>
            <update_rate>10</update_rate>
            <camera name="head">
                <horizontal_fov>1.089</horizontal_fov>
                <image>
                    <format>R8G8B8</format>
                    <width>640</width>
                   <height>480</height>
                </image>
                <clip>
                    <near>0.05</near>
                    <far>8.0</far>
                </clip>
            </camera>
            <plugin name="camera_controller" filename="libgazebo_ros_camera.so">
                <ros>
                    <namespace>custom_ns</namespace>
                    <remapping>image_raw:=custom_img</remapping>
                    <remapping>camera_info:=custom_info</remapping>
                </ros>
                <camera_name>camera1</camera_name>
                <frame_name>camera_link_optical</frame_name>
                <hack_baseline>0.7</hack_baseline>
            </plugin>
        </sensor>
    </gazebo>
</robot>

When I do a ros2 topic list I do not see the custom_ns namespace, or the camera-related topics.

I'd appreciate any help. Cheers!

$\endgroup$
2
  • 1
    $\begingroup$ what is the value of variable custom_ns used in ros tag of plugin. Shouldn't it be a string? $\endgroup$
    – nitish
    Commented Mar 8 at 18:57
  • $\begingroup$ It's an XML document, so custom_ns in this context is a string, not a variable. $\endgroup$
    – kelley
    Commented Mar 9 at 0:55

1 Answer 1

1
$\begingroup$

Resolution: It seems that libgazebo_ros_camera.so could not find libCameraPlugin.so When I tried with GazeboSim(Fortress) there was an error message to that effect. With classic Gazebo, I didn't see the error, but it still didn't work. This fixed it for me: source /usr/share/gazebo-11/setup.sh

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.