Gazebo Physics

API Reference

6.5.1
gz/physics/BoxShape.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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_PHYSICS_BOXSHAPE_HH_
19 #define GZ_PHYSICS_BOXSHAPE_HH_
20 
21 #include <string>
22 
24 #include <gz/physics/Geometry.hh>
25 
26 namespace gz
27 {
28  namespace physics
29  {
31 
32  class GZ_PHYSICS_VISIBLE GetBoxShapeProperties
33  : public virtual FeatureWithRequirements<BoxShapeCast>
34  {
35  public: template <typename PolicyT, typename FeaturesT>
36  class BoxShape : public virtual Entity<PolicyT, FeaturesT>
37  {
38  public: using Dimensions =
39  typename FromPolicy<PolicyT>::template Use<LinearVector>;
40 
43  public: Dimensions GetSize() const;
44  };
45 
46  public: template <typename PolicyT>
47  class Implementation : public virtual Feature::Implementation<PolicyT>
48  {
49  public: using Dimensions =
50  typename FromPolicy<PolicyT>::template Use<LinearVector>;
51 
52  public: virtual Dimensions GetBoxShapeSize(
53  const Identity &_boxID) const = 0;
54  };
55  };
56 
57  class GZ_PHYSICS_VISIBLE SetBoxShapeProperties
58  : public virtual FeatureWithRequirements<BoxShapeCast>
59  {
60  public: template <typename PolicyT, typename FeaturesT>
61  class BoxShape : public virtual Entity<PolicyT, FeaturesT>
62  {
63  public: using Dimensions =
64  typename FromPolicy<PolicyT>::template Use<LinearVector>;
65 
69  public: void SetSize(const Dimensions &_size);
70  };
71 
72  public: template <typename PolicyT>
73  class Implementation : public virtual Feature::Implementation<PolicyT>
74  {
75  public: using Dimensions =
76  typename FromPolicy<PolicyT>::template Use<LinearVector>;
77 
78  public: virtual void SetBoxShapeSize(
79  const Identity &_boxID, const Dimensions &_size) = 0;
80  };
81  };
82 
87  class GZ_PHYSICS_VISIBLE AttachBoxShapeFeature
88  : public virtual FeatureWithRequirements<BoxShapeCast>
89  {
90  public: template <typename PolicyT, typename FeaturesT>
91  class Link : public virtual Feature::Link<PolicyT, FeaturesT>
92  {
93  public: using Dimensions =
94  typename FromPolicy<PolicyT>::template Use<LinearVector>;
95 
96  public: using PoseType =
97  typename FromPolicy<PolicyT>::template Use<Pose>;
98 
99  public: using ShapePtrType = BoxShapePtr<PolicyT, FeaturesT>;
100 
107  // TODO(MXG): Create a struct that contains all the relevant properties,
108  // and pass that in here.
109  public: ShapePtrType AttachBoxShape(
110  const std::string &_name = "box",
111  const Dimensions &_size = Dimensions::Constant(1.0),
112  const PoseType &_pose = PoseType::Identity());
113  };
114 
115  public: template <typename PolicyT>
116  class Implementation : public virtual Feature::Implementation<PolicyT>
117  {
118  public: using Dimensions =
119  typename FromPolicy<PolicyT>::template Use<LinearVector>;
120 
121  public: using PoseType =
122  typename FromPolicy<PolicyT>::template Use<Pose>;
123 
124  public: virtual Identity AttachBoxShape(
125  const Identity &_linkID,
126  const std::string &_name,
127  const Dimensions &_size,
128  const PoseType &_pose) = 0;
129  };
130  };
131  }
132 }
133 
134 #include <gz/physics/detail/BoxShape.hh>
135 
136 #endif