Jump to content

Webots Odor Simulation/Deploying Odor Sources

From Wikibooks, open books for an open world

Similar to the odor and wind sensors, an odor source is simply a normal Webots object with a special DEF name. The magic DEF name here is SOURCE_ODOR_#, where # must be a unique number (1-16), and the object to create is a solid.

Your first source could look like this in your world file (see worlds/odor_test.wbt for an example):

DEF SOURCE_ODOR_1 Solid {
  translation 1 0.05 0
  children [
    Shape {
      appearance Appearance {
        material Material {
          diffuseColor 1 1 1
        }
        texture ImageTexture {
          url [
            "textures/strips.png"
          ]
        }
      }
      geometry DEF CYLINDER_SOURCE_ODOR Cylinder {
        height 0.1
        radius 0.1
      }
    }
  ]
  name "source_odor"
  boundingObject USE CYLINDER_SOURCE_ODOR
}

Just as for the sensors, the world field does not contain any configuration of the odor source. This is done in the odor simulation plugin. Hence, changing the shape or the size of the solid does not change the area in which the odor filaments are released.