##

TouchPlugin.hh
Go to the documentation of this file.
/*
* Copyright (C) 2017 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_PLUGINS_TOUCHPLUGIN_HH_
#define GAZEBO_PLUGINS_TOUCHPLUGIN_HH_
#include <string>
#include <vector>
#include <gazebo/common/Events.hh>
#include <gazebo/common/Plugin.hh>
#include <gazebo/sensors/ContactSensor.hh>
#include <gazebo/transport/Node.hh>
#include <sdf/sdf.hh>
namespace gazebo
{
class GAZEBO_VISIBLE TouchPlugin : public ModelPlugin
{
public: TouchPlugin();
// Documentation inherited
public: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
public: void Enable(ConstIntPtr &_msg);
private: void OnUpdate(const common::UpdateInfo &_info);
private: std::vector<sensors::ContactSensorPtr> contactSensors;
private: std::string modelName;
private: std::string target;
private: std::string ns;
private: common::Time targetTime = 5;
private: common::Time touchStart;
private: transport::NodePtr gzNode;
private: transport::PublisherPtr touchedPub;
private: transport::SubscriberPtr enableSub;
private: event::ConnectionPtr updateConnection;
};
}
#endif
Events.hh
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::common::Time
A Time class, can be used to hold wall- or sim-time. stored as sec and nano-sec.
Definition: Time.hh:47
gazebo::physics::ModelPtr
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
gazebo::transport::PublisherPtr
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
gazebo::transport::SubscriberPtr
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:53
gazebo::transport::NodePtr
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
ContactSensor.hh
Node.hh
gazebo::event::ConnectionPtr
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
gazebo::TouchPlugin
Plugin which checks if this model has touched some specific target for a given time continuously and ...
Definition: TouchPlugin.hh:60
gazebo::ModelPlugin
A plugin with access to physics::Model.
Definition: Plugin.hh:303
Plugin.hh
gazebo::common::UpdateInfo
Information for use in an update event.
Definition: UpdateInfo.hh:30
GAZEBO_VISIBLE
#define GAZEBO_VISIBLE
Definition: system.hh:59