SkidSteerDrivePlugin.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_SKIDSTEERDRIVEPLUGIN_HH_
18 #define GAZEBO_PLUGINS_SKIDSTEERDRIVEPLUGIN_HH_
19 
20 #include <string>
21 #include <ignition/transport/Node.hh>
22 
23 #include "gazebo/common/Plugin.hh"
24 #include "gazebo/physics/physics.hh"
26 #include "gazebo/util/system.hh"
27 
28 #define NUMBER_OF_WHEELS 4
29 
30 namespace gazebo
31 {
32  // \class SkidSteerDrivePlugin SkidSteerDrivePlugin.hh
36  class GZ_PLUGIN_VISIBLE SkidSteerDrivePlugin : public ModelPlugin
37  {
39  public: SkidSteerDrivePlugin();
40 
44  public: void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
45 
47  public: enum {RIGHT_FRONT, RIGHT_REAR, LEFT_FRONT, LEFT_REAR};
48 
53  private: int RegisterJoint(int _index, const std::string &_name);
54 
57  private: void OnVelMsg(ConstPosePtr &_msg);
58 
60  private: transport::NodePtr node;
61 
63  private: transport::SubscriberPtr velSub;
64 
66  private: physics::ModelPtr model;
67 
69  private: physics::JointPtr joints[NUMBER_OF_WHEELS];
70 
72  private: double wheelSeparation;
73 
75  private: double wheelRadius;
76 
77  // Place ignition::transport objects at the end of this file to
78  // guarantee they are destructed first.
79 
81  private: ignition::transport::Node nodeIgn;
82  };
83 }
84 #endif
Forward declarations for the common classes.
Definition: Animation.hh:26
Definition: SkidSteerDrivePlugin.hh:47
#define NUMBER_OF_WHEELS
Definition: SkidSteerDrivePlugin.hh:28
Forward declarations for transport.
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:53
A gazebo model plugin that controls a four wheel skid-steer robot via a gazebo topic.
Definition: SkidSteerDrivePlugin.hh:36
boost::shared_ptr< Joint > JointPtr
Definition: PhysicsTypes.hh:118
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:94
A plugin with access to physics::Model.
Definition: Plugin.hh:303