ThrusterROSPlugin.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 
16 #ifndef __THRUSTER_ROS_PLUGIN_HH__
17 #define __THRUSTER_ROS_PLUGIN_HH__
18 
19 #include <map>
20 #include <string>
21 #include <vector>
22 
24 
25 #include <boost/scoped_ptr.hpp>
26 #include <gazebo/common/Plugin.hh>
27 #include <ros/ros.h>
28 #include <uuv_gazebo_ros_plugins_msgs/FloatStamped.h>
29 #include <geometry_msgs/WrenchStamped.h>
30 #include <std_msgs/Bool.h>
31 #include <std_msgs/Float64.h>
32 
33 #include <uuv_gazebo_ros_plugins_msgs/SetThrusterState.h>
34 #include <uuv_gazebo_ros_plugins_msgs/GetThrusterState.h>
35 #include <uuv_gazebo_ros_plugins_msgs/SetThrusterEfficiency.h>
36 #include <uuv_gazebo_ros_plugins_msgs/GetThrusterEfficiency.h>
37 #include <uuv_gazebo_ros_plugins_msgs/GetThrusterConversionFcn.h>
38 
39 namespace uuv_simulator_ros
40 {
42  {
44  public: ThrusterROSPlugin();
45 
47  public: ~ThrusterROSPlugin();
48 
50  public: void Load(gazebo::physics::ModelPtr _parent, sdf::ElementPtr _sdf);
51 
53  public: void RosPublishStates();
54 
56  public: void SetThrustReference(
57  const uuv_gazebo_ros_plugins_msgs::FloatStamped::ConstPtr &_msg);
58 
60  public: gazebo::common::Time GetRosPublishPeriod();
61 
63  public: void SetRosPublishRate(double _hz);
64 
66  public: virtual void Init();
67 
69  public: virtual void Reset();
70 
72  public: bool SetThrustForceEfficiency(
73  uuv_gazebo_ros_plugins_msgs::SetThrusterEfficiency::Request& _req,
74  uuv_gazebo_ros_plugins_msgs::SetThrusterEfficiency::Response& _res);
75 
77  public: bool GetThrustForceEfficiency(
78  uuv_gazebo_ros_plugins_msgs::GetThrusterEfficiency::Request& _req,
79  uuv_gazebo_ros_plugins_msgs::GetThrusterEfficiency::Response& _res);
80 
82  public: bool SetDynamicStateEfficiency(
83  uuv_gazebo_ros_plugins_msgs::SetThrusterEfficiency::Request& _req,
84  uuv_gazebo_ros_plugins_msgs::SetThrusterEfficiency::Response& _res);
85 
87  public: bool GetDynamicStateEfficiency(
88  uuv_gazebo_ros_plugins_msgs::GetThrusterEfficiency::Request& _req,
89  uuv_gazebo_ros_plugins_msgs::GetThrusterEfficiency::Response& _res);
90 
92  public: bool SetThrusterState(
93  uuv_gazebo_ros_plugins_msgs::SetThrusterState::Request& _req,
94  uuv_gazebo_ros_plugins_msgs::SetThrusterState::Response& _res);
95 
97  public: bool GetThrusterState(
98  uuv_gazebo_ros_plugins_msgs::GetThrusterState::Request& _req,
99  uuv_gazebo_ros_plugins_msgs::GetThrusterState::Response& _res);
100 
102  public: bool GetThrusterConversionFcn(
103  uuv_gazebo_ros_plugins_msgs::GetThrusterConversionFcn::Request& _req,
104  uuv_gazebo_ros_plugins_msgs::GetThrusterConversionFcn::Response& _res);
105 
107  private: std::map<std::string, ros::ServiceServer> services;
108 
110  private: boost::scoped_ptr<ros::NodeHandle> rosNode;
111 
114 
117 
120 
123 
126 
129 
131  private: gazebo::event::ConnectionPtr rosPublishConnection;
132 
134  private: gazebo::common::Time rosPublishPeriod;
135 
137  private: gazebo::common::Time lastRosPublishTime;
138  };
139 }
140 
141 #endif // __THRUSTER_ROS_PLUGIN_HH__
ros::Publisher pubThrustForceEff
Publisher for the thrust force efficiency.
bool GetThrustForceEfficiency(uuv_gazebo_ros_plugins_msgs::GetThrusterEfficiency::Request &_req, uuv_gazebo_ros_plugins_msgs::GetThrusterEfficiency::Response &_res)
Get the thrust efficiency factor.
gazebo::common::Time GetRosPublishPeriod()
Return the ROS publish period.
gazebo::event::ConnectionPtr rosPublishConnection
Connection for callbacks on update world.
boost::scoped_ptr< ros::NodeHandle > rosNode
Pointer to this ROS node&#39;s handle.
bool SetThrusterState(uuv_gazebo_ros_plugins_msgs::SetThrusterState::Request &_req, uuv_gazebo_ros_plugins_msgs::SetThrusterState::Response &_res)
Turn thruster on/off.
ros::Publisher pubThrust
Publisher for current actual thrust.
ros::Publisher pubThrustWrench
Publisher for current actual thrust as wrench.
std::map< std::string, ros::ServiceServer > services
Map of thruster services.
void RosPublishStates()
Publish thruster state via ROS.
void SetThrustReference(const uuv_gazebo_ros_plugins_msgs::FloatStamped::ConstPtr &_msg)
Set new set point (desired thrust [N]) for thruster.
ros::Publisher pubDynamicStateEff
Publisher for the dynamic state efficiency.
virtual void Reset()
Reset Module.
bool SetThrustForceEfficiency(uuv_gazebo_ros_plugins_msgs::SetThrusterEfficiency::Request &_req, uuv_gazebo_ros_plugins_msgs::SetThrusterEfficiency::Response &_res)
Set the thrust efficiency factor.
bool GetDynamicStateEfficiency(uuv_gazebo_ros_plugins_msgs::GetThrusterEfficiency::Request &_req, uuv_gazebo_ros_plugins_msgs::GetThrusterEfficiency::Response &_res)
Get the dynamic state efficiency factor.
bool GetThrusterConversionFcn(uuv_gazebo_ros_plugins_msgs::GetThrusterConversionFcn::Request &_req, uuv_gazebo_ros_plugins_msgs::GetThrusterConversionFcn::Response &_res)
Get thruster conversion function parameters.
bool GetThrusterState(uuv_gazebo_ros_plugins_msgs::GetThrusterState::Request &_req, uuv_gazebo_ros_plugins_msgs::GetThrusterState::Response &_res)
Get thruster state.
void SetRosPublishRate(double _hz)
Set the ROS publish frequency (Hz).
bool SetDynamicStateEfficiency(uuv_gazebo_ros_plugins_msgs::SetThrusterEfficiency::Request &_req, uuv_gazebo_ros_plugins_msgs::SetThrusterEfficiency::Response &_res)
Set the dynamic state efficiency factor.
ros::Publisher pubThrusterState
Publisher for the thruster state.
void Load(gazebo::physics::ModelPtr _parent, sdf::ElementPtr _sdf)
Load module and read parameters from SDF.
ros::Subscriber subThrustReference
Subscriber reacting to new reference thrust set points.
gazebo::common::Time rosPublishPeriod
Period after which we should publish a message via ROS.
gazebo::common::Time lastRosPublishTime
Last time we published a message via ROS.
virtual void Init()
Initialize Module.


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