ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ROS fuerte plugin

asked 2012-10-18 05:39:57 -0600

this post is marked as community wiki

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

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 ... (more)

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2012-10-18 21:35:36 -0600

this post is marked as community wiki

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

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.

edit flag offensive delete link more
0

answered 2012-10-18 07:34:40 -0600

this post is marked as community wiki

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

This line in the launch file might be looking for camera.xacro in ~/.ros/camera.xacro:

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

Preferably, create a package for your work and use the name of your pacakge

<!-- send the erratic robot XML to param server -->
<param name="robot_description" command="$(find xacro)/xacro.py `$(find my_test_package)/camera.xacro`" />
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2012-10-18 05:39:57 -0600

Seen: 525 times

Last updated: Oct 19 '12