Imu.hh
Go to the documentation of this file.
1 /*
2  * Copyright 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 SDF_IMU_HH_
18 #define SDF_IMU_HH_
19 
20 #include <string>
21 #include <gz/utils/ImplPtr.hh>
22 #include <sdf/Error.hh>
23 #include <sdf/Element.hh>
24 #include <sdf/Noise.hh>
25 #include <sdf/sdf_config.h>
26 
27 namespace sdf
28 {
29  // Inline bracket to help doxygen filtering.
30  inline namespace SDF_VERSION_NAMESPACE {
34  {
36  public: Imu();
37 
44  public: Errors Load(ElementPtr _sdf);
45 
50  public: sdf::ElementPtr Element() const;
51 
55  public: const Noise &LinearAccelerationXNoise() const;
56 
60  public: void SetLinearAccelerationXNoise(const Noise &_noise);
61 
65  public: const Noise &LinearAccelerationYNoise() const;
66 
70  public: void SetLinearAccelerationYNoise(const Noise &_noise);
71 
75  public: const Noise &LinearAccelerationZNoise() const;
76 
80  public: void SetLinearAccelerationZNoise(const Noise &_noise);
81 
85  public: const Noise &AngularVelocityXNoise() const;
86 
90  public: void SetAngularVelocityXNoise(const Noise &_noise);
91 
95  public: const Noise &AngularVelocityYNoise() const;
96 
100  public: void SetAngularVelocityYNoise(const Noise &_noise);
101 
105  public: const Noise &AngularVelocityZNoise() const;
106 
110  public: void SetAngularVelocityZNoise(const Noise &_noise);
111 
118  public: const gz::math::Vector3d &GravityDirX() const;
119 
126  public: void SetGravityDirX(const gz::math::Vector3d &_grav);
127 
133  public: const std::string &GravityDirXParentFrame() const;
134 
140  public: void SetGravityDirXParentFrame(const std::string &_frame);
141 
174  public: const std::string &Localization() const;
175 
178  public: void SetLocalization(const std::string &_localization);
179 
215  public: const gz::math::Vector3d &CustomRpy() const;
216 
219  public: void SetCustomRpy(const gz::math::Vector3d &_rpy);
220 
226  public: const std::string &CustomRpyParentFrame() const;
227 
233  public: void SetCustomRpyParentFrame(const std::string &_frame);
234 
238  public: bool OrientationEnabled() const;
239 
243  public: void SetOrientationEnabled(bool _enabled);
244 
248  public: bool operator==(const Imu &_imu) const;
249 
254  public: bool operator!=(const Imu &_imu) const;
255 
261  public: sdf::ElementPtr ToElement() const;
262 
269  public: sdf::ElementPtr ToElement(sdf::Errors &_errors) const;
270 
272  GZ_UTILS_IMPL_PTR(dataPtr)
273  };
274  }
275 }
276 #endif
Imu contains information about an imu sensor.
Definition: Imu.hh:34
bool OrientationEnabled() const
Get whether orientation data generation is enabled.
sdf::ElementPtr ToElement(sdf::Errors &_errors) const
Create and return an SDF element filled with data from this imu sensor.
const Noise & AngularVelocityZNoise() const
Get the noise values related to the body-frame angular velocity around the Z-axis.
sdf::ElementPtr ToElement() const
Create and return an SDF element filled with data from this imu sensor.
void SetLinearAccelerationZNoise(const Noise &_noise)
Set the noise values related to the body-frame linear acceleration on the Z-axis.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
const Noise & AngularVelocityXNoise() const
Get the noise values related to the body-frame angular velocity on the X-axis.
void SetGravityDirX(const gz::math::Vector3d &_grav)
Used when localization is set to GRAV_UP or GRAV_DOWN, a projection of this vector into a plane that ...
bool operator==(const Imu &_imu) const
Return true if both Imu objects contain the same values.
void SetLocalization(const std::string &_localization)
See Localization(const std::string &).
void SetAngularVelocityZNoise(const Noise &_noise)
Set the noise values related to the body-frame angular velocity around the Z-axis.
void SetAngularVelocityXNoise(const Noise &_noise)
Set the noise values related to the body-frame angular velocity around the X-axis.
const std::string & GravityDirXParentFrame() const
Get the name of parent frame which the GravityDirX vector is defined relative to.
const std::string & Localization() const
This string represents special hardcoded use cases that are commonly seen with typical robot IMU's:
void SetGravityDirXParentFrame(const std::string &_frame)
Set the name of parent frame which the GravityDirX vector is defined relative to.
const Noise & AngularVelocityYNoise() const
Get the noise values related to the body-frame angular velocity around the Y-axis.
const gz::math::Vector3d & CustomRpy() const
This field and CustomRpyParentFrame are used when Localization is set to CUSTOM.
bool operator!=(const Imu &_imu) const
Return true this Imu object does not contain the same values as the passed in parameter.
void SetOrientationEnabled(bool _enabled)
Set whether to enable orientation data generation.
const Noise & LinearAccelerationYNoise() const
Get the noise values related to the body-frame linear acceleration on the Y-axis.
void SetCustomRpy(const gz::math::Vector3d &_rpy)
See CustomRpy() const.
const gz::math::Vector3d & GravityDirX() const
Used when localization is set to GRAV_UP or GRAV_DOWN, a projection of this vector into a plane that ...
Errors Load(ElementPtr _sdf)
Load the IMU based on an element pointer.
const Noise & LinearAccelerationZNoise() const
Get the noise values related to the body-frame linear acceleration on the Z-axis.
Imu()
Default constructor.
const Noise & LinearAccelerationXNoise() const
Get the noise values related to the body-frame linear acceleration on the X-axis.
void SetAngularVelocityYNoise(const Noise &_noise)
Set the noise values related to the body-frame angular velocity around the Y-axis.
void SetLinearAccelerationXNoise(const Noise &_noise)
Set the noise values related to the body-frame linear acceleration on the X-axis.
void SetCustomRpyParentFrame(const std::string &_frame)
Set the name of parent frame which the custom_rpy transform is defined relative to.
const std::string & CustomRpyParentFrame() const
Get the name of parent frame which the custom_rpy transform is defined relative to.
void SetLinearAccelerationYNoise(const Noise &_noise)
Set the noise values related to the body-frame linear acceleration on the Y-axis.
The Noise class contains information about a noise model, such as a Gaussian distribution.
Definition: Noise.hh:48
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:95
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:55
namespace for Simulation Description Format parser
Definition: Actor.hh:35
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:25