|
| 1 | +<?xml version="1.0" ?> |
| 2 | +<!-- |
| 3 | + An example world to demo how logical audio sources and microphones interact. |
| 4 | +
|
| 5 | + 2 sources are created, which are attached to a red and blue box. |
| 6 | + 2 microphones are created, which are attached to a green and yellow box. |
| 7 | +
|
| 8 | + The boxes can be moved to mimic sensors attached to a moving robot. |
| 9 | +
|
| 10 | + To start and stop the audio sources, use the <PREFIX>/source_<id>/play and |
| 11 | + <PREFIX>/source_<id>/stop service calls. |
| 12 | +
|
| 13 | + To play the source attached to the blue box, run the following command: |
| 14 | + ign service -s /model/blue_box/sensor/source_1/play |
| 15 | + --reqtype ignition.msgs.Empty --reptype ignition.msgs.Boolean |
| 16 | + --timeout 1000 --req 'unused: false' |
| 17 | +
|
| 18 | + To stop the source attached to the blue box, run the following command: |
| 19 | + ign service -s /model/blue_box/sensor/source_1/stop |
| 20 | + --reqtype ignition.msgs.Empty --reptype ignition.msgs.Boolean |
| 21 | + --timeout 1000 --req 'unused: false' |
| 22 | +
|
| 23 | + To observe microphone detections, use the <PREFIX>/mic_<id>/detection topic. |
| 24 | +
|
| 25 | + The following command will display detections heard by the microphone attached |
| 26 | + to the green box: |
| 27 | + ign topic -e -t /model/green_box/sensor/mic_1/detection |
| 28 | +--> |
| 29 | +<sdf version="1.6"> |
| 30 | + <world name="logical_audio_sensor"> |
| 31 | + <physics name="1ms" type="ignored"> |
| 32 | + <max_step_size>0.001</max_step_size> |
| 33 | + <real_time_factor>1.0</real_time_factor> |
| 34 | + </physics> |
| 35 | + <plugin |
| 36 | + filename="ignition-gazebo-physics-system" |
| 37 | + name="ignition::gazebo::systems::Physics"> |
| 38 | + </plugin> |
| 39 | + <plugin |
| 40 | + filename="ignition-gazebo-user-commands-system" |
| 41 | + name="ignition::gazebo::systems::UserCommands"> |
| 42 | + </plugin> |
| 43 | + <plugin |
| 44 | + filename="ignition-gazebo-scene-broadcaster-system" |
| 45 | + name="ignition::gazebo::systems::SceneBroadcaster"> |
| 46 | + </plugin> |
| 47 | + |
| 48 | + <scene> |
| 49 | + <ambient>1.0 1.0 1.0</ambient> |
| 50 | + <background>0.8 0.8 0.8</background> |
| 51 | + </scene> |
| 52 | + |
| 53 | + <light type="directional" name="sun"> |
| 54 | + <cast_shadows>true</cast_shadows> |
| 55 | + <pose>0 0 10 0 0 0</pose> |
| 56 | + <diffuse>0.8 0.8 0.8 1</diffuse> |
| 57 | + <specular>0.8 0.8 0.8 1</specular> |
| 58 | + <attenuation> |
| 59 | + <range>1000</range> |
| 60 | + <constant>0.9</constant> |
| 61 | + <linear>0.01</linear> |
| 62 | + <quadratic>0.001</quadratic> |
| 63 | + </attenuation> |
| 64 | + <direction>-0.5 0.1 -0.9</direction> |
| 65 | + </light> |
| 66 | + |
| 67 | + <model name="ground_plane"> |
| 68 | + <static>true</static> |
| 69 | + <link name="link"> |
| 70 | + <collision name="collision"> |
| 71 | + <geometry> |
| 72 | + <plane> |
| 73 | + <normal>0 0 1</normal> |
| 74 | + </plane> |
| 75 | + </geometry> |
| 76 | + </collision> |
| 77 | + <visual name="visual"> |
| 78 | + <geometry> |
| 79 | + <plane> |
| 80 | + <normal>0 0 1</normal> |
| 81 | + <size>100 100</size> |
| 82 | + </plane> |
| 83 | + </geometry> |
| 84 | + <material> |
| 85 | + <ambient>0.8 0.8 0.8 1</ambient> |
| 86 | + <diffuse>0.8 0.8 0.8 1</diffuse> |
| 87 | + <specular>0.8 0.8 0.8 1</specular> |
| 88 | + </material> |
| 89 | + </visual> |
| 90 | + </link> |
| 91 | + </model> |
| 92 | + |
| 93 | + <model name="red_box"> |
| 94 | + <pose>0 0 0.5 0 0 0</pose> |
| 95 | + <link name="box_link"> |
| 96 | + <inertial> |
| 97 | + <inertia> |
| 98 | + <ixx>1</ixx> |
| 99 | + <ixy>0</ixy> |
| 100 | + <ixz>0</ixz> |
| 101 | + <iyy>1</iyy> |
| 102 | + <iyz>0</iyz> |
| 103 | + <izz>1</izz> |
| 104 | + </inertia> |
| 105 | + <mass>1.0</mass> |
| 106 | + </inertial> |
| 107 | + <collision name="box_collision"> |
| 108 | + <geometry> |
| 109 | + <box> |
| 110 | + <size>1 1 1</size> |
| 111 | + </box> |
| 112 | + </geometry> |
| 113 | + </collision> |
| 114 | + <visual name="box_visual"> |
| 115 | + <geometry> |
| 116 | + <box> |
| 117 | + <size>1 1 1</size> |
| 118 | + </box> |
| 119 | + </geometry> |
| 120 | + <material> |
| 121 | + <ambient>1 0 0 1</ambient> |
| 122 | + <diffuse>1 0 0 1</diffuse> |
| 123 | + <specular>1 0 0 1</specular> |
| 124 | + </material> |
| 125 | + </visual> |
| 126 | + </link> |
| 127 | + <plugin filename="ignition-gazebo-logicalaudiosensorplugin-system" name="ignition::gazebo::systems::LogicalAudioSensorPlugin"> |
| 128 | + <source> |
| 129 | + <id>1</id> |
| 130 | + <pose>.5 0 0 0 0 0</pose> |
| 131 | + <attenuation_function>linear</attenuation_function> |
| 132 | + <attenuation_shape>sphere</attenuation_shape> |
| 133 | + <inner_radius>1.0</inner_radius> |
| 134 | + <falloff_distance>5.0</falloff_distance> |
| 135 | + <volume_level>.8</volume_level> |
| 136 | + <playing>true</playing> |
| 137 | + <play_duration>10</play_duration> |
| 138 | + </source> |
| 139 | + </plugin> |
| 140 | + </model> |
| 141 | + |
| 142 | + <model name="blue_box"> |
| 143 | + <pose>3 3 0.5 0 0 0</pose> |
| 144 | + <link name="box_link"> |
| 145 | + <inertial> |
| 146 | + <inertia> |
| 147 | + <ixx>1</ixx> |
| 148 | + <ixy>0</ixy> |
| 149 | + <ixz>0</ixz> |
| 150 | + <iyy>1</iyy> |
| 151 | + <iyz>0</iyz> |
| 152 | + <izz>1</izz> |
| 153 | + </inertia> |
| 154 | + <mass>1.0</mass> |
| 155 | + </inertial> |
| 156 | + <collision name="box_collision"> |
| 157 | + <geometry> |
| 158 | + <box> |
| 159 | + <size>1 1 1</size> |
| 160 | + </box> |
| 161 | + </geometry> |
| 162 | + </collision> |
| 163 | + <visual name="box_visual"> |
| 164 | + <geometry> |
| 165 | + <box> |
| 166 | + <size>1 1 1</size> |
| 167 | + </box> |
| 168 | + </geometry> |
| 169 | + <material> |
| 170 | + <ambient>0 0 1 1</ambient> |
| 171 | + <diffuse>0 0 1 1</diffuse> |
| 172 | + <specular>0 0 1 1</specular> |
| 173 | + </material> |
| 174 | + </visual> |
| 175 | + </link> |
| 176 | + <plugin filename="ignition-gazebo-logicalaudiosensorplugin-system" name="ignition::gazebo::systems::LogicalAudioSensorPlugin"> |
| 177 | + <source> |
| 178 | + <id>1</id> |
| 179 | + <pose>0 0 0 0 0 0</pose> |
| 180 | + <attenuation_function>linear</attenuation_function> |
| 181 | + <attenuation_shape>sphere</attenuation_shape> |
| 182 | + <inner_radius>5.0</inner_radius> |
| 183 | + <falloff_distance>100.0</falloff_distance> |
| 184 | + <volume_level>.6</volume_level> |
| 185 | + <playing>false</playing> |
| 186 | + <play_duration>0</play_duration> |
| 187 | + </source> |
| 188 | + </plugin> |
| 189 | + </model> |
| 190 | + |
| 191 | + <model name="green_box"> |
| 192 | + <pose>0 2 0.5 0 0 0</pose> |
| 193 | + <link name="box_link"> |
| 194 | + <inertial> |
| 195 | + <inertia> |
| 196 | + <ixx>1</ixx> |
| 197 | + <ixy>0</ixy> |
| 198 | + <ixz>0</ixz> |
| 199 | + <iyy>1</iyy> |
| 200 | + <iyz>0</iyz> |
| 201 | + <izz>1</izz> |
| 202 | + </inertia> |
| 203 | + <mass>1.0</mass> |
| 204 | + </inertial> |
| 205 | + <collision name="box_collision"> |
| 206 | + <geometry> |
| 207 | + <box> |
| 208 | + <size>1 1 1</size> |
| 209 | + </box> |
| 210 | + </geometry> |
| 211 | + </collision> |
| 212 | + <visual name="box_visual"> |
| 213 | + <geometry> |
| 214 | + <box> |
| 215 | + <size>1 1 1</size> |
| 216 | + </box> |
| 217 | + </geometry> |
| 218 | + <material> |
| 219 | + <ambient>0 1 0 1</ambient> |
| 220 | + <diffuse>0 1 0 1</diffuse> |
| 221 | + <specular>0 1 0 1</specular> |
| 222 | + </material> |
| 223 | + </visual> |
| 224 | + </link> |
| 225 | + <plugin filename="ignition-gazebo-logicalaudiosensorplugin-system" name="ignition::gazebo::systems::LogicalAudioSensorPlugin"> |
| 226 | + <microphone> |
| 227 | + <id>1</id> |
| 228 | + <pose>0 .5 0 0 0 0</pose> |
| 229 | + <volume_threshold>.4</volume_threshold> |
| 230 | + </microphone> |
| 231 | + </plugin> |
| 232 | + </model> |
| 233 | + |
| 234 | + <model name="yellow_box"> |
| 235 | + <pose>-5 4 0.5 0 0 0</pose> |
| 236 | + <link name="box_link"> |
| 237 | + <inertial> |
| 238 | + <inertia> |
| 239 | + <ixx>1</ixx> |
| 240 | + <ixy>0</ixy> |
| 241 | + <ixz>0</ixz> |
| 242 | + <iyy>1</iyy> |
| 243 | + <iyz>0</iyz> |
| 244 | + <izz>1</izz> |
| 245 | + </inertia> |
| 246 | + <mass>1.0</mass> |
| 247 | + </inertial> |
| 248 | + <collision name="box_collision"> |
| 249 | + <geometry> |
| 250 | + <box> |
| 251 | + <size>1 1 1</size> |
| 252 | + </box> |
| 253 | + </geometry> |
| 254 | + </collision> |
| 255 | + <visual name="box_visual"> |
| 256 | + <geometry> |
| 257 | + <box> |
| 258 | + <size>1 1 1</size> |
| 259 | + </box> |
| 260 | + </geometry> |
| 261 | + <material> |
| 262 | + <ambient>1 1 0 1</ambient> |
| 263 | + <diffuse>1 1 0 1</diffuse> |
| 264 | + <specular>1 1 0 1</specular> |
| 265 | + </material> |
| 266 | + </visual> |
| 267 | + </link> |
| 268 | + <plugin filename="ignition-gazebo-logicalaudiosensorplugin-system" name="ignition::gazebo::systems::LogicalAudioSensorPlugin"> |
| 269 | + <microphone> |
| 270 | + <id>1</id> |
| 271 | + <pose>0.5 0.5 0.5 0 0 0</pose> |
| 272 | + <volume_threshold>.3</volume_threshold> |
| 273 | + </microphone> |
| 274 | + </plugin> |
| 275 | + </model> |
| 276 | + </world> |
| 277 | +</sdf> |
0 commit comments