GravityCompensationPlugin.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Open Source Robotics Foundation
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 */
17 #ifndef GAZEBO_PLUGINS_GRAVITYCOMPENSATIONPLUGIN_HH_
18 #define GAZEBO_PLUGINS_GRAVITYCOMPENSATIONPLUGIN_HH_
19 
20 #include <memory>
21 
22 #include <sdf/sdf.hh>
23 
24 #include <dart/common/LocalResourceRetriever.hpp>
25 
28 #include <gazebo/common/Plugin.hh>
29 #include <gazebo/util/system.hh>
30 
31 namespace gazebo
32 {
33  // Forward declare private data class.
34  class GravityCompensationPluginPrivate;
35 
37  public virtual dart::common::LocalResourceRetriever
38  {
40  public: virtual ~ModelResourceRetriever() = default;
41 
43  public: bool exists(const dart::common::Uri &_uri) override;
44 
46  public: dart::common::ResourcePtr retrieve(
47  const dart::common::Uri &_uri) override;
48 
50  private: dart::common::Uri resolve(const dart::common::Uri &_uri);
51  };
52  using ModelResourceRetrieverPtr = std::shared_ptr<ModelResourceRetriever>;
53 
56  {
58  public: GravityCompensationPlugin();
59 
61  public: ~GravityCompensationPlugin();
62 
64  public: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
65 
68  private: void Update(const common::UpdateInfo &_info);
69 
72  private: void OnPhysicsMsg(ConstPhysicsPtr &_msg);
73 
76  private: std::unique_ptr<GravityCompensationPluginPrivate> dataPtr;
77  };
78 }
79 #endif
Definition: GravityCompensationPlugin.hh:36
Forward declarations for transport.
Information for use in an update event.
Definition: UpdateInfo.hh:30
std::shared_ptr< ModelResourceRetriever > ModelResourceRetrieverPtr
Definition: GravityCompensationPlugin.hh:52
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
Plugin that provides gravity compensation.
Definition: GravityCompensationPlugin.hh:55
A plugin with access to physics::Model.
Definition: Plugin.hh:260
bool exists(const std::string &_path)
Returns true if _path is a file or directory.
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:59