DiffDrivePlugin.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 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_DIFFDRIVEPLUGIN_HH_
18 #define GAZEBO_PLUGINS_DIFFDRIVEPLUGIN_HH_
19 #include <ignition/transport/Node.hh>
20 
21 #include "gazebo/common/Plugin.hh"
22 #include "gazebo/physics/physics.hh"
24 #include "gazebo/gazebo.hh"
25 #include "gazebo/util/system.hh"
26 
27 namespace gazebo
28 {
30  {
31  public: DiffDrivePlugin();
32  public: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
33  public: virtual void Init();
34 
35  private: void OnUpdate();
36 
37  private: void OnVelMsg(ConstPosePtr &_msg);
38 
39  private: transport::NodePtr node;
40  private: transport::SubscriberPtr velSub;
41 
42  private: physics::ModelPtr model;
43  private: physics::JointPtr leftJoint, rightJoint;
44  private: event::ConnectionPtr updateConnection;
45  private: double wheelSpeed[2];
46  private: double wheelSeparation;
47  private: double wheelRadius;
48  private: common::Time prevUpdateTime;
49 
50  private: physics::LinkPtr link, leftWheelLink, rightWheelLink;
51 
52  // Place ignition::transport objects at the end of this file to
53  // guarantee they are destructed first.
54 
56  private: ignition::transport::Node nodeIgn;
57  };
58 }
59 #endif
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:109
Forward declarations for transport.
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:53
boost::shared_ptr< Joint > JointPtr
Definition: PhysicsTypes.hh:117
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
Definition: DiffDrivePlugin.hh:29
A plugin with access to physics::Model.
Definition: Plugin.hh:260
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:58
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:44