Gazebo Sensors

API Reference

7.3.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/utils/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 gz
33 {
34  namespace sensors
35  {
37  inline namespace GZ_SENSORS_VERSION_NAMESPACE {
38 
40  enum class GZ_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 GZ_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 
89  using Sensor::Update;
90 
94  public: virtual bool Update(
95  const std::chrono::steady_clock::duration &_now) override;
96 
100  public: void SetAngularVelocity(const math::Vector3d &_angularVel);
101 
105  public: math::Vector3d AngularVelocity() const;
106 
110  public: void SetLinearAcceleration(const math::Vector3d &_linearAcc);
111 
115  public: math::Vector3d LinearAcceleration() const;
116 
119  public: void SetWorldPose(const math::Pose3d _pose);
120 
123  public: math::Pose3d WorldPose() const;
124 
129  public: void SetOrientationReference(
130  const math::Quaterniond &_orient);
131 
134  public: math::Quaterniond OrientationReference() const;
135 
141  public: math::Quaterniond Orientation() const;
142 
145  public: void SetGravity(const math::Vector3d &_gravity);
146 
152  public: void SetOrientationEnabled(bool _enabled);
153 
156  public: bool OrientationEnabled() const;
157 
160  public: math::Vector3d Gravity() const;
161 
166  public: void SetWorldFrameOrientation(
167  const math::Quaterniond &_rot, WorldFrameEnumType _relativeTo);
168 
171  public: virtual bool HasConnections() const override;
172 
173  GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
176  private: std::unique_ptr<ImuSensorPrivate> dataPtr;
177  GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
178  };
179  }
180  }
181 }
182 
183 #endif