Gazebo Sensors

API Reference

6.8.1
gz/sensors/ImuSensor.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 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 GZ_SENSORS_IMUSENSOR_HH_
18 #define GZ_SENSORS_IMUSENSOR_HH_
19 
20 #include <memory>
21 
22 #include <sdf/sdf.hh>
23 
24 #include <gz/common/SuppressWarning.hh>
25 #include <gz/math/Pose3.hh>
26 
27 #include <gz/sensors/config.hh>
28 #include <gz/sensors/imu/Export.hh>
29 
30 #include "gz/sensors/Sensor.hh"
31 
32 namespace ignition
33 {
34  namespace sensors
35  {
37  inline namespace IGNITION_SENSORS_VERSION_NAMESPACE {
38 
40  enum class IGNITION_SENSORS_VISIBLE WorldFrameEnumType
41  {
44  NONE = 0,
45 
47  ENU = 1,
48 
50  NED = 2,
51 
53  NWU = 3,
54 
56  CUSTOM = 4
57  };
58 
61  class ImuSensorPrivate;
62 
67  class IGNITION_SENSORS_IMU_VISIBLE ImuSensor : public Sensor
68  {
70  public: ImuSensor();
71 
73  public: virtual ~ImuSensor();
74 
78  public: virtual bool Load(const sdf::Sensor &_sdf) override;
79 
83  public: virtual bool Load(sdf::ElementPtr _sdf) override;
84 
87  public: virtual bool Init() override;
88 
92  public: virtual bool Update(
93  const std::chrono::steady_clock::duration &_now) override;
94 
98  public: void SetAngularVelocity(const math::Vector3d &_angularVel);
99 
103  public: math::Vector3d AngularVelocity() const;
104 
108  public: void SetLinearAcceleration(const math::Vector3d &_linearAcc);
109 
113  public: math::Vector3d LinearAcceleration() const;
114 
117  public: void SetWorldPose(const math::Pose3d _pose);
118 
121  public: math::Pose3d WorldPose() const;
122 
127  public: void SetOrientationReference(
128  const math::Quaterniond &_orient);
129 
132  public: math::Quaterniond OrientationReference() const;
133 
139  public: math::Quaterniond Orientation() const;
140 
143  public: void SetGravity(const math::Vector3d &_gravity);
144 
150  public: void SetOrientationEnabled(bool _enabled);
151 
154  public: bool OrientationEnabled() const;
155 
158  public: math::Vector3d Gravity() const;
159 
164  public: void SetWorldFrameOrientation(
165  const math::Quaterniond &_rot, WorldFrameEnumType _relativeTo);
166 
170  public: bool HasConnections() const;
171 
172  IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
175  private: std::unique_ptr<ImuSensorPrivate> dataPtr;
176  IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
177  };
178  }
179  }
180 }
181 
182 #endif
Definition: gz/sensors/AirPressureSensor.hh:31
WorldFrameEnumType
Inline bracket to help doxygen filtering.
Definition: gz/sensors/ImuSensor.hh:40
@ ENU
ENU (East-North-Up): x - East, y - North, z - Up.
@ NWU
NWU (North-West-Up): x - North, y - West, z - Up.
Imu Sensor Class.
Definition: gz/sensors/ImuSensor.hh:67
@ NONE
NONE : To be used only when <localization> reference orientation tag is empty.
a base sensor class
Definition: gz/sensors/Sensor.hh:59
@ CUSTOM
CUSTOM : The frame is described using custom_rpy tag.
@ NED
NED (North-East-Down): x - North, y - East, z - Down.