# Attach plugin to included laser model

Hello,

My sdf model contains an included Hokuyo laser, and I tried to attach the rather standard libgazebo_ros_gpu_laser.so plugin, as follows:

<model name="my_laser">
<include>
<uri>model://hokuyo</uri>
<pose>-0.22 0 0.10500000000000001 0 0 3.141592653589793</pose>
<plugin name="laser_plugin" filename="libgazebo_ros_gpu_laser.so" />
</include>
</model>


I get this error:

Model[my_laser] is attempting to load a plugin, but detected an incorrect plugin type.


Indeed, from what I see in the example, the plugin is meant for <sensor> elements.

So can I access the sensor itself, and attach the plugin to it directly?

If not, how do you suggest I use the plugin?

Thanks,

edit retag close merge delete

Sort by » oldest newest most voted

Hi Kaldo, I'm also using the "libgazebo_ros_gpu_laser.so" plugin on my model, but my model is in URDF format (I would not think that it matters). I initially had problems getting my laser to work but somewhere I found an answer from someone (I don't remember who answered or where I found it).

Here is what I have in my URDF file:

<gazebo reference="base_link">
<sensor type ="gpu_ray" name="hoyuko">
<pose>0.19391 0.00126 0.28877 0 0 0</pose>
<visualize>true</visualize>
<update_rate>20</update_rate>
<ray>
<scan>
<horizontal>
<samples>720</samples>
<resolution>1</resolution>
<min_angle>-1.570796</min_angle>
<max_angle>1.570796</max_angle>
</horizontal>
</scan>
<range>
<min>0.10</min>
<max>2.5</max>
<resolution>0.01</resolution>
</range>
</ray>
<plugin name="gpu_laser" filename="libgazebo_ros_gpu_laser.so">
<topicName>/scan</topicName>
</plugin>
</sensor>
</gazebo>


In your file try changing <plugin name="laser_plugin" filename="libgazebo_ros_gpu_laser.so" /> to <plugin name="gpu_laser" filename="libgazebo_ros_gpu_laser.so">.

I tried several different combinations before mine worked, but I think it was this change that actually did the trick. Give it a try and see what happens. Hopefully it will work for you.

Mike

more