Plugin to set link velocity

asked 2017-12-22 14:25:30 -0500

monabf gravatar image

updated 2017-12-22 16:01:16 -0500

Hi everyone,

I am simulating a drone in gazebo using the Erle-Robotics tutorials, and I have found that in Circle mode I cannot make the drone point toward the center of the circle easily (see this question). Therefore, I want to use the plugins referred to in this tutorial to make the lidar sitting on the drone always turns at the same speed at the drone and always points towards the center of the circle. However I am having trouble using the plugin.

I followed the tutorial steps to build the plugin, did

export GAZEBO_PLUGIN_PATH=~/simulation/gazebo_tutorials/set_velocity/examples/set_vel_plugin/build/

to where the shared .so file is, and I included the plugin in my urdf as follows:

<?xml version="1.0"?>

<robot  name="lidar" xmlns:xacro="http://ros.org/wiki/xacro">

  <xacro:property name="name" value="sonar2" />
  <xacro:property name="ros_topic" value="velodyne" />
  <xacro:property name="update_rate" value="5"/> 
  <xacro:property name="min_range" value="0.5"/>
  <xacro:property name="max_range" value="25" /> 


    <link name="base_lidar">
      <inertial>
        <mass value="100" />
        <origin xyz="0 0 0" rpy="0 0 0" />
        <inertia ixx="0.17" ixy="0" ixz="0" iyy="0.17" iyz="0" izz="0.17" />
      </inertial>
    </link> 

    <joint name="lidar_joint" type="revolute">
      <origin xyz="0 0 0" rpy="0 0 0" />
      <axis xyz="0 0 1"/>
      <limit effort="1000.0" lower="0.0" upper="0.548" velocity="0.5"/> 
      <parent link="base_lidar" />
      <child link="sonar2_link" />
    </joint> 

    <link name="sonar2_link">
      <inertial>
        <mass value="100" />
        <origin xyz="0 0 0" rpy="0 0 0" />
        <inertia ixx="0.17" ixy="0" ixz="0" iyy="0.17" iyz="0" izz="0.17" />
      </inertial>
    </link> 

    <gazebo reference="sonar2_link">
      <plugin name="set_vel_plugin" filename="~/simulation/gazebo_tutorials/set_velocity/examples/set_vel_plugin/build/libSetJointVelocityPlugin.so">
      </plugin>
    </gazebo>

    <gazebo reference="sonar2_link">
      <sensor type="ray" name="sonar2">
        <always_on>true</always_on>
        <update_rate>5</update_rate>
        <pose>0 0 0 0 0 0</pose>
        <visualize>true</visualize>
        <ray>
          <scan>
            <horizontal>
              <samples>200</samples>
              <resolution>0.5</resolution>
                <min_angle>-0.5</min_angle>
                <max_angle>0.5</max_angle>
            </horizontal>
            <vertical>
              <samples>200</samples>
              <resolution>0.5</resolution>
                <min_angle>-0.26</min_angle>
                <max_angle>0.26</max_angle>
            </vertical>
          </scan>
          <range>
            <min>0.5</min>
            <max>25</max>
            <resolution>1</resolution>
          </range>
        </ray>
    <plugin name="gazebo_ros_sonar2_controller" filename="libgazebo_ros_block_laser.so">
    <updateRate>5</updateRate>
          <topicName>/scan</topicName>
          <frameName>sonar2_link_run</frameName>
    </plugin> 
      </sensor>
    </gazebo> 

     <gazebo>
       <static>true</static>
    <turnGravityOff>true</turnGravityOff>
    </gazebo>
</robot>

However when I launch my launch file including this urdf, I get the error:

Warning [parser.cc:778] XML Element[plugin], child of element[link] not defined in SDF. Ignoring[plugin]. You may have an incorrect SDF file, or an sdformat version that doesn't support this element.

What am I doing wrong? Is there an easier way to setup the lidar sitting on my drone so that it turns around its axis at a given speed? The rest of the simulation runs fine and I had no error until then. Any help would be greatly appreciated! (On that or on my original question concerning Circle mode, by the way)

EDIT ... (more)

edit retag flag offensive close merge delete