How to get ContainPlugin to publish to /contain topic?

asked 2018-09-21 05:58:12 -0600

kumpakri gravatar image

I need to get an information about robot entering certain area (or leaving the inverted selection of the area). I found two Gazebo plugins, who looks like they could do the job.

  1. ContainPlugin
  2. SimEventsPlugin with OccupiedEvent

Both of them are world plugins. I added the ContainPlugin into my .world file as shown below:

<sdf version='1.6'>
  <world name='garden'>

    <light name='sun' type='directional'>
      <pose frame=''>0 0 10 0 -0 0</pose>
      <diffuse>0.8 0.8 0.8 1</diffuse>
      <specular>0.2 0.2 0.2 1</specular>
      <direction>-0.5 0.1 -0.9</direction>


    <state world_name='garden'>
      <sim_time>1824 398000000</sim_time>
      <real_time>249 951103745</real_time>
      <wall_time>1537343867 753122405</wall_time>

      <model name='ground_plane'>
        <pose frame=''>0 0 0 0 -0 0</pose>
        <scale>1 1 1</scale>
        <link name='link'>
          <pose frame=''>0 0 0 0 -0 0</pose>
          <velocity>0 0 0 0 -0 0</velocity>
          <acceleration>0 0 0 0 -0 0</acceleration>
          <wrench>0 0 0 0 -0 0</wrench>

      <light name='sun'>
        <pose frame=''>0 0 10 0 -0 0</pose>

    <plugin name="ContainPlugin" filename="">
      <pose>15.4 0 2 0 0 0</pose>
          <size>15 4 6</size>


I import the world from a launch file. I also spawn the robot from a launch file. How I understand the text, after launching the world, a new topic /contain should be created and I should see it when using rostopic list command.

However, no such thing happens. The world launches without error or anything missing, just the topic doesn't exist. How can I make it work?

edit retag flag offensive close merge delete