Gazebo Sim

API Reference

7.9.0
gz/sim/Joint.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_SIM_JOINT_HH_
18 #define GZ_SIM_JOINT_HH_
19 
20 #include <memory>
21 #include <optional>
22 #include <string>
23 #include <vector>
24 
25 #include <gz/msgs/wrench.pb.h>
26 #include <gz/utils/ImplPtr.hh>
27 
28 #include <gz/math/Pose3.hh>
29 #include <gz/math/Vector2.hh>
30 #include <gz/math/Vector3.hh>
31 
32 #include <sdf/Joint.hh>
33 #include <sdf/JointAxis.hh>
34 
35 #include "gz/sim/config.hh"
37 #include "gz/sim/Export.hh"
38 #include "gz/sim/Model.hh"
39 #include "gz/sim/Types.hh"
40 
41 namespace gz
42 {
43  namespace sim
44  {
45  // Inline bracket to help doxygen filtering.
46  inline namespace GZ_SIM_VERSION_NAMESPACE {
47  //
67  class GZ_SIM_VISIBLE Joint
68  {
71  public: explicit Joint(sim::Entity _entity = kNullEntity);
72 
75  public: sim::Entity Entity() const;
76 
79  public: void ResetEntity(sim::Entity _newEntity);
80 
85  public: bool Valid(const EntityComponentManager &_ecm) const;
86 
91  public: std::optional<std::string> Name(
92  const EntityComponentManager &_ecm) const;
93 
98  public: std::optional<std::string> ParentLinkName(
99  const EntityComponentManager &_ecm) const;
100 
105  public: std::optional<std::string> ChildLinkName(
106  const EntityComponentManager &_ecm) const;
107 
112  public: std::optional<math::Pose3d> Pose(
113  const EntityComponentManager &_ecm) const;
114 
119  public: std::optional<double> ThreadPitch(
120  const EntityComponentManager &_ecm) const;
121 
126  public: std::optional<std::vector<sdf::JointAxis>> Axis(
127  const EntityComponentManager &_ecm) const;
128 
133  public: std::optional<sdf::JointType> Type(
134  const EntityComponentManager &_ecm) const;
135 
141  public: sim::Entity SensorByName(const EntityComponentManager &_ecm,
142  const std::string &_name) const;
143 
147  public: std::vector<sim::Entity> Sensors(
148  const EntityComponentManager &_ecm) const;
149 
154  public: uint64_t SensorCount(const EntityComponentManager &_ecm) const;
155 
164  public: void SetVelocity(EntityComponentManager &_ecm,
165  const std::vector<double> &_velocities);
166 
173  public: void SetForce(EntityComponentManager &_ecm,
174  const std::vector<double> &_forces);
175 
182  public: void SetVelocityLimits(EntityComponentManager &_ecm,
183  const std::vector<math::Vector2d> &_limits);
184 
191  public: void SetEffortLimits(EntityComponentManager &_ecm,
192  const std::vector<math::Vector2d> &_limits);
193 
200  public: void SetPositionLimits(EntityComponentManager &_ecm,
201  const std::vector<math::Vector2d> &_limits);
202 
208  public: void ResetPosition(EntityComponentManager &_ecm,
209  const std::vector<double> &_positions);
210 
217  public: void ResetVelocity(EntityComponentManager &_ecm,
218  const std::vector<double> &_velocities);
219 
226  public: void EnableVelocityCheck(EntityComponentManager &_ecm,
227  bool _enable = true) const;
228 
235  public: void EnablePositionCheck(EntityComponentManager &_ecm,
236  bool _enable = true) const;
237 
244  public: void EnableTransmittedWrenchCheck(EntityComponentManager &_ecm,
245  bool _enable = true) const;
246 
252  public: std::optional<std::vector<double>> Velocity(
253  const EntityComponentManager &_ecm) const;
254 
260  public: std::optional<std::vector<double>> Position(
261  const EntityComponentManager &_ecm) const;
262 
268  public: std::optional<std::vector<msgs::Wrench>> TransmittedWrench(
269  const EntityComponentManager &_ecm) const;
270 
275  public: std::optional<Model> ParentModel(
276  const EntityComponentManager &_ecm) const;
277 
279  GZ_UTILS_IMPL_PTR(dataPtr)
280  };
281  }
282  }
283 }
284 #endif