UnderwaterObjectROSPlugin.hh
Go to the documentation of this file.
1 // Copyright (c) 2016 The UUV Simulator Authors.
2 // All rights reserved.
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 
18 
19 #ifndef __UNDERWATER_OBJECT_ROS_PLUGIN_HH__
20 #define __UNDERWATER_OBJECT_ROS_PLUGIN_HH__
21 
22 #include <string>
23 
25 
26 #include <boost/scoped_ptr.hpp>
27 #include <gazebo/gazebo.hh>
28 #include <gazebo/common/Plugin.hh>
29 #include <ros/ros.h>
30 #include <geometry_msgs/WrenchStamped.h>
31 #include <geometry_msgs/Vector3.h>
32 #include <std_msgs/Bool.h>
33 #include <visualization_msgs/Marker.h>
34 #include <uuv_gazebo_ros_plugins_msgs/SetUseGlobalCurrentVel.h>
35 #include <uuv_gazebo_ros_plugins_msgs/UnderwaterObjectModel.h>
36 #include <uuv_gazebo_ros_plugins_msgs/GetModelProperties.h>
37 #include <uuv_gazebo_ros_plugins_msgs/SetFloat.h>
38 #include <uuv_gazebo_ros_plugins_msgs/GetFloat.h>
39 #include <geometry_msgs/TransformStamped.h>
42 
43 #include <map>
44 
45 namespace uuv_simulator_ros
46 {
48  {
50  public: UnderwaterObjectROSPlugin();
51 
53  public: virtual ~UnderwaterObjectROSPlugin();
54 
56  public: void Load(gazebo::physics::ModelPtr _parent, sdf::ElementPtr _sdf);
57 
59  public: virtual void Init();
60 
62  public: virtual void Reset();
63 
66  public: virtual void Update(const gazebo::common::UpdateInfo &_info);
67 
70  public: void UpdateLocalCurrentVelocity(
71  const geometry_msgs::Vector3::ConstPtr &_msg);
72 
74  public: bool SetUseGlobalCurrentVel(
75  uuv_gazebo_ros_plugins_msgs::SetUseGlobalCurrentVel::Request& _req,
76  uuv_gazebo_ros_plugins_msgs::SetUseGlobalCurrentVel::Response& _res);
77 
80  public: bool GetModelProperties(
81  uuv_gazebo_ros_plugins_msgs::GetModelProperties::Request& _req,
82  uuv_gazebo_ros_plugins_msgs::GetModelProperties::Response& _res);
83 
85  public: bool SetScalingAddedMass(
86  uuv_gazebo_ros_plugins_msgs::SetFloat::Request& _req,
87  uuv_gazebo_ros_plugins_msgs::SetFloat::Response& _res);
88 
90  public: bool GetScalingAddedMass(
91  uuv_gazebo_ros_plugins_msgs::GetFloat::Request& _req,
92  uuv_gazebo_ros_plugins_msgs::GetFloat::Response& _res);
93 
95  public: bool SetScalingDamping(
96  uuv_gazebo_ros_plugins_msgs::SetFloat::Request& _req,
97  uuv_gazebo_ros_plugins_msgs::SetFloat::Response& _res);
98 
100  public: bool GetScalingDamping(
101  uuv_gazebo_ros_plugins_msgs::GetFloat::Request& _req,
102  uuv_gazebo_ros_plugins_msgs::GetFloat::Response& _res);
103 
106  public: bool SetScalingVolume(
107  uuv_gazebo_ros_plugins_msgs::SetFloat::Request& _req,
108  uuv_gazebo_ros_plugins_msgs::SetFloat::Response& _res);
109 
112  public: bool GetScalingVolume(
113  uuv_gazebo_ros_plugins_msgs::GetFloat::Request& _req,
114  uuv_gazebo_ros_plugins_msgs::GetFloat::Response& _res);
115 
118  public: bool SetFluidDensity(
119  uuv_gazebo_ros_plugins_msgs::SetFloat::Request& _req,
120  uuv_gazebo_ros_plugins_msgs::SetFloat::Response& _res);
121 
123  public: bool GetFluidDensity(
124  uuv_gazebo_ros_plugins_msgs::GetFloat::Request& _req,
125  uuv_gazebo_ros_plugins_msgs::GetFloat::Response& _res);
126 
129  public: bool SetOffsetVolume(
130  uuv_gazebo_ros_plugins_msgs::SetFloat::Request& _req,
131  uuv_gazebo_ros_plugins_msgs::SetFloat::Response& _res);
132 
134  public: bool GetOffsetVolume(
135  uuv_gazebo_ros_plugins_msgs::GetFloat::Request& _req,
136  uuv_gazebo_ros_plugins_msgs::GetFloat::Response& _res);
137 
139  public: bool SetOffsetAddedMass(
140  uuv_gazebo_ros_plugins_msgs::SetFloat::Request& _req,
141  uuv_gazebo_ros_plugins_msgs::SetFloat::Response& _res);
142 
144  public: bool GetOffsetAddedMass(
145  uuv_gazebo_ros_plugins_msgs::GetFloat::Request& _req,
146  uuv_gazebo_ros_plugins_msgs::GetFloat::Response& _res);
147 
149  public: bool SetOffsetLinearDamping(
150  uuv_gazebo_ros_plugins_msgs::SetFloat::Request& _req,
151  uuv_gazebo_ros_plugins_msgs::SetFloat::Response& _res);
152 
154  public: bool GetOffsetLinearDamping(
155  uuv_gazebo_ros_plugins_msgs::GetFloat::Request& _req,
156  uuv_gazebo_ros_plugins_msgs::GetFloat::Response& _res);
157 
161  uuv_gazebo_ros_plugins_msgs::SetFloat::Request& _req,
162  uuv_gazebo_ros_plugins_msgs::SetFloat::Response& _res);
163 
167  uuv_gazebo_ros_plugins_msgs::GetFloat::Request& _req,
168  uuv_gazebo_ros_plugins_msgs::GetFloat::Response& _res);
169 
172  public: bool SetOffsetNonLinearDamping(
173  uuv_gazebo_ros_plugins_msgs::SetFloat::Request& _req,
174  uuv_gazebo_ros_plugins_msgs::SetFloat::Response& _res);
175 
178  public: bool GetOffsetNonLinearDamping(
179  uuv_gazebo_ros_plugins_msgs::GetFloat::Request& _req,
180  uuv_gazebo_ros_plugins_msgs::GetFloat::Response& _res);
181 
185  protected: virtual void PublishRestoringForce(
186  gazebo::physics::LinkPtr _link);
187 
191  protected: virtual void PublishHydrodynamicWrenches(
192  gazebo::physics::LinkPtr _link);
193 
198  protected: virtual void GenWrenchMsg(
199  ignition::math::Vector3d _force, ignition::math::Vector3d _torque,
200  geometry_msgs::WrenchStamped &_output);
201 
206  protected: virtual void InitDebug(gazebo::physics::LinkPtr _link,
208 
210  protected: virtual void PublishCurrentVelocityMarker();
211 
213  protected: virtual void PublishIsSubmerged();
214 
216  private: boost::scoped_ptr<ros::NodeHandle> rosNode;
217 
220 
222  private: std::map<std::string, ros::Publisher> rosHydroPub;
223 
225  private: std::map<std::string, ros::ServiceServer> services;
226 
227  private: geometry_msgs::TransformStamped nedTransform;
228 
230  };
231 }
232 
233 #endif // __UNDERWATER_OBJECT_ROS_PLUGIN_HH__
bool GetOffsetLinearForwardSpeedDamping(uuv_gazebo_ros_plugins_msgs::GetFloat::Request &_req, uuv_gazebo_ros_plugins_msgs::GetFloat::Response &_res)
Return the offset factor for the linear forward speed damping matrix.
bool SetOffsetLinearDamping(uuv_gazebo_ros_plugins_msgs::SetFloat::Request &_req, uuv_gazebo_ros_plugins_msgs::SetFloat::Response &_res)
Set the offset factor for the linear damping matrix.
bool GetFluidDensity(uuv_gazebo_ros_plugins_msgs::GetFloat::Request &_req, uuv_gazebo_ros_plugins_msgs::GetFloat::Response &_res)
Get current value for the fluid density.
virtual void InitDebug(gazebo::physics::LinkPtr _link, gazebo::HydrodynamicModelPtr _hydro)
Sets the topics used for publishing the intermediate data during the simulation.
boost::scoped_ptr< ros::NodeHandle > rosNode
Pointer to this ROS node&#39;s handle.
bool SetUseGlobalCurrentVel(uuv_gazebo_ros_plugins_msgs::SetUseGlobalCurrentVel::Request &_req, uuv_gazebo_ros_plugins_msgs::SetUseGlobalCurrentVel::Response &_res)
Set flag to use the global current velocity topic input.
virtual void PublishHydrodynamicWrenches(gazebo::physics::LinkPtr _link)
Publish hydrodynamic wrenches.
bool SetOffsetAddedMass(uuv_gazebo_ros_plugins_msgs::SetFloat::Request &_req, uuv_gazebo_ros_plugins_msgs::SetFloat::Response &_res)
Set the offset factor for the added-mass matrix.
bool GetModelProperties(uuv_gazebo_ros_plugins_msgs::GetModelProperties::Request &_req, uuv_gazebo_ros_plugins_msgs::GetModelProperties::Response &_res)
Return the model properties, along with parameters from the hydrodynamic and hydrostatic models...
void UpdateLocalCurrentVelocity(const geometry_msgs::Vector3::ConstPtr &_msg)
Update the local current velocity, this data will be used only if the useGlobalCurrent flag is set to...
std::map< std::string, ros::Publisher > rosHydroPub
Publisher for current actual thrust.
bool SetOffsetLinearForwardSpeedDamping(uuv_gazebo_ros_plugins_msgs::SetFloat::Request &_req, uuv_gazebo_ros_plugins_msgs::SetFloat::Response &_res)
Set the offset factor for the linear forward speed damping matrix.
virtual void PublishCurrentVelocityMarker()
Publishes the current velocity marker.
std::map< std::string, ros::ServiceServer > services
Map of services.
bool GetScalingAddedMass(uuv_gazebo_ros_plugins_msgs::GetFloat::Request &_req, uuv_gazebo_ros_plugins_msgs::GetFloat::Response &_res)
Return current scaling factor for the added-mass matrix.
bool SetScalingAddedMass(uuv_gazebo_ros_plugins_msgs::SetFloat::Request &_req, uuv_gazebo_ros_plugins_msgs::SetFloat::Response &_res)
Set the scaling factor for the added-mass matrix.
bool GetOffsetNonLinearDamping(uuv_gazebo_ros_plugins_msgs::GetFloat::Request &_req, uuv_gazebo_ros_plugins_msgs::GetFloat::Response &_res)
Return the offset factor for the nonlinear damping matrix.
bool SetOffsetVolume(uuv_gazebo_ros_plugins_msgs::SetFloat::Request &_req, uuv_gazebo_ros_plugins_msgs::SetFloat::Response &_res)
Set offset factor for the model&#39;s volume (this will alter the value for the buoyancy force) ...
virtual void PublishIsSubmerged()
Publishes the state of the vehicle (is submerged)
virtual void GenWrenchMsg(ignition::math::Vector3d _force, ignition::math::Vector3d _torque, geometry_msgs::WrenchStamped &_output)
Returns the wrench message for debugging topics.
void Load(gazebo::physics::ModelPtr _parent, sdf::ElementPtr _sdf)
Load module and read parameters from SDF.
virtual void PublishRestoringForce(gazebo::physics::LinkPtr _link)
Publish restoring force.
bool SetScalingDamping(uuv_gazebo_ros_plugins_msgs::SetFloat::Request &_req, uuv_gazebo_ros_plugins_msgs::SetFloat::Response &_res)
Set a scaling factor for the overall damping matrix.
bool SetOffsetNonLinearDamping(uuv_gazebo_ros_plugins_msgs::SetFloat::Request &_req, uuv_gazebo_ros_plugins_msgs::SetFloat::Response &_res)
Set the offset factor for the nonlinear damping matrix.
bool GetOffsetLinearDamping(uuv_gazebo_ros_plugins_msgs::GetFloat::Request &_req, uuv_gazebo_ros_plugins_msgs::GetFloat::Response &_res)
Return the offset factor for the linear damping matrix.
bool GetScalingVolume(uuv_gazebo_ros_plugins_msgs::GetFloat::Request &_req, uuv_gazebo_ros_plugins_msgs::GetFloat::Response &_res)
Get scaling factor for the model&#39;s volume used for buoyancy force computation.
bool SetScalingVolume(uuv_gazebo_ros_plugins_msgs::SetFloat::Request &_req, uuv_gazebo_ros_plugins_msgs::SetFloat::Response &_res)
Set scaling factor for the model&#39;s volume used for buoyancy force computation.
ros::Subscriber subLocalCurVel
Subscriber to locally calculated current velocity.
bool GetOffsetAddedMass(uuv_gazebo_ros_plugins_msgs::GetFloat::Request &_req, uuv_gazebo_ros_plugins_msgs::GetFloat::Response &_res)
Return the offset factor for the added-mass matrix.
virtual void Update(const gazebo::common::UpdateInfo &_info)
Update the simulation state.
bool GetOffsetVolume(uuv_gazebo_ros_plugins_msgs::GetFloat::Request &_req, uuv_gazebo_ros_plugins_msgs::GetFloat::Response &_res)
Return the offset factor for the model&#39;s volume.
bool GetScalingDamping(uuv_gazebo_ros_plugins_msgs::GetFloat::Request &_req, uuv_gazebo_ros_plugins_msgs::GetFloat::Response &_res)
Return the scaling factor for the overall damping matrix.
bool SetFluidDensity(uuv_gazebo_ros_plugins_msgs::SetFloat::Request &_req, uuv_gazebo_ros_plugins_msgs::SetFloat::Response &_res)
Set new fluid density (this will alter the value for the buoyancy force)


uuv_gazebo_ros_plugins
Author(s): Musa Morena Marcusso Manhaes , Sebastian Scherer , Luiz Ricardo Douat
autogenerated on Thu Jun 18 2020 03:28:28