VehiclePlugin.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 
18 #ifndef GAZEBO_PLUGINS_VEHICLEPLUGIN_HH_
19 #define GAZEBO_PLUGINS_VEHICLEPLUGIN_HH_
20 
21 #include <string>
22 #include <vector>
23 
24 #include <ignition/transport/Node.hh>
25 #include <ignition/math/Vector3.hh>
26 
27 #include "gazebo/common/Plugin.hh"
28 #include "gazebo/physics/physics.hh"
29 #include "gazebo/transport/transport.hh"
30 #include "gazebo/util/system.hh"
31 
32 namespace gazebo
33 {
35  {
37  public: VehiclePlugin();
38 
39  public: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
40  public: virtual void Init();
41 
42  private: void OnUpdate();
43 
44  private: void OnVelMsg(ConstPosePtr &_msg);
45 
46  private: std::vector<event::ConnectionPtr> connections;
47 
48  private: physics::ModelPtr model;
49  private: physics::LinkPtr chassis;
50  private: std::vector<physics::JointPtr> joints;
51  private: physics::JointPtr gasJoint, brakeJoint;
52  private: physics::JointPtr steeringJoint;
53 
54  private: ignition::math::Vector3d velocity;
55 
56  private: transport::NodePtr node;
57  private: transport::SubscriberPtr velSub;
58 
59  private: double frontPower, rearPower;
60  private: double maxSpeed;
61  private: double wheelRadius;
62 
63  private: double steeringRatio;
64  private: double tireAngleRange;
65  private: double maxGas, maxBrake;
66 
67  private: double aeroLoad;
68  private: double swayForce;
69 
70  // Place ignition::transport objects at the end of this file to
71  // guarantee they are destructed first.
72 
74  private: ignition::transport::Node nodeIgn;
75  };
76 }
77 #endif
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:109
Forward declarations for the common classes.
Definition: Animation.hh:33
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
Definition: VehiclePlugin.hh:34
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
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