19 #ifndef __UNDERWATER_OBJECT_ROS_PLUGIN_HH__ 20 #define __UNDERWATER_OBJECT_ROS_PLUGIN_HH__ 26 #include <boost/scoped_ptr.hpp> 27 #include <gazebo/gazebo.hh> 28 #include <gazebo/common/Plugin.hh> 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> 56 public:
void Load(gazebo::physics::ModelPtr _parent, sdf::ElementPtr _sdf);
59 public:
virtual void Init();
62 public:
virtual void Reset();
66 public:
virtual void Update(
const gazebo::common::UpdateInfo &_info);
71 const geometry_msgs::Vector3::ConstPtr &_msg);
75 uuv_gazebo_ros_plugins_msgs::SetUseGlobalCurrentVel::Request& _req,
76 uuv_gazebo_ros_plugins_msgs::SetUseGlobalCurrentVel::Response& _res);
81 uuv_gazebo_ros_plugins_msgs::GetModelProperties::Request& _req,
82 uuv_gazebo_ros_plugins_msgs::GetModelProperties::Response& _res);
86 uuv_gazebo_ros_plugins_msgs::SetFloat::Request& _req,
87 uuv_gazebo_ros_plugins_msgs::SetFloat::Response& _res);
91 uuv_gazebo_ros_plugins_msgs::GetFloat::Request& _req,
92 uuv_gazebo_ros_plugins_msgs::GetFloat::Response& _res);
96 uuv_gazebo_ros_plugins_msgs::SetFloat::Request& _req,
97 uuv_gazebo_ros_plugins_msgs::SetFloat::Response& _res);
101 uuv_gazebo_ros_plugins_msgs::GetFloat::Request& _req,
102 uuv_gazebo_ros_plugins_msgs::GetFloat::Response& _res);
107 uuv_gazebo_ros_plugins_msgs::SetFloat::Request& _req,
108 uuv_gazebo_ros_plugins_msgs::SetFloat::Response& _res);
113 uuv_gazebo_ros_plugins_msgs::GetFloat::Request& _req,
114 uuv_gazebo_ros_plugins_msgs::GetFloat::Response& _res);
119 uuv_gazebo_ros_plugins_msgs::SetFloat::Request& _req,
120 uuv_gazebo_ros_plugins_msgs::SetFloat::Response& _res);
124 uuv_gazebo_ros_plugins_msgs::GetFloat::Request& _req,
125 uuv_gazebo_ros_plugins_msgs::GetFloat::Response& _res);
130 uuv_gazebo_ros_plugins_msgs::SetFloat::Request& _req,
131 uuv_gazebo_ros_plugins_msgs::SetFloat::Response& _res);
135 uuv_gazebo_ros_plugins_msgs::GetFloat::Request& _req,
136 uuv_gazebo_ros_plugins_msgs::GetFloat::Response& _res);
140 uuv_gazebo_ros_plugins_msgs::SetFloat::Request& _req,
141 uuv_gazebo_ros_plugins_msgs::SetFloat::Response& _res);
145 uuv_gazebo_ros_plugins_msgs::GetFloat::Request& _req,
146 uuv_gazebo_ros_plugins_msgs::GetFloat::Response& _res);
150 uuv_gazebo_ros_plugins_msgs::SetFloat::Request& _req,
151 uuv_gazebo_ros_plugins_msgs::SetFloat::Response& _res);
155 uuv_gazebo_ros_plugins_msgs::GetFloat::Request& _req,
156 uuv_gazebo_ros_plugins_msgs::GetFloat::Response& _res);
161 uuv_gazebo_ros_plugins_msgs::SetFloat::Request& _req,
162 uuv_gazebo_ros_plugins_msgs::SetFloat::Response& _res);
167 uuv_gazebo_ros_plugins_msgs::GetFloat::Request& _req,
168 uuv_gazebo_ros_plugins_msgs::GetFloat::Response& _res);
173 uuv_gazebo_ros_plugins_msgs::SetFloat::Request& _req,
174 uuv_gazebo_ros_plugins_msgs::SetFloat::Response& _res);
179 uuv_gazebo_ros_plugins_msgs::GetFloat::Request& _req,
180 uuv_gazebo_ros_plugins_msgs::GetFloat::Response& _res);
186 gazebo::physics::LinkPtr _link);
192 gazebo::physics::LinkPtr _link);
199 ignition::math::Vector3d _force, ignition::math::Vector3d _torque,
200 geometry_msgs::WrenchStamped &_output);
206 protected:
virtual void InitDebug(gazebo::physics::LinkPtr _link,
216 private: boost::scoped_ptr<ros::NodeHandle>
rosNode;
225 private: std::map<std::string, ros::ServiceServer>
services;
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.
virtual void Reset()
Reset Module.
boost::scoped_ptr< ros::NodeHandle > rosNode
Pointer to this ROS node'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'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.
geometry_msgs::TransformStamped nedTransform
virtual ~UnderwaterObjectROSPlugin()
Destructor.
UnderwaterObjectROSPlugin()
Constructor.
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.
virtual void Init()
Initialize Module.
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'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'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's volume.
tf2_ros::TransformBroadcaster tfBroadcaster
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)