|
| 1 | +/* |
| 2 | + * Copyright 2023 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_AirFlow_HH_ |
| 18 | +#define SDF_AirFlow_HH_ |
| 19 | + |
| 20 | +#include <gz/utils/ImplPtr.hh> |
| 21 | + |
| 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 bracke to help doxygen filtering. |
| 30 | + inline namespace SDF_VERSION_NAMESPACE { |
| 31 | + /// \brief AirFlow contains information about a general |
| 32 | + /// purpose air flow sensor. |
| 33 | + /// This sensor can be attached to a link. |
| 34 | + class SDFORMAT_VISIBLE AirFlow |
| 35 | + { |
| 36 | + /// \brief Default constructor |
| 37 | + public: AirFlow(); |
| 38 | + |
| 39 | + /// \brief Load the air flow based on an element pointer. |
| 40 | + /// This is *not* the usual entry point. Typical usage of the SDF DOM is |
| 41 | + /// through the Root object. |
| 42 | + /// \param[in] _sdf The SDF Element pointer |
| 43 | + /// \return Errors, which is a vector of Error objects. Each Error includes |
| 44 | + /// an error code and message. An empty vector indicates no error. |
| 45 | + public: Errors Load(ElementPtr _sdf); |
| 46 | + |
| 47 | + /// \brief Get a pointer to the SDF element that was used during |
| 48 | + /// load. |
| 49 | + /// \return SDF element pointer. The value will be nullptr if Load has |
| 50 | + /// not been called. |
| 51 | + public: sdf::ElementPtr Element() const; |
| 52 | + |
| 53 | + /// \brief Get the noise values. |
| 54 | + /// \return Noise values for differential pressure data. |
| 55 | + public: const Noise &SpeedNoise() const; |
| 56 | + |
| 57 | + /// \brief Set the noise values related to the differential pressure data. |
| 58 | + /// \param[in] _noise Noise values for the pressure data. |
| 59 | + public: void SetSpeedNoise(const Noise &_noise);\ |
| 60 | + |
| 61 | + /// \brief Get the noise values. |
| 62 | + /// \return Noise values for differential pressure data. |
| 63 | + public: const Noise &DirectionNoise() const; |
| 64 | + |
| 65 | + /// \brief Set the noise values related to the differential pressure data. |
| 66 | + /// \param[in] _noise Noise values for the pressure data. |
| 67 | + public: void SetDirectionNoise(const Noise &_noise); |
| 68 | + |
| 69 | + /// \brief Return true if both AirFlow objects contain the |
| 70 | + /// same values. |
| 71 | + /// \param[_in] _air AirFlow value to compare. |
| 72 | + /// \returen True if 'this' == _air. |
| 73 | + public: bool operator==(const AirFlow &_air) const; |
| 74 | + |
| 75 | + /// \brief Return true this AirFlow object does not contain |
| 76 | + /// the same values as the passed in parameter. |
| 77 | + /// \param[_in] _air AirFlow value to compare. |
| 78 | + /// \returen True if 'this' != _air. |
| 79 | + public: bool operator!=(const AirFlow &_air) const; |
| 80 | + |
| 81 | + /// \brief Create and return an SDF element filled with data from this |
| 82 | + /// air pressure sensor. |
| 83 | + /// Note that parameter passing functionality is not captured with this |
| 84 | + /// function. |
| 85 | + /// \return SDF element pointer with updated sensor values. |
| 86 | + public: sdf::ElementPtr ToElement() const; |
| 87 | + |
| 88 | + /// \brief Private data pointer. |
| 89 | + GZ_UTILS_IMPL_PTR(dataPtr) |
| 90 | + }; |
| 91 | + } |
| 92 | +} |
| 93 | +#endif |
0 commit comments