Tetrapod Project
contact_plugin.h
Go to the documentation of this file.
1 /*******************************************************************/
2 /* AUTHOR: Paal Arthur S. Thorseth */
3 /* ORGN: Dept of Eng Cybernetics, NTNU Trondheim */
4 /* FILE: contact_plugin.h */
5 /* DATE: May 19, 2021 */
6 /* */
7 /* Copyright (C) 2021 Paal Arthur S. Thorseth, */
8 /* Adrian B. Ghansah */
9 /* */
10 /* This program is free software: you can redistribute it */
11 /* and/or modify it under the terms of the GNU General */
12 /* Public License as published by the Free Software Foundation, */
13 /* either version 3 of the License, or (at your option) any */
14 /* later version. */
15 /* */
16 /* This program is distributed in the hope that it will be useful, */
17 /* but WITHOUT ANY WARRANTY; without even the implied warranty */
18 /* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */
19 /* See the GNU General Public License for more details. */
20 /* */
21 /* You should have received a copy of the GNU General Public */
22 /* License along with this program. If not, see */
23 /* <https://www.gnu.org/licenses/>. */
24 /* */
25 /*******************************************************************/
26 
27 #pragma once
28 
29 // Gazebo
30 #include <gazebo/gazebo.hh>
31 #include <gazebo/sensors/sensors.hh>
32 
33 // ROS
34 #include "ros/ros.h"
35 
36 namespace gazebo
37 {
39  class ContactPlugin : public SensorPlugin
40  {
42  public: ContactPlugin();
43 
45  public: virtual ~ContactPlugin();
46 
50  public: virtual void Load(sensors::SensorPtr _sensor, sdf::ElementPtr _sdf);
51 
53  private: virtual void OnUpdate();
54 
56  private: sensors::ContactSensorPtr parentSensor;
57 
60  private: event::ConnectionPtr updateConnection;
61 
62  };
63 } // namespace gazebo
A plugin for the contact sensors.
virtual void Load(sensors::SensorPtr _sensor, sdf::ElementPtr _sdf)
Load the sensor plugin.
sensors::ContactSensorPtr parentSensor
Pointer to the contact sensor.
event::ConnectionPtr updateConnection
Connection that maintains a link between the contact sensor's updated signal and the OnUpdate callbac...
ContactPlugin()
Constructor.
virtual ~ContactPlugin()
Destructor.
virtual void OnUpdate()
Callback that receives the contact sensor's update signal.