Gazebo Sim

API Reference

8.14.0
JointStatePublisher.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 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_STATE_PUBLISHER_HH_
19 #define GZ_SIM_SYSTEMS_STATE_PUBLISHER_HH_
20 
21 #include <google/protobuf/arena.h>
22 
23 #include <memory>
24 #include <set>
25 #include <string>
26 #include <chrono>
27 #include <gz/sim/Model.hh>
28 #include <gz/transport/Node.hh>
29 #include <gz/sim/System.hh>
30 
31 namespace gz
32 {
33 namespace sim
34 {
35 // Inline bracket to help doxygen filtering.
36 inline namespace GZ_SIM_VERSION_NAMESPACE {
37 namespace systems
38 {
61  : public System,
62  public ISystemConfigure,
63  public ISystemPostUpdate
64  {
67 
69  public: ~JointStatePublisher() override = default;
70 
71  // Documentation inherited
72  public: void Configure(const Entity &_entity,
74  EntityComponentManager &_ecm, EventManager &) override;
75 
76  // Documentation inherited
77  public: void PostUpdate(const UpdateInfo &_info,
78  const EntityComponentManager &_ecm) final;
79 
83  private: void CreateComponents(EntityComponentManager &_ecm,
84  sim::Entity _joint);
85 
87  private: Model model;
88 
90  private: transport::Node node;
91 
94 
96  private: std::set<Entity> joints;
97 
99  private: std::string topic;
100 
102  private: std::chrono::steady_clock::duration updatePeriod{0};
103 
105  private: std::chrono::steady_clock::duration lastUpdateTime{0};
106 
110  private: google::protobuf::Arena arena;
111  };
112  }
113 }
114 }
115 }
116 
117 #endif