Gazebo Sim

API Reference

9.0.0~pre1
PerformerDetector.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 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
18#ifndef GZ_SIM_SYSTEMS_PERFORMERDETECTOR_HH_
19#define GZ_SIM_SYSTEMS_PERFORMERDETECTOR_HH_
20
21#include <map>
22#include <memory>
23#include <string>
24#include <unordered_set>
25
27#include <gz/transport/Node.hh>
28
29#include "gz/sim/Model.hh"
30#include "gz/sim/System.hh"
31
32namespace gz
33{
34namespace sim
35{
36// Inline bracket to help doxygen filtering.
37inline namespace GZ_SIM_VERSION_NAMESPACE {
38namespace systems
39{
86
88 : public System,
89 public ISystemConfigure,
91 {
93 public: PerformerDetector() = default;
94
96 public: void Configure(const Entity &_entity,
99 EventManager &_eventMgr) final;
100
102 public: void PostUpdate(
103 const gz::sim::UpdateInfo &_info,
104 const gz::sim::EntityComponentManager &_ecm) final;
105
109 private: bool IsAlreadyDetected(const Entity &_entity) const;
110
113 private: void AddToDetected(const Entity &_entity);
114
117 private: void RemoveFromDetected(const Entity &_entity);
118
126 private: void Publish(const Entity &_entity, const std::string &_name,
127 bool _state, const math::Pose3d &_pose,
128 const std::chrono::steady_clock::duration &_stamp);
129
131 private: std::unordered_set<Entity> detectedEntities;
132
134 private: Model model;
135
137 private: std::string detectorName;
138
140 private: math::AxisAlignedBox detectorGeometry;
141
143 private: transport::Node::Publisher pub;
144
146 private: bool initialized{false};
147
149 private: math::Pose3d poseOffset;
150
152 private: std::map<std::string, std::string> extraHeaderData;
153 };
154
155 }
156}
157}
158}
159
160#endif