Gazebo Physics

API Reference

7.4.0
ConeShape.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2024 CogniPilot Foundation
3  * Copyright 2024 Open Source Robotics Foundation
4  * Copyright 2024 Rudis Laboratories
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18 */
19 
20 #ifndef GZ_PHYSICS_CONESHAPE_HH_
21 #define GZ_PHYSICS_CONESHAPE_HH_
22 
23 #include <string>
24 
26 #include <gz/physics/Geometry.hh>
27 
28 namespace gz
29 {
30  namespace physics
31  {
33 
34  class GZ_PHYSICS_VISIBLE GetConeShapeProperties
35  : public virtual FeatureWithRequirements<ConeShapeCast>
36  {
37  public: template <typename PolicyT, typename FeaturesT>
38  class ConeShape : public virtual Entity<PolicyT, FeaturesT>
39  {
40  public: using Scalar = typename PolicyT::Scalar;
41 
44  public: Scalar GetRadius() const;
45 
49  public: Scalar GetHeight() const;
50  };
51 
52  public: template <typename PolicyT>
53  class Implementation : public virtual Feature::Implementation<PolicyT>
54  {
55  public: using Scalar = typename PolicyT::Scalar;
56 
57  public: virtual Scalar GetConeShapeRadius(
58  const Identity &_coneID) const = 0;
59 
60  public: virtual Scalar GetConeShapeHeight(
61  const Identity &_coneID) const = 0;
62  };
63  };
64 
68  class GZ_PHYSICS_VISIBLE SetConeShapeProperties
69  : public virtual FeatureWithRequirements<ConeShapeCast>
70  {
71  public: template <typename PolicyT, typename FeaturesT>
72  class ConeShape : public virtual Entity<PolicyT, FeaturesT>
73  {
74  public: using Scalar = typename PolicyT::Scalar;
75 
79  public: void SetRadius(Scalar _radius);
80 
84  public: void SetHeight(Scalar _height);
85  };
86 
87  public: template <typename PolicyT>
88  class Implementation : public virtual Feature::Implementation<PolicyT>
89  {
90  public: using Scalar = typename PolicyT::Scalar;
91 
92  public: virtual void SetConeShapeRadius(
93  const Identity &_coneID, Scalar _radius) = 0;
94 
95  public: virtual void SetConeShapeHeight(
96  const Identity &_coneID, Scalar _height) = 0;
97  };
98  };
99 
104  class GZ_PHYSICS_VISIBLE AttachConeShapeFeature
105  : public virtual FeatureWithRequirements<ConeShapeCast>
106  {
107  public: template <typename PolicyT, typename FeaturesT>
108  class Link : public virtual Feature::Link<PolicyT, FeaturesT>
109  {
110  public: using Scalar = typename PolicyT::Scalar;
111 
112  public: using PoseType =
113  typename FromPolicy<PolicyT>::template Use<Pose>;
114 
115  public: using ShapePtrType = ConeShapePtr<PolicyT, FeaturesT>;
116 
127  const std::string &_name = "cone",
128  Scalar _radius = 1.0,
129  Scalar _height = 1.0,
130  const PoseType &_pose = PoseType::Identity());
131  };
132 
133  public: template <typename PolicyT>
134  class Implementation : public virtual Feature::Implementation<PolicyT>
135  {
136  public: using Scalar = typename PolicyT::Scalar;
137 
138  public: using PoseType =
139  typename FromPolicy<PolicyT>::template Use<Pose>;
140 
141  public: virtual Identity AttachConeShape(
142  const Identity &_linkID,
143  const std::string &_name,
144  Scalar _radius,
145  Scalar _height,
146  const PoseType &_pose) = 0;
147  };
148  };
149  }
150 }
151 
152 #include <gz/physics/detail/ConeShape.hh>
153 
154 #endif