model.xacro 3.33 KB
Newer Older
Ricardo Rico Uribe's avatar
Ricardo Rico Uribe committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?xml version="1.0" ?>
<!-- 
  Copyright (c) 2016 The UUV Simulator Authors.
  All rights reserved.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

  Re-scaled by Louise Poubel


  Copyright (c) 2019 Rhys Mainwaring.
  Modified to include wave field model and visual plugins.
-->



<world xmlns:xacro="http://ros.org/wiki/xacro">
  <xacro:macro name="ocean_waves" params="gain:=0.1 period:=5
                     direction_x:=1.0 direction_y:=0.0
                     angle:=0.4">
  <model name='ocean_waves'>
    <static>true</static>
    <plugin name="wavefield_plugin" filename="libWavefieldModelPlugin.so">
      <static>false</static>
      <update_rate>30</update_rate>
      <size>1000 1000</size>
      <cell_count>50 50</cell_count>
      <wave>
				<model>PMS</model>
        <period>${period}</period>
        <number>3</number>
        <scale>1.5</scale>
      S	<gain>${gain}</gain>
        <direction>${direction_x} ${direction_y}</direction>
        <angle>${angle}</angle>        
        <tau>2.0</tau>
        <amplitude>0.0</amplitude>  <!-- No effect for the PMS model -->
        <steepness>0.0</steepness>
      </wave>
    </plugin>

    <link name="ocean_waves_link">
      <visual name="ocean_waves_visual">
        <plugin name="ocean_waves_visual_plugin" filename="libWavefieldVisualPlugin.so">
          <enableRtt>true</enableRtt>
          <rttNoise>0.1</rttNoise>
          <refractOpacity>0.2</refractOpacity>
          <reflectOpacity>0.2</reflectOpacity>
          <wave>
            <model>PMS</model>
            <period>${period}</period>
            <number>3</number>
            <scale>1.5</scale>
	    <gain>${gain}</gain>
            <direction>${direction_x} ${direction_y}</direction>
            <angle>${angle}</angle>        
            <tau>2.0</tau>
            <amplitude>0.0</amplitude>  <!-- No effect for the PMS model -->
            <steepness>0.0</steepness>
          </wave>
        </plugin>
        <geometry>
          <mesh>
            <uri>model://ocean_waves/meshes/mesh.dae</uri>
          </mesh>
        </geometry>
        <material>
          <script>
            <uri>model://ocean_waves/materials/scripts/waves.material</uri>
            <name>WaveSim/GerstnerWaves</name>
          </script>
        </material>
        <laser_retro>-1</laser_retro>
      </visual>
      <visual name="ocean_waves_below_visual">
        <pose>0 0 -0.05 0 0 0</pose>  <!-- Offset to prevent rendering conflict -->
        <geometry>
          <mesh>
            <uri>model://ocean_waves/meshes/mesh_below.dae</uri>
          </mesh>
        </geometry>
        <material>
          <script>
            <uri>model://ocean_waves/materials/scripts/waves.material</uri>
            <name>WaveSim/GerstnerWaves</name>
          </script>
        </material>
        <laser_retro>-1</laser_retro>
      </visual>
    </link>
  </model>
  </xacro:macro>
</world>