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
29#include <gazebo/util/system.hh>
30
31namespace gazebo
32{
33 // Forward declare private data class.
34 class GravityCompensationPluginPrivate;
35
36 class GZ_PLUGIN_VISIBLE ModelResourceRetriever :
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
55 class GZ_PLUGIN_VISIBLE GravityCompensationPlugin : public ModelPlugin
56 {
59
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
Forward declarations for transport.
Plugin that provides gravity compensation.
Definition GravityCompensationPlugin.hh:56
virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf)
Init the DART skeleton used to calculate gravity compensation.
A plugin with access to physics::Model.
Definition Plugin.hh:304
Definition GravityCompensationPlugin.hh:38
dart::common::ResourcePtr retrieve(const dart::common::Uri &_uri) override
Documentation inherited.
bool exists(const dart::common::Uri &_uri) override
Documentation inherited.
virtual ~ModelResourceRetriever()=default
Destructor.
Information for use in an update event.
Definition UpdateInfo.hh:31
boost::shared_ptr< Model > ModelPtr
Definition PhysicsTypes.hh:93
Forward declarations for the common classes.
Definition Animation.hh:27
std::shared_ptr< ModelResourceRetriever > ModelResourceRetrieverPtr
Definition GravityCompensationPlugin.hh:52