Sensor.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2018 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_SENSOR_HH_
18 #define SDF_SENSOR_HH_
19 
20 #include <memory>
21 #include <string>
22 #include <ignition/math/Pose3.hh>
23 #include <ignition/utils/ImplPtr.hh>
24 #include "sdf/Element.hh"
25 #include "sdf/SemanticPose.hh"
26 #include "sdf/Types.hh"
27 #include "sdf/sdf_config.h"
28 #include "sdf/system_util.hh"
29 
30 namespace sdf
31 {
32  // Inline bracket to help doxygen filtering.
33  inline namespace SDF_VERSION_NAMESPACE {
34  //
35 
36  // Forward declarations.
37  class AirPressure;
38  class Altimeter;
39  class Camera;
40  class ForceTorque;
41  class Imu;
42  class Lidar;
43  class Magnetometer;
44  struct PoseRelativeToGraph;
45  template <typename T> class ScopedGraph;
46 
49  // Developer note: Make sure to update sensorTypeStrs in the source file
50  // when changing this enum.
51  enum class SensorType
52  {
54  NONE = 0,
55 
57  ALTIMETER = 1,
58 
60  CAMERA = 2,
61 
63  CONTACT = 3,
64 
66  DEPTH_CAMERA = 4,
67 
69  FORCE_TORQUE = 5,
70 
72  GPS = 6,
73 
75  GPU_LIDAR = 7,
76 
78  IMU = 8,
79 
81  LOGICAL_CAMERA = 9,
82 
84  MAGNETOMETER = 10,
85 
87  MULTICAMERA = 11,
88 
90  LIDAR = 12,
91 
93  RFID = 13,
94 
96  RFIDTAG = 14,
97 
99  SONAR = 15,
100 
102  WIRELESS_RECEIVER = 16,
103 
106 
108  AIR_PRESSURE = 18,
109 
112  RGBD_CAMERA = 19,
113 
115  THERMAL_CAMERA = 20
116  };
117 
120  {
122  public: Sensor();
123 
130  public: Errors Load(ElementPtr _sdf);
131 
135  public: std::string Name() const;
136 
140  public: void SetName(const std::string &_name);
141 
144  public: std::string Topic() const;
145 
148  public: void SetTopic(const std::string &_topic);
149 
155  public: const ignition::math::Pose3d &RawPose() const;
156 
160  public: void SetRawPose(const ignition::math::Pose3d &_pose);
161 
166  public: const std::string &PoseRelativeTo() const;
167 
172  public: void SetPoseRelativeTo(const std::string &_frame);
173 
177  public: sdf::SemanticPose SemanticPose() const;
178 
183  public: sdf::ElementPtr Element() const;
184 
187  public: SensorType Type() const;
188 
191  public: void SetType(const SensorType _type);
192 
199  public: bool SetType(const std::string &_typeStr);
200 
203  public: std::string TypeStr() const;
204 
209  public: double UpdateRate() const;
210 
215  public: void SetUpdateRate(double _hz);
216 
220  public: bool operator==(const Sensor &_sensor) const;
221 
226  public: bool operator!=(const Sensor &_sensor) const;
227 
233  public: const Magnetometer *MagnetometerSensor() const;
234 
237  public: void SetMagnetometerSensor(const Magnetometer &_mag);
238 
244  public: const Altimeter *AltimeterSensor() const;
245 
248  public: void SetAltimeterSensor(const Altimeter &_alt);
249 
255  public: const AirPressure *AirPressureSensor() const;
256 
259  public: void SetAirPressureSensor(const AirPressure &_air);
260 
263  public: void SetCameraSensor(const Camera &_cam);
264 
270  public: const Camera *CameraSensor() const;
271 
274  public: void SetForceTorqueSensor(const ForceTorque &_ft);
275 
281  public: const ForceTorque *ForceTorqueSensor() const;
282 
285  public: void SetImuSensor(const Imu &_imu);
286 
292  public: const Imu *ImuSensor() const;
293 
299  public: const Lidar *LidarSensor() const;
300 
303  public: void SetLidarSensor(const Lidar &_lidar);
304 
309  private: void SetXmlParentName(const std::string &_xmlParentName);
310 
315  private: void SetPoseRelativeToGraph(
316  sdf::ScopedGraph<PoseRelativeToGraph> _graph);
317 
321  friend class Link;
322 
324  IGN_UTILS_IMPL_PTR(dataPtr)
325  };
326  }
327 }
328 #endif
Lidar contains information about a Lidar sensor.
Definition: Lidar.hh:105
A multicamera sensor.
An altimeter sensor.
Information about an SDF sensor.
Definition: Sensor.hh:119
A sonar tag sensor.
A magnetometer sensor.
A monocular camera sensor.
ForceTorque contains information about a force torque sensor.
Definition: ForceTorque.hh:64
Imu contains information about an imu sensor.
Definition: Imu.hh:33
A force-torque sensor.
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:98
A CPU based lidar sensor.
Magnetometer contains information about a magnetometer sensor.
Definition: Magnetometer.hh:34
An RGBD sensor, which produces both a color image and a depth image.
AirPressure contains information about a general purpose fluid pressure sensor.
Definition: AirPressure.hh:34
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:41
Altimeter contains information about an altimeter sensor.
Definition: Altimeter.hh:33
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
A GPU based lidar sensor.
Information about a monocular camera sensor.
Definition: Camera.hh:60
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
SemanticPose is a data structure that can be used by different DOM objects to resolve poses on a Pose...
Definition: SemanticPose.hh:54
SensorType
The set of sensor types.
Definition: Sensor.hh:51
A depth camera sensor.
namespace for Simulation Description Format parser
Definition: Actor.hh:33
A thermal camera sensor.
An air pressure sensor.
A logical camera sensor.