Gazebo Gazebo

API Reference

6.16.0
gz/sim/Sensor.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 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 GZ_GAZEBO_SENSOR_HH_
18 #define GZ_GAZEBO_SENSOR_HH_
19 
20 #include <memory>
21 #include <optional>
22 #include <string>
23 
24 #include <gz/utils/ImplPtr.hh>
25 
26 #include <gz/math/Pose3.hh>
27 
28 #include <sdf/Sensor.hh>
29 
30 #include "gz/sim/config.hh"
32 #include "gz/sim/Export.hh"
33 #include "gz/sim/Types.hh"
34 
35 namespace ignition
36 {
37  namespace gazebo
38  {
39  // Inline bracket to help doxygen filtering.
40  inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
41  //
61  class IGNITION_GAZEBO_VISIBLE Sensor
62  {
65  public: explicit Sensor(gazebo::Entity _entity = kNullEntity);
66 
69  public: gazebo::Entity Entity() const;
70 
73  public: void ResetEntity(gazebo::Entity _newEntity);
74 
79  public: bool Valid(const EntityComponentManager &_ecm) const;
80 
85  public: std::optional<std::string> Name(
86  const EntityComponentManager &_ecm) const;
87 
92  public: std::optional<math::Pose3d> Pose(
93  const EntityComponentManager &_ecm) const;
94 
99  public: std::optional<std::string> Topic(
100  const EntityComponentManager &_ecm) const;
101 
106  public: std::optional<gazebo::Entity> Parent(
107  const EntityComponentManager &_ecm) const;
108 
110  IGN_UTILS_IMPL_PTR(dataPtr)
111  };
112  }
113  }
114 }
115 #endif
void ResetEntity(gazebo::Entity _newEntity)
Reset Entity to a new one.
uint64_t Entity
An Entity identifies a single object in simulation such as a model, link, or light....
Definition: gz/sim/Entity.hh:58
This library is part of the Gazebo project.
The EntityComponentManager constructs, deletes, and returns components and entities....
Definition: gz/sim/EntityComponentManager.hh:66
std::optional< std::string > Name(const EntityComponentManager &_ecm) const
Get the sensor's unscoped name.
Sensor(gazebo::Entity _entity=kNullEntity)
Constructor.
std::optional< math::Pose3d > Pose(const EntityComponentManager &_ecm) const
Get the pose of the sensor.
Component< gz::math::Pose3d, class PoseTag > Pose
A component type that contains pose, gz::math::Pose3d, information.
Definition: gz/sim/components/Pose.hh:35
const Entity kNullEntity
Indicates a non-existant or invalid Entity.
Definition: gz/sim/Entity.hh:61
std::optional< gazebo::Entity > Parent(const EntityComponentManager &_ecm) const
Get the parent entity. This can be a link or a joint.
gazebo::Entity Entity() const
Get the entity which this Sensor is related to.
std::optional< std::string > Topic(const EntityComponentManager &_ecm) const
Get the topic of the sensor.
bool Valid(const EntityComponentManager &_ecm) const
Check whether this sensor correctly refers to an entity that has a components::Sensor.
Component< NoData, class SensorTag > Sensor
A component that identifies an entity as being a sensor.
Definition: gz/sim/components/Sensor.hh:35
Component< std::string, class NameTag, serializers::StringSerializer > Name
This component holds an entity's name. The component has no concept of scoped names nor does it care ...
Definition: gz/sim/components/Name.hh:37
This class provides wrappers around entities and components which are more convenient and straight-fo...
Definition: gz/sim/Sensor.hh:61