Commit d4c095dda975549c8b08b7a45d4ccb098e49c20b

Authored by Ricardo Rico Uribe
1 parent e714f54c

gazebo core dump corrected - with spawn of wamv

Showing 100 changed files with 210 additions and 57896 deletions   Show diff stats
@@ -0,0 +1,210 @@ @@ -0,0 +1,210 @@
  1 +# Aquanaute
  2 +
  3 +Repository to simulate the Aquanaute boat in maritime conditions such as wind and waves with the plugins created for the VRX and VRX-Challenge in Gazebo and ROS.
  4 +
  5 +## Installation
  6 +
  7 +* Clone this repo to a Catkin Workspace
  8 +* Clone the VRX repo to the same Workspace (https://github.com/osrf/vrx)
  9 +* In the path
  10 + ```
  11 + "workspace"/src/vrx/vrx_gazebo/launch/
  12 + ```
  13 + create a new launch file "name".launch and copy the code provided below
  14 +* In the path
  15 + ```
  16 + "workspace"/src/vrx/vrx_gazebo/worlds/ocean.world.xacro
  17 + ```
  18 + delete the contents of the file and replace them with the code provided below
  19 +
  20 +## Usage
  21 +### modify wind and waves
  22 + in the ocean.world.xacro you have
  23 + ```xml
  24 + <!--Waves-->
  25 + <xacro:include filename="$(find wave_gazebo)/world_models/ocean_waves/model.xacro"/>
  26 + <xacro:ocean_waves gain="0.0" period="5" direction_x="-1.0" direction_y="0.0" angle="0.0"/>
  27 +
  28 + <!--Wind for the WAM-V. Note, wind parameters are set in the plug.-->
  29 + <xacro:include filename="$(find vrx_gazebo)/worlds/xacros/usv_wind_plugin.xacro"/>
  30 + <xacro:usv_wind_gazebo direction="90" mean_vel="0" var_gain="5" var_time="1">
  31 + <wind_objs>
  32 + <wind_obj>
  33 + <name>wamv</name>
  34 + <link_name>base_link</link_name>
  35 + <coeff_vector>0.5 0.5 0.33</coeff_vector>
  36 + </wind_obj>
  37 + </wind_objs>
  38 + </xacro:usv_wind_gazebo>
  39 + ```
  40 + it is configured to have no waves and no wind, also the wind and the waves move in the same direction, to activate wind and waves change the "mean_vel" and "gain" parameters respectively (recomended values are smaller than 1.0)
  41 +### run
  42 +in the workspace run the command at the beginning (and every time you change a parameter)
  43 +```bash
  44 +catkin_make
  45 +```
  46 +then launch the file you created
  47 +```bash
  48 +roslaunch vrx_gazebo name.launch
  49 +```
  50 +## Author
  51 +Ricardo RICO URIBE intern at U2IS in the summer of 2020
  52 +
  53 +## Code
  54 +### .launch
  55 +```xml
  56 +<?xml version="1.0"?>
  57 +<launch>
  58 + <env name="ROSCONSOLE_CONFIG_FILE" value="$(find vrx_gazebo)/config/custom_rosconsole.conf"/>
  59 + <!-- Gazebo world to load -->
  60 + <arg name="world" default="$(find vrx_gazebo)/worlds/ocean.world" />
  61 + <!-- If true, run gazebo GUI -->
  62 + <arg name="gui" default="true" />
  63 + <!-- If true, run gazebo in verbose mode -->
  64 + <arg name="verbose" default="true"/>
  65 + <!-- If true, start in paused state -->
  66 + <arg name="paused" default="false"/>
  67 + <!-- Set various other gazebo arguments-->
  68 + <arg name="extra_gazebo_args" default=""/>
  69 + <!-- Start in a default namespace -->
  70 + <arg name="namespace" default="wamv"/>
  71 +
  72 + <!-- Initial USV location and attitude-->
  73 + <arg name="x" default="0" />
  74 + <arg name="y" default="0" />
  75 + <arg name="z" default="0.1" />
  76 + <arg name="P" default="0" />
  77 + <arg name="R" default="0" />
  78 + <arg name="Y" default="0" />
  79 +
  80 + <!-- If true, show non-competition ROS topics (/gazebo/model_states, /vrx/debug/wind/direction, etc.)-->
  81 + <arg name="non_competition_mode" default="true"/>
  82 + <arg name="enable_ros_network" value="$(arg non_competition_mode)"/>
  83 + <env name="VRX_DEBUG" value="$(arg non_competition_mode)"/>
  84 + <env unless="$(arg non_competition_mode)" name="GAZEBO_MODEL_PATH" value="$(find vrx_gazebo)/models:$(find wamv_gazebo)/models:$(find wamv_description)/models:$(optenv GAZEBO_MODEL_PATH)"/>
  85 +
  86 + <!-- Allow user specified thruster configurations
  87 + H = stern trusters on each hull
  88 + T = H with a lateral thruster
  89 + X = "holonomic" configuration -->
  90 + <arg name="thrust_config" default="H" />
  91 +
  92 + <!-- Do you want to enable sensors? -->
  93 + <arg name="camera_enabled" default="false" />
  94 + <arg name="gps_enabled" default="false" />
  95 + <arg name="imu_enabled" default="false" />
  96 + <arg name="lidar_enabled" default="false" />
  97 + <arg name="ground_truth_enabled" default="false" />
  98 +
  99 + <!-- Start Gazebo with the world file -->
  100 + <include file="$(find gazebo_ros)/launch/empty_world.launch">
  101 + <arg name="world_name" value="$(arg world)"/>
  102 + <arg name="verbose" value="$(arg verbose)"/>
  103 + <arg name="paused" value="$(arg paused)"/>
  104 + <arg name="use_sim_time" value="true"/>
  105 + <arg name="gui" value="$(arg gui)" />
  106 + <arg name="enable_ros_network" value="$(arg enable_ros_network)"/>
  107 + <arg name="extra_gazebo_args" value="$(arg extra_gazebo_args)"/>
  108 + </include>
  109 +
  110 + <!-- Load robot model -->
  111 + <arg name="urdf" default="$(find wamv_gazebo)/urdf/wamv_gazebo.urdf.xacro"/>
  112 + <param name="$(arg namespace)/robot_description"
  113 + command="$(find xacro)/xacro &#x002D;&#x002D;inorder '$(arg urdf)'
  114 + thruster_config:=$(arg thrust_config)
  115 + camera_enabled:=$(arg camera_enabled)
  116 + gps_enabled:=$(arg gps_enabled)
  117 + imu_enabled:=$(arg imu_enabled)
  118 + lidar_enabled:=$(arg lidar_enabled)
  119 + ground_truth_enabled:=$(arg ground_truth_enabled)
  120 + namespace:=$(arg namespace) "/>
  121 +
  122 + <!-- Spawn model in Gazebo, script depending on non_competition_mode -->
  123 + <node name="spawn_model" pkg="gazebo_ros" type="spawn_model" if="$(arg non_competition_mode)"
  124 + args="-x $(arg x) -y $(arg y) -z $(arg z)
  125 + -R $(arg R) -P $(arg P) -Y $(arg Y)
  126 + -urdf -param $(arg namespace)/robot_description -model wamv"/>
  127 +
  128 + <node name="spawn_wamv" pkg="vrx_gazebo" type="spawn_wamv.bash" unless="$(arg non_competition_mode)"
  129 + args="-x $(arg x) -y $(arg y) -z $(arg z)
  130 + -R $(arg R) -P $(arg P) -Y $(arg Y)
  131 + --urdf $(arg urdf) --model wamv"/>
  132 +</launch>
  133 +```
  134 +### ocean.world.xacro
  135 +```xml
  136 +<?xml version="1.0" ?>
  137 +<!--
  138 + Copyright (C) 2019 Rhys Mainwaring
  139 +
  140 +
  141 + Licensed under the Apache License, Version 2.0 (the "License");
  142 + you may not use this file except in compliance with the License.
  143 + You may obtain a copy of the License at
  144 +
  145 + http://www.apache.org/licenses/LICENSE-2.0
  146 +
  147 + Unless required by applicable law or agreed to in writing, software
  148 + distributed under the License is distributed on an "AS IS" BASIS,
  149 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  150 + See the License for the specific language governing permissions and
  151 + limitations under the License.
  152 +
  153 +-->
  154 +<sdf version="1.6"
  155 + xmlns:xacro="http://ros.org/wiki/xacro">
  156 + <world name="ocean_world">
  157 +
  158 + <!-- GUI -->
  159 + <gui>
  160 + <plugin name="keyboard_gui_plugin" filename="libKeyboardGUIPlugin.so"/>
  161 + <camera name='user_camera'>
  162 + <pose frame=''>40 40 20 0 0.4 180</pose>
  163 + <view_controller>orbit</view_controller>
  164 + <projection_type>perspective</projection_type>
  165 + </camera>
  166 + </gui>
  167 +
  168 + <!-- Scene -->
  169 + <scene>
  170 + <sky>
  171 + <time>10</time>
  172 + <sunrise>6</sunrise>
  173 + <sunset>18</sunset>
  174 + <clouds>
  175 + <speed>12</speed>
  176 + <direction>1.57079</direction>
  177 + </clouds>
  178 + </sky>
  179 + <grid>false</grid>
  180 + <origin_visual>false</origin_visual>
  181 + </scene>
  182 +
  183 + <!-- Lights -->
  184 + <include>
  185 + <uri>model://sun</uri>
  186 + </include>
  187 +
  188 + <!--Waves-->
  189 + <xacro:include filename="$(find wave_gazebo)/world_models/ocean_waves/model.xacro"/>
  190 + <xacro:ocean_waves gain="0.0" period="5" direction_x="-1.0" direction_y="0.0" angle="0.0"/>
  191 +
  192 + <!--Wind for the WAM-V. Note, wind parameters are set in the plug.-->
  193 + <xacro:include filename="$(find vrx_gazebo)/worlds/xacros/usv_wind_plugin.xacro"/>
  194 + <xacro:usv_wind_gazebo direction="90" mean_vel="0" var_gain="5" var_time="1">
  195 + <wind_objs>
  196 + <wind_obj>
  197 + <name>wamv</name>
  198 + <link_name>base_link</link_name>
  199 + <coeff_vector>0.5 0.5 0.33</coeff_vector>
  200 + </wind_obj>
  201 + </wind_objs>
  202 + </xacro:usv_wind_gazebo>
  203 + </world>
  204 +</sdf>
  205 +
  206 +```
  207 +
  208 +## License
  209 +
  210 +
usv_gazebo_plugins/CHANGELOG.rst deleted
@@ -1,258 +0,0 @@ @@ -1,258 +0,0 @@
1 -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
2 -Changelog for package usv_gazebo_plugins  
3 -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
4 -  
5 -1.3.0 (2019-12-26)  
6 -------------------  
7 -* Make code_check happy.  
8 -* Mod to make use of maxCmd and update to .hgignore  
9 -* Contributors: Brian Bingham <briansbingham@gmail.com>, Carlos Aguero  
10 -  
11 -1.2.6 (2019-10-04)  
12 -------------------  
13 -  
14 -1.2.5 (2019-09-19)  
15 -------------------  
16 -* merging default into branch  
17 -* Changes for code checker  
18 -* Contributors: Brian Bingham <briansbingham@gmail.com>  
19 -  
20 -1.2.4 (2019-09-12)  
21 -------------------  
22 -  
23 -1.2.3 (2019-09-12)  
24 -------------------  
25 -* Minor maintenance updates.  
26 -* Fix style error.  
27 -* Adding a default value for the length_n plugin parameter  
28 -* Contributors: Brian Bingham <briansbingham@gmail.com>, Carlos Aguero, Carlos Aguero <caguero@osrfoundation.org>  
29 -  
30 -1.2.2 (2019-09-06)  
31 -------------------  
32 -  
33 -1.2.1 (2019-09-05)  
34 -------------------  
35 -* updated comments  
36 -* minor cleanup + env flag + disable z  
37 -* Namespace tweaks.  
38 -* Style changes.  
39 -* gazebo 7 bug fix  
40 -* removed from wamv  
41 -* gazebo 7 compatibility  
42 -* force vectors are correct; scaling added  
43 -* Contributors: Carlos Aguero, Rumman Waqar <rumman.waqar05@gmail.com>  
44 -  
45 -1.2.0 (2019-08-19)  
46 -------------------  
47 -* Deterministic wind.  
48 -* Add v3d plugin - this publishes a vecotr based on the world frame velocity in Gazebo  
49 - Update gps configuration to add gazebo gps and v3d plugins to standard configuration  
50 -* Add plugin for ROS interface to gazebo GPS sensor.  
51 -* added cylinder placeholder  
52 -* incremental  
53 -* added plate and sphere models  
54 -* functional for cubes  
55 -* added force visual plugin  
56 -* Contributors: Carlos Aguero, Jonathan Wheare <jonathan.wheare@flinders.edu.au>, MarshallRawson, Rumman Waqar <rumman.waqar05@gmail.com>  
57 -  
58 -1.1.2 (2019-07-10)  
59 -------------------  
60 -* usv_gazebo_wind_plugin.hh changes  
61 -* Contributors: Brian Bingham <briansbingham@gmail.com>, Carlos Agüero <cen.aguero@gmail.com>, Rumman Waqar <rumman.waqar05@gmail.com>  
62 -  
63 -1.1.1 (2019-07-03)  
64 -------------------  
65 -* Reinterpret the wind 'gain' parameter. Set defaults to zero  
66 -* updated style for buoyancy plugin  
67 -* Contributors: Brian Bingham <briansbingham@gmail.com>, Rumman Waqar <rumman.waqar05@gmail.com>  
68 -  
69 -1.1.0 (2019-07-01)  
70 -------------------  
71 -* Refactor SpinPropeller to be more clear and match style of RotateEngine  
72 -* Publish joint state for chassis engine joint to fix tf tree issue  
73 -* addressed Brian's comments  
74 -* Connecting wave model to buoyancy plugin  
75 -* buoyancy now uses wave height  
76 -* capitalized brief sentences  
77 -* gazebo 7 vector3[] operator lhv error fixed try 2  
78 -* gazebo 7 vector3[] operator lhv error fixed  
79 -* gazebo <= 8 fixes for Mass and AngularVel  
80 -* complex objects + xacro cleanup  
81 -* force applied in correct place  
82 -* centroid + volume complete  
83 -* moved shape volume into its own file and renamed classes  
84 -* tiny refactor  
85 -* polyhedron class finished and tests passed  
86 -* implemented polyhedron based cube + cylinder submerged volume and cov  
87 -* rotation bug fix  
88 -* basic volume for box, sphere and cylinder  
89 -* removed old volume data structure + created skeleton for volume calc  
90 -* removed old volume data structure + created skeleton for volume calc  
91 -* added move constructor for buoyancy object and remove copy constructor  
92 -* added links and buoyancy object to plugin  
93 -* minor cleanup  
94 -* added pose for buoyancy element  
95 -* parsed buoyancy shape now saved as unique_ptr  
96 -* cleaned up parsing  
97 -* updated buoyancy xacro + parsing  
98 -* Setup buoyancy test build system + test world  
99 -* merging with default - need to check wind  
100 -* added wind capabilities  
101 -* Removing gazebo::msg::Param references and cleaning up for gazebo version < 8 compatibility.  
102 -* Removed gazebo messaging, introduces redundancy in model.sdf for ocean. USV and buoyancy plugins only get wave parameters once instead of every update.  
103 -* Move link error message.  
104 -* Another Nitpick fix (== nullptr) => !  
105 -* Nitpick fix (== nullptr) => !  
106 -* Clarify required and optional parameters, and remove unused confusing default declarations  
107 -* Put required parameters together and make it obvious which are required  
108 -* Retune PID for engineJoint with lower P gain, for more realistic behavior  
109 -* Add <enableAngle> bool parameter that controls if angle is adjustable or not  
110 -* C++ Code style fixes  
111 -* Add documentation about maxAngle and angleTopic  
112 -* updated documentation  
113 -* Attempt to fix build issue with .GetAngle().Radian()  
114 -* Attempt to fix build issue with Position() -> GetAngle() for old gazebo version  
115 -* Implement PID controller for engine joint to set joint angle  
116 -* changed sdf sytax for passing models to be effected by wind and addressed styling  
117 -* Attempt to fix build issues SetAngle->SetPosition  
118 -* Attempt to fix build issue with different setAngle setPosition implementation based on Gazebo version  
119 -* Implement turnable thruster joint  
120 -* Basic implementation of angle adjustable thrusters, still need to test, add joints, and change visuals  
121 -* merging with default  
122 -* fix build issue for gz <8  
123 -* merged. expanded xacro capabilities  
124 -* Rewrite implementation of setting windDirection  
125 -* documenting wind direction  
126 -* changing the interface from timePeriod to frequency  
127 -* cleaning up the includes order and white spaces  
128 -* cleanup  
129 -* adding ROS API to probe for wind speed  
130 -* enabling the user to input only the angle for wind direction  
131 -* increment  
132 -* documented  
133 -* incremental(basic testing passed)  
134 -* changed wind plugin(untested  
135 -* Initial testing of random seed with print statements  
136 -* Added wavegauge plugin to visualize physical wave height. Setup example with buoy world. Implemented simplified wave height calculation in WavefieldSampler for regularly spaced grid (steepness=1=0).  
137 -* verifying with examples  
138 -* toward buoy examples  
139 -* merging default into named branch  
140 -* removed currentVarVel from member variable list and fixed indentation for directives  
141 -* made gzmsg more efficient  
142 -* Implemented changed after PR is reviewed - V1  
143 - Remove Ros dependency (regarding time)  
144 - fixed typoes  
145 - fixed wrong comments  
146 - Exposed seed value to user  
147 - Updated purpose of SDF params in the header file  
148 - lines are now shorted than 80 chars  
149 - added comments around explaining the calculations done  
150 -* made wind speed randomized  
151 -* merging default to update the feature branch  
152 -* Remove more trailing whitespace  
153 - Redundant codepath in usv_gazwebo_dynamics_plugin removed. Euler values now derived identically between gazebo 7 and 9.  
154 -* Fix trailing whitespace  
155 -* Fix line breaks  
156 -* Alter patch to use .Ign method to convert between gazebo::math and Ignition::math types  
157 -* Add support for Kinetic/Gazebo-7  
158 - The ignition types are mostly kept, with code transforming from the methods deprecated in gazebo-8  
159 -* Changing license text  
160 -* Adding two packages from asv_wave_sim as a part of VRC  
161 -* Issue #23: Coordinate the physics and visualization of the wave field  
162 - 1. Use the asv_wave_sim_gazebo_plugins package for wave field visualisation and depth calculation.  
163 - 2. Update the buoyancy and dynamics plugins for buoyancy calculations.  
164 - 3. Update sdf and xacro for models that require buoyancy.  
165 - 4. Replace the ocean model with ocean_waves in the sandisland world.  
166 -* Contributors: Brian Bingham <briansbingham@gmail.com>, Carlos Aguero, Carlos Aguero <caguero@osrfoundation.org>, Carlos Agüero <cen.aguero@gmail.com>, Jonathan Wheare <jonathan.wheare@flinders.edu.au>, MarshallRawson, Rhys Mainwaring <rhys.mainwaring@me.com>, Rumman Waqar <rumman.waqar05@gmail.com>, Tyler Lum <tylergwlum@gmail.com>, Youssef Khaky <youssefkhaky@hotmail.com>, YoussefKhaky <youssefkhaky@hotmail.com.com>  
167 -  
168 -1.0.1 (2019-03-01)  
169 -------------------  
170 -  
171 -1.0.0 (2019-02-28)  
172 -------------------  
173 -* Porting to Gazebo 9  
174 -* Rename vmrc to vrx.  
175 -* More progress.  
176 -* Changed from buoyancy calculation method  
177 -* Fixing error where buoyancy force could be applied in the negative direction (downward)  
178 -* Add dependency on usv_msgs by usv_gazebo_pinger_plugin. This forces the message to be built before the plugin is compiled.  
179 -* Set the sensor WAM-V as the default model  
180 -* Fix the doxygen generation  
181 -* Update variable names and comments to be compliant with the Gazebo style guide.  
182 -* Add the pinger plugin to the wamv_gazebo package.  
183 - The wamv_gazebo_sensors.urdf file has been modified to add support for the pinger plugin.  
184 -* removing static tags so vessel is freee to move  
185 -* Contributors: Brian Bingham <briansbingham@gmail.com>, Carlos Aguero, Carlos Aguero <caguero@osrfoundation.org>, Jonathan Wheare <jonathan.wheare@flinders.edu.au>  
186 -  
187 -0.3.2 (2018-10-08)  
188 -------------------  
189 -* Include jrivero as maintainer of the ROS packages  
190 -* Include headers in the installation of usv_gazebo_plugins  
191 -* Contributors: Jose Luis Rivero <jrivero@osrfoundation.org>  
192 -  
193 -0.3.1 (2018-10-05)  
194 -------------------  
195 -* Decleare eigen as dependency for usv_gazebo_plugins  
196 -* modifying grid spacing  
197 -* Contributors: Brian Bingham <briansbingham@gmail.com>, Jose Luis Rivero <jrivero@osrfoundation.org>  
198 -  
199 -0.3.0 (2018-09-28)  
200 -------------------  
201 -* vrx metapackage and spring cleaning.  
202 -* adding publication of forces/moments  
203 -* trying to get wamv to be static using a fixed joint  
204 -* Adding publication from dynamics plugin for wave height at USV CG for Josh's thesis work  
205 -* Tweak  
206 -* Changelog and minor tweaks.  
207 -* Remove extra dependency.  
208 -* Merged in generalize-thruster-desc (pull request #34)  
209 - Generalize thruster desc  
210 - Approved-by: Brian Bingham <briansbingham@gmail.com>  
211 - Approved-by: Carlos Agüero <cen.aguero@gmail.com>  
212 -* merging changes from PR branch into development branch  
213 -* resolving merge conflict  
214 -* Adding bits to repond to PR comments  
215 -* adding examples for T and X thruster configurations - accessible as args to sandisland.launch. Prototype - too much redundancy in the various urdf.xacro file hierarchy, but functional.  
216 -* Tweaks.  
217 -* Tabs -> spaces  
218 -* Initial style pass  
219 -* props now spinning, removed old method of thrust implementation, removed custome UsvDrive message  
220 -* working prototype - next remove old method  
221 -* prior to splitting thruster into its own header  
222 -* increment - builds, but need to go home  
223 -* catching up with default  
224 -* increment, pushing to work from home  
225 -* first steps towards new structure  
226 -* Drop log level to DEBUG for imformation unimportant to user  
227 -* Minor style changes in the gazebo_ros_color plugin.  
228 -* Tweak  
229 -* Move log message to DEBUG.  
230 -* adding a bit more doxygen, including link to Theory of Operation document  
231 -* Tweaks.  
232 -* adding doxygen comments  
233 -* Doxygen and cleaning up  
234 -* Rename buoyLinks to buoyancyLinks and remove debug output.  
235 -* More style.  
236 -* More tweaks.  
237 -* Initial style changes.  
238 -* Merge from default.  
239 -* Apply Gazebo style.  
240 -* Move some ROS_INFO messages to ROS_DEBUG and remove ros::init().  
241 -* More tweaks.  
242 -* Tweaks  
243 -* Tweaks  
244 -* Initial work  
245 -* Publish joint_states from thrust plugin  
246 -* Tweak  
247 -* Refactor wind plugin.  
248 -* Split the wamv xacro file.  
249 -* Generate messages before building the Thrust plugin.  
250 -* More modular model with spinning propellers.  
251 -* Merge from default  
252 -* Add message_generation.  
253 -* Backed out changeset 8023d94fc0e1  
254 -* Add light buoy challenge  
255 -* Remove unsused buoyancy plugin (already in gazebo)  
256 -* Boostrap usv_gazebo_plugins  
257 -* Move gazebo plugins to usv_gazebo_plugins  
258 -* Contributors: Brian Bingham <briansbingham@gmail.com>, Carlos Aguero, Carlos Agüero <caguero@osrfoundation.org>, Kevin Allen <kallen@osrfoundation.org>  
usv_gazebo_plugins/CMakeLists.txt deleted
@@ -1,115 +0,0 @@ @@ -1,115 +0,0 @@
1 -cmake_minimum_required(VERSION 2.8.3)  
2 -project(usv_gazebo_plugins)  
3 -find_package(catkin REQUIRED COMPONENTS gazebo_dev roscpp message_generation xacro wave_gazebo_plugins usv_msgs)  
4 -find_package(Eigen3 REQUIRED)  
5 -  
6 -###################################  
7 -## catkin specific configuration ##  
8 -###################################  
9 -  
10 -catkin_package(  
11 - INCLUDE_DIRS include  
12 - CATKIN_DEPENDS message_runtime gazebo_dev roscpp wave_gazebo_plugins  
13 -)  
14 -  
15 -# Plugins require c++11  
16 -set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")  
17 -  
18 -include_directories( include  
19 - ${catkin_INCLUDE_DIRS}  
20 - ${EIGEN3_INCLUDE_DIRS}  
21 -)  
22 -link_directories(  
23 - ${catkin_LIBRARY_DIRS}  
24 -)  
25 -  
26 -## Declare a C++ library  
27 -add_library(buoyancy_gazebo_plugin  
28 - src/buoyancy_gazebo_plugin.cc  
29 - src/shape_volume.cc  
30 - src/polyhedron_volume.cc  
31 -)  
32 -target_link_libraries(buoyancy_gazebo_plugin  
33 - ${catkin_LIBRARIES}  
34 - ${GAZEBO_LIBRARIES}  
35 - ${Eigen_LIBRARIES}  
36 -)  
37 -install(TARGETS buoyancy_gazebo_plugin  
38 - ARCHIVE DESTINATION lib  
39 - LIBRARY DESTINATION lib  
40 - RUNTIME DESTINATION bin  
41 -)  
42 -  
43 -## Declare a C++ library  
44 -add_library(usv_gazebo_dynamics_plugin  
45 - src/usv_gazebo_dynamics_plugin.cc  
46 -)  
47 -target_link_libraries(usv_gazebo_dynamics_plugin  
48 - ${catkin_LIBRARIES}  
49 - ${Eigen_LIBRARIES}  
50 -)  
51 -install(TARGETS usv_gazebo_dynamics_plugin  
52 - ARCHIVE DESTINATION lib  
53 - LIBRARY DESTINATION lib  
54 - RUNTIME DESTINATION bin  
55 -)  
56 -  
57 -## Declare a C++ library  
58 -add_library(usv_gazebo_thrust_plugin  
59 - src/usv_gazebo_thrust_plugin.cc  
60 -)  
61 -target_link_libraries(usv_gazebo_thrust_plugin  
62 - ${catkin_LIBRARIES}  
63 - ${Eigen_LIBRARIES}  
64 -)  
65 -install(TARGETS usv_gazebo_thrust_plugin  
66 - ARCHIVE DESTINATION lib  
67 - LIBRARY DESTINATION lib  
68 - RUNTIME DESTINATION bin  
69 -)  
70 -  
71 -## Declare a C++ library  
72 -add_library(usv_gazebo_wind_plugin  
73 - src/usv_gazebo_wind_plugin.cc  
74 -)  
75 -target_link_libraries(usv_gazebo_wind_plugin  
76 - ${catkin_LIBRARIES}  
77 - ${Eigen_LIBRARIES}  
78 -)  
79 -install(TARGETS usv_gazebo_wind_plugin  
80 - ARCHIVE DESTINATION lib  
81 - LIBRARY DESTINATION lib  
82 - RUNTIME DESTINATION bin  
83 -)  
84 -  
85 -## Declare a C++ library  
86 -add_library(usv_gazebo_acoustic_pinger_plugin  
87 - src/acoustic_pinger_plugin.cc  
88 -)  
89 -add_dependencies(usv_gazebo_acoustic_pinger_plugin usv_msgs_generate_messages_cpp)  
90 -target_link_libraries(usv_gazebo_acoustic_pinger_plugin  
91 - ${catkin_LIBRARIES}  
92 - ${Eigen_LIBRARIES}  
93 -)  
94 -install(TARGETS usv_gazebo_acoustic_pinger_plugin  
95 - ARCHIVE DESTINATION lib  
96 - LIBRARY DESTINATION lib  
97 - RUNTIME DESTINATION bin  
98 -)  
99 -  
100 -# Generate demo world files from xacro and install  
101 -xacro_add_files(  
102 - worlds/buoyancy_plugin_demo.world.xacro  
103 - INORDER INSTALL DESTINATION worlds  
104 -)  
105 -install(DIRECTORY worlds/  
106 - DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/worlds)  
107 -  
108 -if(CATKIN_ENABLE_TESTING)  
109 - # buoyancy plugin test  
110 - catkin_add_gtest(buoyancy_plugin_test test/buoyancy_test.cc)  
111 - target_link_libraries(buoyancy_plugin_test buoyancy_gazebo_plugin)  
112 -endif()  
113 -  
114 -install(DIRECTORY include/${PROJECT_NAME}/  
115 - DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})  
usv_gazebo_plugins/include/usv_gazebo_plugins/acoustic_pinger_plugin.hh deleted
@@ -1,122 +0,0 @@ @@ -1,122 +0,0 @@
1 -/*  
2 - * Copyright (C) 2020 Open Source Robotics Foundation  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - *  
16 -*/  
17 -  
18 -#ifndef VRX_GAZEBO_ACOUSTIC_PINGER_PLUGIN_HH_  
19 -#define VRX_GAZEBO_ACOUSTIC_PINGER_PLUGIN_HH_  
20 -  
21 -#include <geometry_msgs/Vector3.h>  
22 -#include <ros/ros.h>  
23 -#include <memory>  
24 -#include <mutex>  
25 -#include <string>  
26 -#include <gazebo/common/Events.hh>  
27 -#include <gazebo/common/Plugin.hh>  
28 -#include <gazebo/common/Time.hh>  
29 -#include <gazebo/physics/physics.hh>  
30 -#include <gazebo/sensors/GaussianNoiseModel.hh>  
31 -#include <ignition/math/Vector3.hh>  
32 -  
33 -namespace gazebo  
34 -{  
35 -/// \brief Implements a simulated range and bearing pinger localisation system  
36 -///  
37 -/// Implements a range and bearing pinger system. This assumes that the pinger  
38 -/// localisation has a mechanism for estimating the range and bearing  
39 -/// of the pinger. Pinger estimates are published using a custom message to the  
40 -/// ROS system along with a standard header. This should allow the tf library  
41 -/// to transform the sensor reading between frames.  
42 -///  
43 -/// Accepts the following SDF parameters:  
44 -/// <robotNamespace> - Set the namespace of the robot. Used to setup the ROS  
45 -/// nodehandle.  
46 -/// <frameId> - Tf frame of the sensor message. Used as part of the sensor  
47 -/// message publication.  
48 -/// <topicName> - Name of the topic that the sensor message will be published on  
49 -/// <setPositionTopicName> - Name of the topic that is used to set the position  
50 -/// of the simulated pinger sensor.  
51 -/// <position> - Position of the simulated pinger. Defaults to origin.  
52 -/// <updateRate> - Rate of simulated sensor messages.  
53 -/// <rangeNoise> - Noise model for the range to the simulated pinger.  
54 -/// <bearingNoise> - Noise model for the bearing to the simulated pinger.  
55 -/// <elevationNoise> - Noise model for the elevation to the simulated pinger.  
56 -class AcousticPinger : public ModelPlugin  
57 -{  
58 - /// \brief Constructor.  
59 - public: AcousticPinger();  
60 -  
61 - /// \brief Destructor.  
62 - public: virtual ~AcousticPinger();  
63 -  
64 - // Documentation inherited.  
65 - public: void Load(physics::ModelPtr _parent,  
66 - sdf::ElementPtr _sdf);  
67 -  
68 - /// \brief Callback used by gazebo to update the plugin.  
69 - protected: virtual void Update();  
70 -  
71 - /// \brief Callback function called when receiving a new pinger position  
72 - /// via the pinger subscription callback.  
73 - /// \param[in] _pos New pinger position.  
74 - public: void PingerPositionCallback(  
75 - const geometry_msgs::Vector3ConstPtr &_pos);  
76 -  
77 - // ROS integration  
78 - /// \brief Nodehandle used to integrate with the ROS system.  
79 - private: std::unique_ptr<ros::NodeHandle> rosNodeHandle;  
80 -  
81 - /// \brief Subscribes to the topic that set the pinger position.  
82 - public: ros::Subscriber setPositionSub;  
83 -  
84 - /// \brief Publisher used to send sensor messages generated by the plugin.  
85 - private: ros::Publisher rangeBearingPub;  
86 -  
87 - /// \brief Mutex to protect the position vector.  
88 - public: std::mutex mutex;  
89 -  
90 - /// \brief Pointer to model object.  
91 - private: physics::ModelPtr model;  
92 -  
93 - /// \brief Vector storing the position of the pinger.  
94 - private: ignition::math::Vector3d position;  
95 -  
96 - // Variables that contain parameters of sensor simulation.  
97 - /// \brief String holding the frame id of the sensor.  
98 - private: std::string frameId;  
99 -  
100 - /// \brief Sensor update rate.  
101 - private: float updateRate;  
102 -  
103 - /// \brief Variable used to track time of last update. This is used to  
104 - /// produce data at the correct rate.  
105 - private: common::Time lastUpdateTime;  
106 -  
107 - /// \brief Pointer used to connect gazebo callback to plugins update function.  
108 - private: event::ConnectionPtr updateConnection;  
109 -  
110 - // From Brian Bingham's rangebearing_gazebo_plugin.  
111 - /// \brief rangeNoise - Gazebo noise object for range.  
112 - private: gazebo::sensors::NoisePtr rangeNoise = nullptr;  
113 -  
114 - /// \brief Gazebo noise object for bearing angle.  
115 - private: gazebo::sensors::NoisePtr bearingNoise = nullptr;  
116 -  
117 - /// \brief Gazebo noise object for elevation angle.  
118 - private: gazebo::sensors::NoisePtr elevationNoise = nullptr;  
119 -};  
120 -}  
121 -  
122 -#endif  
usv_gazebo_plugins/include/usv_gazebo_plugins/buoyancy_gazebo_plugin.hh deleted
@@ -1,175 +0,0 @@ @@ -1,175 +0,0 @@
1 -/*  
2 - * Copyright (C) 2019 Open Source Robotics Foundation  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - *  
16 -*/  
17 -  
18 -#ifndef USV_GAZEBO_PLUGINS_BUOYANCY_GAZEBO_PLUGIN_HH_  
19 -#define USV_GAZEBO_PLUGINS_BUOYANCY_GAZEBO_PLUGIN_HH_  
20 -  
21 -#include <map>  
22 -#include <string>  
23 -#include <vector>  
24 -  
25 -#include <gazebo/common/common.hh>  
26 -#include <gazebo/common/Event.hh>  
27 -#include <gazebo/common/Plugin.hh>  
28 -#include <gazebo/physics/physics.hh>  
29 -#include <ignition/math/Pose3.hh>  
30 -#include <ignition/math/Vector3.hh>  
31 -#include "usv_gazebo_plugins/shape_volume.hh"  
32 -  
33 -#include "wave_gazebo_plugins/Wavefield.hh"  
34 -#include "wave_gazebo_plugins/WavefieldEntity.hh"  
35 -#include "wave_gazebo_plugins/WavefieldModelPlugin.hh"  
36 -  
37 -namespace gazebo  
38 -{  
39 - namespace buoyancy  
40 - {  
41 - /// \brief A class for storing buoyancy object properties  
42 - class BuoyancyObject  
43 - {  
44 - /// \brief Default constructor  
45 - public: BuoyancyObject();  
46 -  
47 - /// \brief Default move constructor  
48 - public: BuoyancyObject(BuoyancyObject&& obj) noexcept; // NOLINT  
49 -  
50 - /// \brief No copy constructor  
51 - public: BuoyancyObject(BuoyancyObject& obj) = delete;  
52 -  
53 - /// \brief Load buoyancy object from SDF  
54 - /// @param model model associated with buoyancy object  
55 - /// @param elem sdf for buoyancy element  
56 - public: void Load(const physics::ModelPtr model,  
57 - const sdf::ElementPtr elem);  
58 -  
59 - /// \brief Display string for buoyancy object  
60 - public: std::string Disp();  
61 -  
62 - /// \brief Associated link ID  
63 - public: int linkId;  
64 -  
65 - /// \brief Associated link name  
66 - public: std::string linkName;  
67 -  
68 - /// \brief Pose of buoyancy relative to link  
69 - public: ignition::math::Pose3d pose;  
70 -  
71 - /// \brief Object mass (from inertial elem)  
72 - public:double mass;  
73 -  
74 - /// \brief Buoyancy object's shape properties  
75 - public: ::buoyancy::ShapeVolumePtr shape;  
76 - };  
77 - } // end of buoyancy namespace  
78 -  
79 - /// \brief This plugin simulates buoyancy of an object in fluid.  
80 - /// <wave_model>: Name of the wave model object (optional)  
81 - ///  
82 - /// <fluid_density>: Sets the density of the fluid that surrounds the  
83 - /// buoyant object [kg/m^3].  
84 - /// This parameter is optional (default value 997 kg/m^3).  
85 - ///  
86 - /// <fluid_level>: The height of the fluid/air interface [m].  
87 - /// This parameter is optional (default value 0 m).  
88 - ///  
89 - /// <linear_drag>: Linear drag coefficent [N/(m/s)].  
90 - /// Translational drag implement as linear function  
91 - /// of velocity.  
92 - /// This parameter is optional.  
93 - ///  
94 - /// <angular_drag>: Angular drag coefficent [(Nm)/(rad/s)].  
95 - /// Rotational drag implemented as linear function  
96 - /// of velocity.  
97 - /// This parameter is optional.  
98 - ///  
99 - /// <buoyancy>: Describes the volume properties  
100 - /// For example:  
101 - ///  
102 - /// <buoyancy name="buoyancy1">  
103 - /// <link_name>link</link_name>  
104 - /// <geometry>  
105 - /// ...  
106 - /// </geometry>  
107 - /// </buoyancy>  
108 - ///  
109 - /// <link>: Name of associated link element  
110 - ///  
111 - /// <geometry>: Geometry element specifying buoyancy object's  
112 - /// volume properties.  
113 - /// Supported shapes: box, sphere, cylinder  
114 - class BuoyancyPlugin : public ModelPlugin  
115 - {  
116 - /// \brief Constructor.  
117 - public: BuoyancyPlugin();  
118 -  
119 - // Documentation inherited.  
120 - public: virtual void Load(physics::ModelPtr _model,  
121 - sdf::ElementPtr _sdf);  
122 -  
123 - // Documentation inherited.  
124 - public: virtual void Init();  
125 -  
126 - /// \brief Callback for World Update events.  
127 - protected: virtual void OnUpdate();  
128 -  
129 - /// \brief Connection to World Update events.  
130 - protected: event::ConnectionPtr updateConnection;  
131 -  
132 - /// \brief The density of the fluid in which the object is submerged in  
133 - /// kg/m^3. Defaults to 1000, the fluid density of water at 15 Celsius.  
134 - protected: double fluidDensity;  
135 -  
136 - /// \brief The height of the fluid/air interface [m]. Defaults to 0.  
137 - protected: double fluidLevel;  
138 -  
139 - /// \brief Linear drag coefficient. Defaults to 0.  
140 - protected: double linearDrag;  
141 -  
142 - /// \brief Angular drag coefficient. Defaults to 0.  
143 - protected: double angularDrag;  
144 -  
145 - /// \brief List of buoyancy objects for model  
146 - protected: std::vector<buoyancy::BuoyancyObject> buoyancyObjects;  
147 -  
148 - /// \brief Map of <link ID, link pointer>  
149 - protected: std::map<int, gazebo::physics::LinkPtr> linkMap;  
150 -  
151 - /// \brief Pointer to base model  
152 - protected: physics::ModelPtr model;  
153 -  
154 - /// \brief Pointer to the Gazebo world  
155 - /// Retrieved when the model is loaded.  
156 - protected: physics::WorldPtr world;  
157 -  
158 - /// \brief The name of the wave model  
159 - protected: std::string waveModelName;  
160 -  
161 - /// \brief Map of water height at each link from previous timestep  
162 - protected: std::map<gazebo::physics::LinkPtr, double> linkHeights;  
163 -  
164 - /// \brief Map of water velocity at each link  
165 - protected: std::map<gazebo::physics::LinkPtr, double> linkHeightDots;  
166 -  
167 - /// \brief Previous update time  
168 - protected: double lastSimTime;  
169 -  
170 - /// \brief The wave parameters.  
171 - protected: std::shared_ptr<const asv::WaveParameters> waveParams;  
172 - };  
173 -}  
174 -  
175 -#endif  
usv_gazebo_plugins/include/usv_gazebo_plugins/polyhedron_volume.hh deleted
@@ -1,141 +0,0 @@ @@ -1,141 +0,0 @@
1 -/*  
2 - * Copyright (C) 2019 Open Source Robotics Foundation  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - *  
16 -*/  
17 -  
18 -#pragma once  
19 -  
20 -#include <cassert>  
21 -#include <vector>  
22 -#include <gazebo/common/common.hh>  
23 -#include <ignition/math/Vector3.hh>  
24 -#include <ignition/math/Quaternion.hh>  
25 -  
26 -namespace buoyancy  
27 -{  
28 - /// \brief Represents a plane as a normal and offset  
29 - struct Plane  
30 - {  
31 - /// \brief Initializes plane at z=0  
32 - Plane();  
33 -  
34 - /// \brief Vector3 normal to plane  
35 - ignition::math::Vector3d normal;  
36 -  
37 - /// \brief Offset w.r.t. normal  
38 - float offset;  
39 - };  
40 -  
41 - /// \brief Represents output volume with centroid  
42 - struct Volume  
43 - {  
44 - Volume();  
45 -  
46 - /// \brief Overloads += for volume object  
47 - Volume& operator+=(const Volume& rhs);  
48 -  
49 - /// \brief Submerged volume of shape  
50 - double volume;  
51 -  
52 - /// \brief Vector3 representing volume centroid  
53 - ignition::math::Vector3d centroid;  
54 - };  
55 -  
56 - /// \brief Submerged volume calculation using polyhedron  
57 - /// based on: Exact Buoyancy for Polyhedra by Eric Catto  
58 - class Polyhedron  
59 - {  
60 - /// \brief Store vertex index for a triangular face  
61 - public: struct Face  
62 - {  
63 - Face() = default;  
64 -  
65 - Face(int i1, int i2, int i3);  
66 -  
67 - /// \brief Index of vertices  
68 - int i1, i2, i3;  
69 - };  
70 -  
71 - /// \brief Generate a cube polyhedron centered at origin  
72 - /// @param x: length of cube  
73 - /// @param y: width of cube  
74 - /// @param z: height of cube  
75 - /// @return Polyhedron object  
76 - public: static Polyhedron makeCube(double x,  
77 - double y,  
78 - double z);  
79 -  
80 - /// \brief Generate a cylinder polyhedron centered at origin  
81 - /// @param r: radius of cylinder  
82 - /// @param l: length of cylinder  
83 - /// @param n: number of segments  
84 - /// @return Polyhedron object  
85 - public: static Polyhedron makeCylinder(double r,  
86 - double l,  
87 - int n);  
88 -  
89 - /// \brief Compute full volume and center of buoyancy of the polyhedron  
90 - /// @return Volume object with volume and centroid  
91 - public: Volume ComputeFullVolume();  
92 -  
93 - /// \brief Compute submerge volume and center of buoyancy of a polyhedron  
94 - /// @param x: our position  
95 - /// @param q: our orientation (quaternions)  
96 - /// @param plane: water surface defined as a plane  
97 - /// @return Volume object with volume and centroid (relative to world)  
98 - public: Volume SubmergedVolume(const ignition::math::Vector3d &x,  
99 - const ignition::math::Quaterniond &q,  
100 - Plane &plane);  
101 -  
102 - /// \brief Computes volume and centroid of tetrahedron  
103 - /// tetrahedron formed by triangle + arbitrary point  
104 - /// @param v1: point on triangle  
105 - /// @param v2: point on triangle  
106 - /// @param v3: point on triangle  
107 - /// @param p: arbitrary point  
108 - /// @return Volume object with volume and centroid  
109 - private: static Volume tetrahedronVolume(const ignition::math::Vector3d& v1,  
110 - const ignition::math::Vector3d& v2,  
111 - const ignition::math::Vector3d& v3,  
112 - const ignition::math::Vector3d& p =  
113 - ignition::math::Vector3d({0., 0., 0.}));  
114 -  
115 - /// \brief Clips a partially submerged triangle  
116 - /// @param v1: point on triangle  
117 - /// @param v2: point on triangle  
118 - /// @param v3: point on triangle  
119 - /// @param d1: distance of point v1 to the splitting plane  
120 - /// @param d2: distance of point v2 to the splitting plane  
121 - /// @param d3: distance of point v3 to the splitting plane  
122 - /// @return Volume object for clipped tetrahedron  
123 - private: static Volume clipTriangle(const ignition::math::Vector3d& v1,  
124 - const ignition::math::Vector3d& v2,  
125 - const ignition::math::Vector3d& v3,  
126 - double d1,  
127 - double d2,  
128 - double d3,  
129 - const ignition::math::Vector3d& p =  
130 - ignition::math::Vector3d({0., 0., 0.}));  
131 -  
132 - /// \brief Object vertices  
133 - private: std::vector<ignition::math::Vector3d> vertices;  
134 -  
135 - /// \brief Object faces  
136 - private: std::vector<Face> faces;  
137 -  
138 - /// \brief Values below this are zeroed out  
139 - private: const double EPSILON = 1e-6;  
140 - }; // class Polyhedron  
141 -}  
usv_gazebo_plugins/include/usv_gazebo_plugins/shape_volume.hh deleted
@@ -1,165 +0,0 @@ @@ -1,165 +0,0 @@
1 -/*  
2 - * Copyright (C) 2019 Open Source Robotics Foundation  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - *  
16 -*/  
17 -  
18 -#pragma once  
19 -  
20 -#include <cmath>  
21 -#include <exception>  
22 -#include <memory>  
23 -#include <string>  
24 -#include <ignition/math/Pose3.hh>  
25 -#include <sdf/sdf.hh>  
26 -#include "usv_gazebo_plugins/polyhedron_volume.hh"  
27 -  
28 -namespace buoyancy  
29 -{  
30 - /// \brief Type of geometry shape  
31 - enum class ShapeType  
32 - {  
33 - None,  
34 - Box,  
35 - Sphere,  
36 - Cylinder  
37 - };  
38 -  
39 - /// \brief Parent shape object for volume objects  
40 - struct ShapeVolume  
41 - {  
42 - /// \brief Default destructor  
43 - virtual ~ShapeVolume() = default;  
44 -  
45 - /// \brief Factory method for shape. Parses a shape object from sdf data  
46 - /// \param sdf geometry SDF element  
47 - static std::unique_ptr<ShapeVolume> makeShape(const sdf::ElementPtr sdf);  
48 -  
49 - /// \brief Display string for shape object  
50 - virtual std::string Display();  
51 -  
52 - /// \brief Calculates volume + centroid of submerged shape  
53 - /// if the shape is out of water returns Volume{}  
54 - /// @param pose: world pose of volume  
55 - /// @param fluidLevel: height of fluid  
56 - /// @return volume object with volume + centroid (relative to world)  
57 - virtual Volume CalculateVolume(const ignition::math::Pose3d& pose,  
58 - double fluidLevel) = 0;  
59 -  
60 - /// \brief Type of shape  
61 - ShapeType type;  
62 -  
63 - /// \brief Full volume of object  
64 - double volume;  
65 -  
66 - /// \brief Average length of object  
67 - /// estimate used for drag torque calculation  
68 - double averageLength;  
69 - };  
70 - typedef std::unique_ptr<ShapeVolume> ShapeVolumePtr;  
71 -  
72 - /// \brief Box shape volume  
73 - struct BoxVolume : public ShapeVolume  
74 - {  
75 - /// \brief Default constructor  
76 - /// @param x: length  
77 - /// @param y: width  
78 - /// @param z: height  
79 - explicit BoxVolume(double x, double y, double z);  
80 -  
81 - /// \brief Display string for box shape  
82 - std::string Display() override;  
83 -  
84 - // Documentation inherited.  
85 - Volume CalculateVolume(const ignition::math::Pose3d& pose,  
86 - double fluidLevel) override;  
87 -  
88 - /// \brief Length  
89 - double x;  
90 -  
91 - /// \brief Width  
92 - double y;  
93 -  
94 - /// \brief Height  
95 - double z;  
96 -  
97 - private:  
98 - /// \brief Polyhedron defining a box  
99 - Polyhedron polyhedron;  
100 - };  
101 -  
102 - /// \brief Cylinder shape volume  
103 - struct CylinderVolume : public ShapeVolume  
104 - {  
105 - /// \brief Default constructor  
106 - /// @param r: radius  
107 - /// @param l: length  
108 - explicit CylinderVolume(double r, double l);  
109 -  
110 - /// \brief Display string for cylinder shape  
111 - std::string Display() override;  
112 -  
113 - // Documentation inherited.  
114 - Volume CalculateVolume(const ignition::math::Pose3d& pose,  
115 - double fluidLevel) override;  
116 -  
117 - /// \brief Radius of cylinder  
118 - double r;  
119 -  
120 - /// \brief Height of cylinder  
121 - double h;  
122 -  
123 - private:  
124 - /// \brief Polyhedron defining a cylinder  
125 - Polyhedron polyhedron;  
126 - };  
127 -  
128 - /// \brief Sphere shape volume  
129 - struct SphereVolume : public ShapeVolume  
130 - {  
131 - /// \brief Default constructor  
132 - /// @param r: radius  
133 - explicit SphereVolume(double r);  
134 -  
135 - /// \brief Display string for sphere shape  
136 - std::string Display() override;  
137 -  
138 - // Documentation inherited.  
139 - Volume CalculateVolume(const ignition::math::Pose3d& pose,  
140 - double fluidLevel) override;  
141 -  
142 - /// \brief Radius of sphere  
143 - double r;  
144 - };  
145 -  
146 - /// \brief Custom exception for parsing errors  
147 - struct ParseException : public std::exception  
148 - {  
149 - ParseException(const char* shape, const char* message)  
150 - : output_("")  
151 - {  
152 - std::stringstream ss;  
153 - ss << "Parse error for <" << shape << ">: " << message;  
154 - // cppcheck-suppress useInitializationList  
155 - this->output_ = ss.str();  
156 - }  
157 -  
158 - const char* what() const throw()  
159 - {  
160 - return this->output_.c_str();  
161 - }  
162 -  
163 - private: std::string output_;  
164 - };  
165 -}  
usv_gazebo_plugins/include/usv_gazebo_plugins/usv_gazebo_dynamics_plugin.hh deleted
@@ -1,192 +0,0 @@ @@ -1,192 +0,0 @@
1 -/*  
2 - * Copyright (C) 2017 Brian Bingham  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - *  
16 -*/  
17 -  
18 -#ifndef USV_GAZEBO_PLUGINS_DYNAMICS_PLUGIN_HH_  
19 -#define USV_GAZEBO_PLUGINS_DYNAMICS_PLUGIN_HH_  
20 -  
21 -#include <Eigen/Core>  
22 -#include <string>  
23 -#include <vector>  
24 -  
25 -#include <gazebo/common/common.hh>  
26 -#include <ignition/math/Vector3.hh>  
27 -#include <gazebo/physics/physics.hh>  
28 -#include <sdf/sdf.hh>  
29 -  
30 -#include "wave_gazebo_plugins/Wavefield.hh"  
31 -#include "wave_gazebo_plugins/WavefieldEntity.hh"  
32 -#include "wave_gazebo_plugins/WavefieldModelPlugin.hh"  
33 -  
34 -namespace gazebo  
35 -{  
36 - /// \brief Plugin class to implement hydrodynamics and wave response.  
37 - /// This plugin accepts the following SDF parameters:  
38 - ///  
39 - /// <bodyName>: Name of base link for receiving pose and and applying forces.  
40 - /// <boatArea>: Horizontal surface area [m^2]. Default value is 0.48.  
41 - /// <boatLength>: Boat length [m]. Default value is 1.35.  
42 - /// <boatWidth>: Boat width [m]. Default value is 1.  
43 - /// <waterDensity>: Water density [kg/m^3]. Default value is 997.7735.  
44 - /// <waterLevel>: Water height [m]. Default value is 0.5.  
45 - /// <xDotU>: Added mass coeff, surge.  
46 - /// <yDotV>: Added mass coeff, sway.  
47 - /// <nDotR>: Added mass coeff, yaw  
48 - /// <xU>: Linear drag coeff surge.  
49 - /// <xUU>: Quadratic drag coeff surge.  
50 - /// <yV>: Linear drag coeff sway.  
51 - /// <yVV>: Quadratic drag coeff sway  
52 - /// <zW>: Linear drag coeff heave.  
53 - /// <kP>: Linear drag coeff pitch.  
54 - /// <mQ>: Linear drag coeff roll.  
55 - /// <nR>: Linear drag coeff yaw.  
56 - /// <nRR>: Quadratic drag coeff yaw.  
57 - /// <wave_n>: Number of waves to generate wave field.  
58 - /// <wave_amp<N>>: Amplitude for each component [m].  
59 - /// <wave_period<N>>: Period for each compenent [s].  
60 - /// <wave_direction<N>>: Direction of motion for each component ENU [rad].  
61 - class UsvDynamicsPlugin : public ModelPlugin  
62 - {  
63 - /// \brief Constructor.  
64 - public: UsvDynamicsPlugin();  
65 -  
66 - /// \brief Destructor.  
67 - public: virtual ~UsvDynamicsPlugin() = default;  
68 -  
69 - // Documentation inherited.  
70 - public: virtual void Load(physics::ModelPtr _model,  
71 - sdf::ElementPtr _sdf);  
72 -  
73 - /// \brief Callback for Gazebo simulation engine.  
74 - protected: virtual void Update();  
75 -  
76 - /// \brief Convenience function for getting SDF parameters.  
77 - /// \param[in] _sdfPtr Pointer to an SDF element to parse.  
78 - /// \param[in] _paramName The name of the element to parse.  
79 - /// \param[in] _defaultVal The default value returned if the element  
80 - /// does not exist.  
81 - /// \return The value parsed.  
82 - private: double SdfParamDouble(sdf::ElementPtr _sdfPtr,  
83 - const std::string &_paramName,  
84 - const double _defaultVal) const;  
85 -  
86 - /// \brief Convenience function for calculating the area of circle segment  
87 - /// \param[in] R Radius of circle