All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImuSensor.hh
Go to the documentation of this file.
1 /*
2  * Copyright 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 _IMUSENSOR_HH_
19 #define _IMUSENSOR_HH_
20 
21 #include <vector>
22 #include <string>
23 
25 #include "gazebo/sensors/Sensor.hh"
26 
27 namespace gazebo
28 {
29  namespace sensors
30  {
33 
36  class ImuSensor: public Sensor
37  {
39  public: ImuSensor();
40 
42  public: virtual ~ImuSensor();
43 
44  // Documentation inherited.
45  protected: void Load(const std::string &_worldName, sdf::ElementPtr _sdf);
46 
47  // Documentation inherited.
48  protected: virtual void Load(const std::string &_worldName);
49 
51  protected: virtual void Init();
52 
53  // Documentation inherited
54  protected: virtual void UpdateImpl(bool _force);
55 
56  // Documentation inherited
57  protected: virtual void Fini();
58 
61  public: math::Vector3 GetAngularVelocity() const;
62 
65  public: math::Vector3 GetLinearAcceleration() const;
66 
70  public: math::Quaternion GetOrientation() const;
71 
73  public: void SetReferencePose();
74 
76  private: math::Pose referencePose;
77 
79  private: math::Vector3 lastLinearVel;
80 
82  private: math::Vector3 linearAcc;
83 
85  private: math::Vector3 gravity;
86 
87  private: transport::PublisherPtr pub;
88  private: physics::LinkPtr parentEntity;
89  private: msgs::IMU imuMsg;
90  };
92  }
93 }
94 #endif