DiffDrivePlugin.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2016 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_DIFFDRIVE_PLUGIN_HH_
18 #define _GAZEBO_DIFFDRIVE_PLUGIN_HH_
19 
20 #include "gazebo/common/Plugin.hh"
21 #include "gazebo/physics/physics.hh"
23 #include "gazebo/gazebo.hh"
24 #include "gazebo/util/system.hh"
25 
26 namespace gazebo
27 {
29  {
30  public: DiffDrivePlugin();
31  public: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
32  public: virtual void Init();
33 
34  private: void OnUpdate();
35 
36  private: void OnVelMsg(ConstPosePtr &_msg);
37 
38  private: transport::NodePtr node;
39  private: transport::SubscriberPtr velSub;
40 
41  private: physics::ModelPtr model;
42  private: physics::JointPtr leftJoint, rightJoint;
43  private: event::ConnectionPtr updateConnection;
44  private: double wheelSpeed[2];
45  private: double wheelSeparation;
46  private: double wheelRadius;
47  private: common::Time prevUpdateTime;
48 
49  private: physics::LinkPtr link, leftWheelLink, rightWheelLink;
50  };
51 }
52 #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:153
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:28
A plugin with access to physics::Model.
Definition: Plugin.hh:245
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:59
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:44