# Plugin to set link velocity

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" />

<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>

<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"/>
</joint>

<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>

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

<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>
</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 ...

edit retag close merge delete