0
$\begingroup$

Rosanswers logo

Good evening,

I'm a little bit confused about the new configuration of the sensor controller. Now they are embedded in plugin structure. I'd like to run a camera device on gazebo ROS fuerte (Ubuntu 12.04).

My simple launch file is

<launch>
    <arg name="paused" default="true"/>
  <arg name="use_sim_time" default="false"/>
  <arg name="gui" default="true"/>

  <!-- set use_sim_time flag -->
  <group if="$(arg use_sim_time)">
    <param name="/use_sim_time" value="true" />
  </group>

  <!-- start empty world -->
  <group if="$(arg paused)">
      <node name="gazebo" pkg="gazebo" type="gazebo" args="-u $(find gazebo_worlds)/worlds/empty.world" respawn="false" output="screen"/>
  </group>

  <!-- start gui -->
  <group if="$(arg gui)">
    <node name="gazebo_gui" pkg="gazebo" type="gui" respawn="false" output="screen"/>
  </group>

    <!-- send the erratic robot XML to param server -->
    <param name="robot_description" command="$(find xacro)/xacro.py './camera.xacro'" />

    <!-- push robot_description to factory and spawn robot in gazebo -->
    <node name="spawn_robot" pkg="gazebo" type="spawn_model"
          args="-param robot_description
                -urdf
                -z 0.1
                -model robot_description"
          respawn="false" output="screen" />

    <!-- start robot state publisher -->
    <node pkg="robot_state_publisher" type="state_publisher" name="robot_state_publisher" output="screen" >
        <param name="publish_frequency" type="double" value="50.0" />
    </node>

<!--    <node pkg="fake_localization" type="fake_localization" name="fake_localization" respawn="true" output="screen" >-->
<!--        <param name="odom_frame_id" value="odom"/>-->
<!--    </node>-->
</launch>

where 'camera.xacro' file (I know that is deprecated but it is trivial to convert it in urdf ) is

<?xml version="1.0"?>

<robot  xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
        xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor" 
        xmlns:xacro="http://www.ros.org/wiki/xacro" 
        name="HummingBird">

<xacro:property name="id" value="0" />
<xacro:property name="PI"       value="3.141592653589793" />
<xacro:property name="HALF_PI"  value="1.570796326794897" />

<xacro:property name="body_size"  value="0.080" />
<xacro:property name="body_mass"  value="0.300" />
  <material name="body_color">
    <color rgba="1.0 0.0 0.0 1.0"/>
  </material>

  <gazebo reference="base_link">
    <material>Gazebo/Red</material>
  </gazebo>
   <link name="base_link">
    <visual>
      <geometry>
        <box size="${body_size} ${body_size} ${body_size}"/>
      </geometry>
      <origin xyz="0 0 0" rpy="0 0 0"/>
    </visual>

    <inertial>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <mass value="${body_mass}" />
      <inertia ixx="1e-5"  ixy="1e-10"  ixz="1e-10" iyy="1e-5" iyz="1e-10" izz="1e-5" />  
    </inertial>

    <collision>
      <geometry>
        <box size="${body_size} ${body_size} ${body_size}"/>
      </geometry>
    </collision>

  </link>

<gazebo reference="base_link">
      <sensor name='camera' type='camera' always_on='1' update_rate='30' visualize='true'>
        <camera>
          <horizontal_fov angle='1.57079633'/>
          <image width='640' height='480' format='R8G8B8'/>
          <clip near='0.1' far='100'/>
        </camera>
        <plugin name="camera_plugin" filename="libgazebo_ros_camera.so">
            <alwaysOn>true</alwaysOn>
            <imageTopicName>image_raw</imageTopicName>
            <cameraInfoTopicName>camera_info</cameraInfoTopicName>
            <updateRate>30.0</updateRate>
            <cameraName>overhead_camera</cameraName>
            <frameName>overhead_camera_frame</frameName>
            <CxPrime>320.5</CxPrime>
            <Cx>320.5</Cx>
            <Cy>240.5</Cy>
            <hackBaseline>0</hackBaseline>
            <focalLength>320.000101</focalLength>
            <distortionK1>0.0</distortionK1>
            <distortionK2>0.0</distortionK2>
            <distortionK3>0.0</distortionK3>
            <distortionT1>0.0</distortionT1>
            <distortionT2>0.0</distortionT2>
        </plugin>
      </sensor>
</gazebo>
</robot>

The real problem is that the launch file is correct and everything works. The problem is when I want to show the image (I assume that the topic name for the camera is image_raw or camera/image_raw) but any kind of this topic exist (I checked also with rostopic list).

Does anyone try the same plugin? The name is gazebo_ros_camera. If it is possible, paste your code.

Thanks in advance,

Neostek


Originally posted by Neostek on ROS Answers with karma: 156 on 2012-10-18

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I already tried it but without success. Thanks anyway for your answer. The problem is exactly the same. The point is the launch file loads the right xacro file but it seems it 'skips' the plugin tag.

After some modifications, it seems that if I create a .model file it is able to load the plugin, if I create a .xacro (or urdf) one it does not. Did someone try it? It seems there is no more compatibility with URDF, also if I read some posts where the compatibility is said to be ensured.


Originally posted by Neostek with karma: 156 on 2012-10-18

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

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