|
| 1 | +/* |
| 2 | + * Copyright 2021 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_NAVSAT_HH_ |
| 18 | +#define SDF_NAVSAT_HH_ |
| 19 | + |
| 20 | +#include <sdf/Error.hh> |
| 21 | +#include <sdf/Element.hh> |
| 22 | +#include <sdf/Noise.hh> |
| 23 | +#include <sdf/sdf_config.h> |
| 24 | + |
| 25 | +#include <ignition/math/Angle.hh> |
| 26 | + |
| 27 | +namespace sdf |
| 28 | +{ |
| 29 | + // Inline bracket to help doxygen filtering. |
| 30 | + inline namespace SDF_VERSION_NAMESPACE { |
| 31 | + // |
| 32 | + class NavSatPrivate; |
| 33 | + |
| 34 | + /// \brief NavSat contains information about a NavSat sensor. |
| 35 | + /// This sensor can be attached to a link. The NavSat sensor can be defined |
| 36 | + /// SDF XML by the "navsat" type. |
| 37 | + /// |
| 38 | + /// # Example SDF XML using navsat type: |
| 39 | + /// |
| 40 | + /// ~~~{.xml} |
| 41 | + /// <sensor name="navsat_sensor" type="navsat"> |
| 42 | + /// <pose>1 2 3 0 0 0</pose> |
| 43 | + /// <topic>/navsat</topic> |
| 44 | + /// <navsat> |
| 45 | + /// <position_sensing> |
| 46 | + /// <horizontal> |
| 47 | + /// <noise type="gaussian"> |
| 48 | + /// <mean>0.98</mean> |
| 49 | + /// <stddev>0.76</stddev> |
| 50 | + /// </noise> |
| 51 | + /// </horizontal> |
| 52 | + /// <vertical> |
| 53 | + /// <noise type="gaussian"> |
| 54 | + /// <mean>0.98</mean> |
| 55 | + /// <stddev>0.76</stddev> |
| 56 | + /// </noise> |
| 57 | + /// </vertical> |
| 58 | + /// </position_sensing> |
| 59 | + /// <velocity_sensing> |
| 60 | + /// <horizontal> |
| 61 | + /// <noise type="gaussian"> |
| 62 | + /// <mean>0.98</mean> |
| 63 | + /// <stddev>0.76</stddev> |
| 64 | + /// </noise> |
| 65 | + /// </horizontal> |
| 66 | + /// <vertical> |
| 67 | + /// <noise type="gaussian"> |
| 68 | + /// <mean>0.98</mean> |
| 69 | + /// <stddev>0.76</stddev> |
| 70 | + /// </noise> |
| 71 | + /// </vertical> |
| 72 | + /// </velocity_sensing> |
| 73 | + /// </navsat> |
| 74 | + /// </sensor> |
| 75 | + /// ~~~ |
| 76 | + class SDFORMAT_VISIBLE NavSat |
| 77 | + { |
| 78 | + /// \brief Default constructor |
| 79 | + public: NavSat(); |
| 80 | + |
| 81 | + /// \brief Copy constructor |
| 82 | + /// \param[in] _navsat NavSat to copy. |
| 83 | + public: NavSat(const NavSat &_navsat); |
| 84 | + |
| 85 | + /// \brief Move constructor |
| 86 | + /// \param[in] _navsat NavSat to move. |
| 87 | + public: NavSat(NavSat &&_navsat) noexcept; |
| 88 | + |
| 89 | + /// \brief Destructor |
| 90 | + public: ~NavSat(); |
| 91 | + |
| 92 | + /// \brief Assignment operator |
| 93 | + /// \param[in] _navsat The navsat to set values from. |
| 94 | + /// \return *this |
| 95 | + public: NavSat &operator=(const NavSat &_navsat); |
| 96 | + |
| 97 | + /// \brief Move assignment operator |
| 98 | + /// \param[in] _navsat The navsat to set values from. |
| 99 | + /// \return *this |
| 100 | + public: NavSat &operator=(NavSat &&_navsat) noexcept; |
| 101 | + |
| 102 | + /// \brief Load the navsat based on an element pointer. This is *not* |
| 103 | + /// the usual entry point. Typical usage of the SDF DOM is through the Root |
| 104 | + /// object. |
| 105 | + /// \param[in] _sdf The SDF Element pointer |
| 106 | + /// \return Errors, which is a vector of Error objects. Each Error includes |
| 107 | + /// an error code and message. An empty vector indicates no error. |
| 108 | + public: Errors Load(ElementPtr _sdf); |
| 109 | + |
| 110 | + /// \brief Get a pointer to the SDF element that was used during |
| 111 | + /// load. |
| 112 | + /// \return SDF element pointer. The value will be nullptr if Load has |
| 113 | + /// not been called. |
| 114 | + public: sdf::ElementPtr Element() const; |
| 115 | + |
| 116 | + /// \brief Set the noise values for the horizontal position sensor |
| 117 | + /// \param[in] _noise Noise values to set to |
| 118 | + public: void SetHorizontalPositionNoise(const Noise &_noise); |
| 119 | + |
| 120 | + /// \brief Get noise value for horizontal position sensor |
| 121 | + /// \return Noise values |
| 122 | + public: const Noise &HorizontalPositionNoise() const; |
| 123 | + |
| 124 | + /// \brief Set the noise values for the vertical position sensor |
| 125 | + /// \param[in] _noise Noise values to set to |
| 126 | + public: void SetVerticalPositionNoise(const Noise &_noise); |
| 127 | + |
| 128 | + /// \brief Get noise value for vertical position sensor |
| 129 | + /// \return Noise values |
| 130 | + public: const Noise &VerticalPositionNoise() const; |
| 131 | + |
| 132 | + /// \brief Set the noise values for the horizontal velocity sensor |
| 133 | + /// \param[in] _noise Noise values to set to |
| 134 | + public: void SetHorizontalVelocityNoise(const Noise &_noise); |
| 135 | + |
| 136 | + /// \brief Get noise value for horizontal velocity sensor |
| 137 | + /// \return Noise values |
| 138 | + public: const Noise &HorizontalVelocityNoise() const; |
| 139 | + |
| 140 | + /// \brief Set the noise values for the vertical velocity sensor |
| 141 | + /// \param[in] _noise Noise values to set to |
| 142 | + public: void SetVerticalVelocityNoise(const Noise &_noise); |
| 143 | + |
| 144 | + /// \brief Get noise value for vertical velocity sensor |
| 145 | + /// \return Noise values |
| 146 | + public: const Noise &VerticalVelocityNoise() const; |
| 147 | + |
| 148 | + /// \brief Return true if both NavSat objects contain the same values. |
| 149 | + /// \param[_in] _navsat NavSat value to compare. |
| 150 | + /// \return True if 'this' == _navsat. |
| 151 | + public: bool operator==(const NavSat &_navsat) const; |
| 152 | + |
| 153 | + /// \brief Return true this NavSat object does not contain the same |
| 154 | + /// values as the passed in parameter. |
| 155 | + /// \param[_in] _navsat NavSat value to compare. |
| 156 | + /// \return True if 'this' != _navsat. |
| 157 | + public: bool operator!=(const NavSat &_navsat) const; |
| 158 | + |
| 159 | + /// \brief Private data pointer. |
| 160 | + private: NavSatPrivate *dataPtr; |
| 161 | + }; |
| 162 | + } |
| 163 | +} |
| 164 | +#endif |
0 commit comments